From f110451ff80dab023390453d9dc10608e9c54769 Mon Sep 17 00:00:00 2001 From: trajan0x <83933037+trajan0x@users.noreply.github.com> Date: Tue, 14 May 2024 11:03:04 +0100 Subject: [PATCH] fast bridge regen (#2636) Co-authored-by: Trajan0x --- .../rfq/contracts/fastbridge/fastbridge.abigen.go | 12 ++++++------ .../fastbridge/fastbridge.contractinfo.json | 2 +- .../fastbridgemock/fastbridgemock.abigen.go | 14 +++++++------- .../fastbridgemock.contractinfo.json | 2 +- .../testcontracts/mockerc20/mockerc20.abigen.go | 2 +- .../mockerc20/mockerc20.contractinfo.json | 2 +- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/services/rfq/contracts/fastbridge/fastbridge.abigen.go b/services/rfq/contracts/fastbridge/fastbridge.abigen.go index 12663b4c35..4a27b094ce 100644 --- a/services/rfq/contracts/fastbridge/fastbridge.abigen.go +++ b/services/rfq/contracts/fastbridge/fastbridge.abigen.go @@ -1799,7 +1799,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: "0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220484b80cd78ad146ed37d87f73b71fece9b7aef1b9090eddf52e592358acac67e64736f6c63430008140033", + Bin: "0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220c02bf2e5594888dce767567f7c2924eb180fd6f6904899db27dad663ca8f547864736f6c63430008140033", } // AddressABI is the input ABI used to generate the binding from. @@ -1995,7 +1995,7 @@ var AdminMetaData = &bind.MetaData{ "01ffc9a7": "supportsInterface(bytes4)", "06f333f2": "sweepProtocolFees(address,address)", }, - Bin: "0x60806040523480156200001157600080fd5b50604051620014123803806200141283398101604081905262000034916200018e565b6200004160008262000049565b5050620001b9565b60008062000058848462000086565b905080156200007d5760008481526001602052604090206200007b908462000134565b505b90505b92915050565b6000828152602081815260408083206001600160a01b038516845290915281205460ff166200012b576000838152602081815260408083206001600160a01b03861684529091529020805460ff19166001179055620000e23390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a450600162000080565b50600062000080565b60006200007d836001600160a01b03841660008181526001830160205260408120546200012b5750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915562000080565b600060208284031215620001a157600080fd5b81516001600160a01b03811681146200007d57600080fd5b61124980620001c96000396000f3fe608060405234801561001057600080fd5b50600436106101775760003560e01c806391d14854116100d8578063bf333f2c1161008c578063d547741f11610066578063d547741f14610385578063dcf844a714610398578063e00a83e0146103b857600080fd5b8063bf333f2c14610341578063ca15c8731461034b578063ccc574901461035e57600080fd5b8063a217fddf116100bd578063a217fddf14610313578063b13aa2d61461031b578063b250fe6b1461032e57600080fd5b806391d14854146102a8578063926d7d7f146102ec57600080fd5b80632f2ff15d1161012f57806358f858801161011457806358f85880146102405780635960ccf2146102495780639010d07c1461027057600080fd5b80632f2ff15d1461021a57806336568abe1461022d57600080fd5b806306f333f21161016057806306f333f2146101d95780630f5f6ed7146101ee578063248a9ca3146101f757600080fd5b806301ffc9a71461017c57806303ed0ee5146101a4575b600080fd5b61018f61018a366004611013565b6103c1565b60405190151581526020015b60405180910390f35b6101cb7f043c983c49d46f0e102151eaf8085d4a2e6571d5df2d47b013f39bddfd4a639d81565b60405190815260200161019b565b6101ec6101e736600461107e565b61041d565b005b6101cb61271081565b6101cb6102053660046110b1565b60009081526020819052604090206001015490565b6101ec6102283660046110ca565b61050b565b6101ec61023b3660046110ca565b610536565b6101cb60025481565b6101cb7fdb9556138406326f00296e13ea2ad7db24ba82381212d816b1a40c23b466b32781565b61028361027e3660046110ed565b61058f565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161019b565b61018f6102b63660046110ca565b60009182526020828152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b6101cb7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc481565b6101cb600081565b6101ec6103293660046110b1565b6105ae565b6101ec61033c3660046110b1565b610690565b6101cb620f424081565b6101cb6103593660046110b1565b6106f8565b6101cb7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5581565b6101ec6103933660046110ca565b61070f565b6101cb6103a636600461110f565b60036020526000908152604090205481565b6101cb60045481565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f5a05180f000000000000000000000000000000000000000000000000000000001480610417575061041782610734565b92915050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f55610447816107cb565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600360205260408120549081900361047b5750505050565b73ffffffffffffffffffffffffffffffffffffffff84166000818152600360205260408120556104ac9084836107d8565b6040805173ffffffffffffffffffffffffffffffffffffffff8087168252851660208201529081018290527f244e51bc38c1452fa8aaf487bcb4bca36c2baa3a5fbdb776b1eabd8dc6d277cd9060600160405180910390a1505b505050565b600082815260208190526040902060010154610526816107cb565b610530838361092f565b50505050565b73ffffffffffffffffffffffffffffffffffffffff81163314610585576040517f6697b23200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6105068282610964565b60008281526001602052604081206105a79083610991565b9392505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f556105d8816107cb565b612710821115610649576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f6e657746656552617465203e206d61780000000000000000000000000000000060448201526064015b60405180910390fd5b600280549083905560408051828152602081018590527f14914da2bf76024616fbe1859783fcd4dbddcb179b1f3a854949fbf920dcb95791015b60405180910390a1505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f556106ba816107cb565b600480549083905560408051828152602081018590527f5cf09b12f3f56b4c564d51b25b40360af6d795198adb61ae0806a36c294323fa9101610683565b60008181526001602052604081206104179061099d565b60008281526020819052604090206001015461072a816107cb565b6105308383610964565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061041757507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614610417565b6107d581336109a7565b50565b3073ffffffffffffffffffffffffffffffffffffffff8316036107fa57505050565b8060000361080757505050565b7fffffffffffffffffffffffff111111111111111111111111111111111111111273ffffffffffffffffffffffffffffffffffffffff84160161090e5760008273ffffffffffffffffffffffffffffffffffffffff168260405160006040518083038185875af1925050503d806000811461089e576040519150601f19603f3d011682016040523d82523d6000602084013e6108a3565b606091505b5050905080610530576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f455448207472616e73666572206661696c6564000000000000000000000000006044820152606401610640565b61050673ffffffffffffffffffffffffffffffffffffffff84168383610a31565b60008061093c8484610abe565b905080156105a757600084815260016020526040902061095c9084610bba565b509392505050565b6000806109718484610bdc565b905080156105a757600084815260016020526040902061095c9084610c97565b60006105a78383610cb9565b6000610417825490565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16610a2d576040517fe2517d3f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8216600482015260248101839052604401610640565b5050565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000179052610506908490610ce3565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915281205460ff16610bb25760008381526020818152604080832073ffffffffffffffffffffffffffffffffffffffff86168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055610b503390565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a4506001610417565b506000610417565b60006105a78373ffffffffffffffffffffffffffffffffffffffff8416610d79565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915281205460ff1615610bb25760008381526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8616808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a4506001610417565b60006105a78373ffffffffffffffffffffffffffffffffffffffff8416610dc0565b6000826000018281548110610cd057610cd061112a565b9060005260206000200154905092915050565b6000610d0573ffffffffffffffffffffffffffffffffffffffff841683610eb3565b90508051600014158015610d2a575080806020019051810190610d289190611159565b155b15610506576040517f5274afe700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84166004820152602401610640565b6000818152600183016020526040812054610bb257508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610417565b60008181526001830160205260408120548015610ea9576000610de460018361117b565b8554909150600090610df89060019061117b565b9050808214610e5d576000866000018281548110610e1857610e1861112a565b9060005260206000200154905080876000018481548110610e3b57610e3b61112a565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080610e6e57610e6e6111b5565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610417565b6000915050610417565b60606105a783836000846000808573ffffffffffffffffffffffffffffffffffffffff168486604051610ee691906111e4565b60006040518083038185875af1925050503d8060008114610f23576040519150601f19603f3d011682016040523d82523d6000602084013e610f28565b606091505b5091509150610f38868383610f42565b9695505050505050565b606082610f5757610f5282610fd1565b6105a7565b8151158015610f7b575073ffffffffffffffffffffffffffffffffffffffff84163b155b15610fca576040517f9996b31500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85166004820152602401610640565b50806105a7565b805115610fe15780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006020828403121561102557600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146105a757600080fd5b803573ffffffffffffffffffffffffffffffffffffffff8116811461107957600080fd5b919050565b6000806040838503121561109157600080fd5b61109a83611055565b91506110a860208401611055565b90509250929050565b6000602082840312156110c357600080fd5b5035919050565b600080604083850312156110dd57600080fd5b823591506110a860208401611055565b6000806040838503121561110057600080fd5b50508035926020909101359150565b60006020828403121561112157600080fd5b6105a782611055565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006020828403121561116b57600080fd5b815180151581146105a757600080fd5b81810381811115610417577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b6000825160005b8181101561120557602081860181015185830152016111eb565b50600092019182525091905056fea2646970667358221220ae622a2da80c730eb06fbc09f0feabbb824bbdb349894cba40b3bf6d93d73db164736f6c63430008140033", + Bin: "0x60806040523480156200001157600080fd5b50604051620014123803806200141283398101604081905262000034916200018e565b6200004160008262000049565b5050620001b9565b60008062000058848462000086565b905080156200007d5760008481526001602052604090206200007b908462000134565b505b90505b92915050565b6000828152602081815260408083206001600160a01b038516845290915281205460ff166200012b576000838152602081815260408083206001600160a01b03861684529091529020805460ff19166001179055620000e23390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a450600162000080565b50600062000080565b60006200007d836001600160a01b03841660008181526001830160205260408120546200012b5750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915562000080565b600060208284031215620001a157600080fd5b81516001600160a01b03811681146200007d57600080fd5b61124980620001c96000396000f3fe608060405234801561001057600080fd5b50600436106101775760003560e01c806391d14854116100d8578063bf333f2c1161008c578063d547741f11610066578063d547741f14610385578063dcf844a714610398578063e00a83e0146103b857600080fd5b8063bf333f2c14610341578063ca15c8731461034b578063ccc574901461035e57600080fd5b8063a217fddf116100bd578063a217fddf14610313578063b13aa2d61461031b578063b250fe6b1461032e57600080fd5b806391d14854146102a8578063926d7d7f146102ec57600080fd5b80632f2ff15d1161012f57806358f858801161011457806358f85880146102405780635960ccf2146102495780639010d07c1461027057600080fd5b80632f2ff15d1461021a57806336568abe1461022d57600080fd5b806306f333f21161016057806306f333f2146101d95780630f5f6ed7146101ee578063248a9ca3146101f757600080fd5b806301ffc9a71461017c57806303ed0ee5146101a4575b600080fd5b61018f61018a366004611013565b6103c1565b60405190151581526020015b60405180910390f35b6101cb7f043c983c49d46f0e102151eaf8085d4a2e6571d5df2d47b013f39bddfd4a639d81565b60405190815260200161019b565b6101ec6101e736600461107e565b61041d565b005b6101cb61271081565b6101cb6102053660046110b1565b60009081526020819052604090206001015490565b6101ec6102283660046110ca565b61050b565b6101ec61023b3660046110ca565b610536565b6101cb60025481565b6101cb7fdb9556138406326f00296e13ea2ad7db24ba82381212d816b1a40c23b466b32781565b61028361027e3660046110ed565b61058f565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161019b565b61018f6102b63660046110ca565b60009182526020828152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b6101cb7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc481565b6101cb600081565b6101ec6103293660046110b1565b6105ae565b6101ec61033c3660046110b1565b610690565b6101cb620f424081565b6101cb6103593660046110b1565b6106f8565b6101cb7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5581565b6101ec6103933660046110ca565b61070f565b6101cb6103a636600461110f565b60036020526000908152604090205481565b6101cb60045481565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f5a05180f000000000000000000000000000000000000000000000000000000001480610417575061041782610734565b92915050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f55610447816107cb565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600360205260408120549081900361047b5750505050565b73ffffffffffffffffffffffffffffffffffffffff84166000818152600360205260408120556104ac9084836107d8565b6040805173ffffffffffffffffffffffffffffffffffffffff8087168252851660208201529081018290527f244e51bc38c1452fa8aaf487bcb4bca36c2baa3a5fbdb776b1eabd8dc6d277cd9060600160405180910390a1505b505050565b600082815260208190526040902060010154610526816107cb565b610530838361092f565b50505050565b73ffffffffffffffffffffffffffffffffffffffff81163314610585576040517f6697b23200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6105068282610964565b60008281526001602052604081206105a79083610991565b9392505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f556105d8816107cb565b612710821115610649576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f6e657746656552617465203e206d61780000000000000000000000000000000060448201526064015b60405180910390fd5b600280549083905560408051828152602081018590527f14914da2bf76024616fbe1859783fcd4dbddcb179b1f3a854949fbf920dcb95791015b60405180910390a1505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f556106ba816107cb565b600480549083905560408051828152602081018590527f5cf09b12f3f56b4c564d51b25b40360af6d795198adb61ae0806a36c294323fa9101610683565b60008181526001602052604081206104179061099d565b60008281526020819052604090206001015461072a816107cb565b6105308383610964565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061041757507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614610417565b6107d581336109a7565b50565b3073ffffffffffffffffffffffffffffffffffffffff8316036107fa57505050565b8060000361080757505050565b7fffffffffffffffffffffffff111111111111111111111111111111111111111273ffffffffffffffffffffffffffffffffffffffff84160161090e5760008273ffffffffffffffffffffffffffffffffffffffff168260405160006040518083038185875af1925050503d806000811461089e576040519150601f19603f3d011682016040523d82523d6000602084013e6108a3565b606091505b5050905080610530576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f455448207472616e73666572206661696c6564000000000000000000000000006044820152606401610640565b61050673ffffffffffffffffffffffffffffffffffffffff84168383610a31565b60008061093c8484610abe565b905080156105a757600084815260016020526040902061095c9084610bba565b509392505050565b6000806109718484610bdc565b905080156105a757600084815260016020526040902061095c9084610c97565b60006105a78383610cb9565b6000610417825490565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16610a2d576040517fe2517d3f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8216600482015260248101839052604401610640565b5050565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000179052610506908490610ce3565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915281205460ff16610bb25760008381526020818152604080832073ffffffffffffffffffffffffffffffffffffffff86168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055610b503390565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a4506001610417565b506000610417565b60006105a78373ffffffffffffffffffffffffffffffffffffffff8416610d79565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915281205460ff1615610bb25760008381526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8616808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a4506001610417565b60006105a78373ffffffffffffffffffffffffffffffffffffffff8416610dc0565b6000826000018281548110610cd057610cd061112a565b9060005260206000200154905092915050565b6000610d0573ffffffffffffffffffffffffffffffffffffffff841683610eb3565b90508051600014158015610d2a575080806020019051810190610d289190611159565b155b15610506576040517f5274afe700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84166004820152602401610640565b6000818152600183016020526040812054610bb257508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610417565b60008181526001830160205260408120548015610ea9576000610de460018361117b565b8554909150600090610df89060019061117b565b9050808214610e5d576000866000018281548110610e1857610e1861112a565b9060005260206000200154905080876000018481548110610e3b57610e3b61112a565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080610e6e57610e6e6111b5565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610417565b6000915050610417565b60606105a783836000846000808573ffffffffffffffffffffffffffffffffffffffff168486604051610ee691906111e4565b60006040518083038185875af1925050503d8060008114610f23576040519150601f19603f3d011682016040523d82523d6000602084013e610f28565b606091505b5091509150610f38868383610f42565b9695505050505050565b606082610f5757610f5282610fd1565b6105a7565b8151158015610f7b575073ffffffffffffffffffffffffffffffffffffffff84163b155b15610fca576040517f9996b31500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85166004820152602401610640565b50806105a7565b805115610fe15780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006020828403121561102557600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146105a757600080fd5b803573ffffffffffffffffffffffffffffffffffffffff8116811461107957600080fd5b919050565b6000806040838503121561109157600080fd5b61109a83611055565b91506110a860208401611055565b90509250929050565b6000602082840312156110c357600080fd5b5035919050565b600080604083850312156110dd57600080fd5b823591506110a860208401611055565b6000806040838503121561110057600080fd5b50508035926020909101359150565b60006020828403121561112157600080fd5b6105a782611055565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006020828403121561116b57600080fd5b815180151581146105a757600080fd5b81810381811115610417577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b6000825160005b8181101561120557602081860181015185830152016111eb565b50600092019182525091905056fea26469706673582212207051827fc52cd8db023eca7a58610870ecfcd93ea76d5ed3296b385ea81ce18e64736f6c63430008140033", } // AdminABI is the input ABI used to generate the binding from. @@ -3995,7 +3995,7 @@ func (_ERC165 *ERC165CallerSession) SupportsInterface(interfaceId [4]byte) (bool // EnumerableSetMetaData contains all meta data concerning the EnumerableSet contract. var EnumerableSetMetaData = &bind.MetaData{ ABI: "[]", - Bin: "0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220ccb9bee87c33656dd99a59e58a032b4a522fa9282d7547294079dc934f18ba3f64736f6c63430008140033", + Bin: "0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212203a6e3f60ed51bcb9fc27641637557f1f938845d6b833150d5c8467b60921792564736f6c63430008140033", } // EnumerableSetABI is the input ABI used to generate the binding from. @@ -4207,7 +4207,7 @@ var FastBridgeMetaData = &bind.MetaData{ "01ffc9a7": "supportsInterface(bytes4)", "06f333f2": "sweepProtocolFees(address,address)", }, - Bin: "0x60a06040523480156200001157600080fd5b5060405162002d7a38038062002d7a833981016040819052620000349162000194565b80620000426000826200004f565b50504360805250620001bf565b6000806200005e84846200008c565b90508015620000835760008481526001602052604090206200008190846200013a565b505b90505b92915050565b6000828152602081815260408083206001600160a01b038516845290915281205460ff1662000131576000838152602081815260408083206001600160a01b03861684529091529020805460ff19166001179055620000e83390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a450600162000086565b50600062000086565b600062000083836001600160a01b0384166000818152600183016020526040812054620001315750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915562000086565b600060208284031215620001a757600080fd5b81516001600160a01b03811681146200008357600080fd5b608051612b9f620001db60003960006106510152612b9f6000f3fe60806040526004361061026a5760003560e01c80639010d07c11610153578063add98c70116100cb578063ca15c8731161007f578063d547741f11610064578063d547741f146107a1578063dcf844a7146107c1578063e00a83e0146107ee57600080fd5b8063ca15c8731461074d578063ccc574901461076d57600080fd5b8063b13aa2d6116100b0578063b13aa2d6146106f6578063b250fe6b14610716578063bf333f2c1461073657600080fd5b8063add98c70146106c0578063affed0e0146106e057600080fd5b8063a217fddf11610122578063a5bbe22b11610107578063a5bbe22b1461047f578063aa9641ab14610673578063ac11fb1a1461069357600080fd5b8063a217fddf1461062a578063a3ec191a1461063f57600080fd5b80639010d07c146104f857806391ad50391461053057806391d14854146105b2578063926d7d7f146105f657600080fd5b806341fcb612116101e65780635eb7d946116101b55780638379a24f1161019a5780638379a24f14610495578063886d36ff146104c55780638f0d6f17146104e557600080fd5b80635eb7d9461461045f578063820688d51461047f57600080fd5b806341fcb612146103e2578063458516941461040257806358f85880146104155780635960ccf21461042b57600080fd5b80630f5f6ed71161023d578063248a9ca311610222578063248a9ca3146103725780632f2ff15d146103a257806336568abe146103c257600080fd5b80630f5f6ed714610345578063190da5951461035b57600080fd5b806301ffc9a71461026f57806303ed0ee5146102a4578063051287bc146102e657806306f333f214610323575b600080fd5b34801561027b57600080fd5b5061028f61028a3660046122fc565b610804565b60405190151581526020015b60405180910390f35b3480156102b057600080fd5b506102d87f043c983c49d46f0e102151eaf8085d4a2e6571d5df2d47b013f39bddfd4a639d81565b60405190815260200161029b565b3480156102f257600080fd5b5061031661030136600461233e565b60056020526000908152604090205460ff1681565b60405161029b9190612386565b34801561032f57600080fd5b5061034361033e3660046123ec565b610860565b005b34801561035157600080fd5b506102d861271081565b34801561036757600080fd5b506102d862093a8081565b34801561037e57600080fd5b506102d861038d36600461233e565b60009081526020819052604090206001015490565b3480156103ae57600080fd5b506103436103bd366004612425565b610927565b3480156103ce57600080fd5b506103436103dd366004612425565b610952565b3480156103ee57600080fd5b506103436103fd366004612572565b61099e565b6103436104103660046125ef565b610bd7565b34801561042157600080fd5b506102d860025481565b34801561043757600080fd5b506102d87fdb9556138406326f00296e13ea2ad7db24ba82381212d816b1a40c23b466b32781565b34801561046b57600080fd5b5061034361047a366004612692565b610ee5565b34801561048b57600080fd5b506102d861070881565b3480156104a157600080fd5b5061028f6104b036600461233e565b60076020526000908152604090205460ff1681565b3480156104d157600080fd5b506103436104e03660046126cf565b6110bd565b6103436104f3366004612692565b6111f0565b34801561050457600080fd5b50610518610513366004612714565b611437565b6040516001600160a01b03909116815260200161029b565b34801561053c57600080fd5b5061058661054b36600461233e565b6006602052600090815260409020546bffffffffffffffffffffffff8116906c0100000000000000000000000090046001600160a01b031682565b604080516bffffffffffffffffffffffff90931683526001600160a01b0390911660208301520161029b565b3480156105be57600080fd5b5061028f6105cd366004612425565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b34801561060257600080fd5b506102d87fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc481565b34801561063657600080fd5b506102d8600081565b34801561064b57600080fd5b506102d87f000000000000000000000000000000000000000000000000000000000000000081565b34801561067f57600080fd5b5061028f61068e366004612425565b611456565b34801561069f57600080fd5b506106b36106ae366004612692565b611559565b60405161029b9190612736565b3480156106cc57600080fd5b506103436106db36600461233e565b6115cc565b3480156106ec57600080fd5b506102d860085481565b34801561070257600080fd5b5061034361071136600461233e565b611735565b34801561072257600080fd5b5061034361073136600461233e565b611817565b34801561074257600080fd5b506102d8620f424081565b34801561075957600080fd5b506102d861076836600461233e565b61187f565b34801561077957600080fd5b506102d87f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5581565b3480156107ad57600080fd5b506103436107bc366004612425565b611896565b3480156107cd57600080fd5b506102d86107dc36600461281c565b60036020526000908152604090205481565b3480156107fa57600080fd5b506102d860045481565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f5a05180f00000000000000000000000000000000000000000000000000000000148061085a575061085a826118bb565b92915050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5561088a81611952565b6001600160a01b038316600090815260036020526040812054908190036108b15750505050565b6001600160a01b0384166000818152600360205260408120556108d590848361195f565b604080516001600160a01b038087168252851660208201529081018290527f244e51bc38c1452fa8aaf487bcb4bca36c2baa3a5fbdb776b1eabd8dc6d277cd9060600160405180910390a1505b505050565b60008281526020819052604090206001015461094281611952565b61094c8383611a82565b50505050565b6001600160a01b0381163314610994576040517f6697b23200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6109228282611ab7565b7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc46109c881611952565b8251602084012060006109da85611559565b9050600260008381526005602052604090205460ff166004811115610a0157610a01612357565b14610a38576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000828152600660209081526040918290208251808401909352546bffffffffffffffffffffffff811683526c0100000000000000000000000090046001600160a01b03169082018190523314610abb576040517f4af43a9000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80516107089042036bffffffffffffffffffffffff1611610b08576040517f1992d0bd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000838152600560205260409020805460ff1916600317905561010082015115610b645761010082015160808301516001600160a01b031660009081526003602052604081208054909190610b5e908490612868565b90915550505b608082015160c0830151610b826001600160a01b038316888361195f565b604080516001600160a01b03848116825260208201849052891691339188917f582211c35a2139ac3bbaac74663c6a1f56c6cbb658b41fe11fd45a82074ac67891015b60405180910390a45050505050505050565b46816000015163ffffffff1603610c1a576040517f7029fdf900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60a08101511580610c2d575060c0810151155b15610c64576040517fe38820c800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60608101516001600160a01b03161580610c89575060808101516001600160a01b0316155b15610cc0576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610ccc61070842612868565b8161010001511015610d0a576040517f04b7fcc800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000610d1f3083606001518460a00151611ae4565b90506000806002541115610d4c57620f424060025483610d3f919061287b565b610d499190612892565b90505b610d5681836128cd565b915060006040518061018001604052804663ffffffff168152602001856000015163ffffffff16815260200185602001516001600160a01b0316815260200185604001516001600160a01b0316815260200185606001516001600160a01b0316815260200185608001516001600160a01b031681526020018481526020018560c0015181526020018381526020018560e0015115158152602001856101000151815260200160086000815480929190610e0e906128e0565b909155509052604051610e249190602001612736565b604080518083037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0018152828252805160208083019190912060008181526005835293909320805460ff191660011790558701518751606089015160808a015160c08b015160e08c015195985095966001600160a01b039094169587957f120ea0364f36cdac7983bcfdd55270ca09d7f9b314a2ebc425a3b01ab1d6403a95610ed6958b959094909390928e9261293c565b60405180910390a35050505050565b805160208201206000610ef783611559565b3360009081527fd2043bf65931af3dbecf60d0db8f40e4160406d7beb00522f4200cf4944a1eb8602052604090205490915060ff1615610f74578061014001514211610f6f576040517fe15ff9ea00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610fc0565b62093a80816101400151610f889190612868565b4211610fc0576040517fe15ff9ea00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600160008381526005602052604090205460ff166004811115610fe557610fe5612357565b1461101c576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600082815260056020526040808220805460ff19166004179055820151608083015161010084015160c0850151929391926110579190612868565b905061106d6001600160a01b038316848361195f565b604080516001600160a01b0384811682526020820184905285169187917fb4c55c0c9bc613519b920e88748090150b890a875d307f21bea7d4fb2e8bc958910160405180910390a3505050505050565b7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc46110e781611952565b82516020840120600160008281526005602052604090205460ff16600481111561111357611113612357565b1461114a576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008181526005602090815260408083208054600260ff19909116179055805180820182526bffffffffffffffffffffffff4281168252338285018181528787526006865295849020925195516001600160a01b03166c0100000000000000000000000002959091169490941790555185815283917f4ac8af8a2cd87193d64dfc7a3b8d9923b714ec528b18725d080aa1299be0c5e4910160405180910390a350505050565b7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc461121a81611952565b81516020830120600061122c84611559565b90504663ffffffff16816020015163ffffffff1614611277576040517f7029fdf900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8061014001514211156112b6576040517f559895a300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008281526007602052604090205460ff16156112ff576040517fbef7bb7d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000828152600760205260409020805460ff19166001179055606081015160a082015160e083015160045461012085015161134857506000611342848484611ae4565b506113b9565b7fffffffffffffffffffffffff11111111111111111111111111111111111111126001600160a01b0384160161138c5761134284846113878486612868565b611ae4565b611397848484611ae4565b506113b78473eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee83611ae4565b505b845160808087015160a08089015160c0808b015160e08c01516040805163ffffffff90991689526001600160a01b0396871660208a0152938616938801939093526060870152938501528301849052861691339189917ff8ae392d784b1ea5e8881bfa586d81abf07ef4f1e2fc75f7fe51c90f05199a5c9101610bc5565b600082815260016020526040812061144f9083611cb3565b9392505050565b6000600260008481526005602052604090205460ff16600481111561147d5761147d612357565b146114b4576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000838152600660209081526040918290208251808401909352546bffffffffffffffffffffffff811683526001600160a01b036c01000000000000000000000000909104811691830182905284161461153a576040517f4af43a9000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80516107089042036bffffffffffffffffffffffff1611949350505050565b604080516101808101825260008082526020808301829052928201819052606082018190526080820181905260a0820181905260c0820181905260e082018190526101008201819052610120820181905261014082018190526101608201528251909161085a91840181019084016129ed565b7f043c983c49d46f0e102151eaf8085d4a2e6571d5df2d47b013f39bddfd4a639d6115f681611952565b600260008381526005602052604090205460ff16600481111561161b5761161b612357565b14611652576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000828152600660209081526040918290208251808401909352546bffffffffffffffffffffffff8082168085526c010000000000000000000000009092046001600160a01b031693909201929092526107089142031611156116e1576040517f3e908aac00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000828152600560209081526040808320805460ff19166001179055600690915280822082905551339184917f0695cf1d39b3055dcd0fe02d8b47eaf0d5a13e1996de925de59d0ef9b7f7fad49190a35050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5561175f81611952565b6127108211156117d0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f6e657746656552617465203e206d61780000000000000000000000000000000060448201526064015b60405180910390fd5b600280549083905560408051828152602081018590527f14914da2bf76024616fbe1859783fcd4dbddcb179b1f3a854949fbf920dcb95791015b60405180910390a1505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5561184181611952565b600480549083905560408051828152602081018590527f5cf09b12f3f56b4c564d51b25b40360af6d795198adb61ae0806a36c294323fa910161180a565b600081815260016020526040812061085a90611cbf565b6000828152602081905260409020600101546118b181611952565b61094c8383611ab7565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061085a57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff0000000000000000000000000000000000000000000000000000000083161461085a565b61195c8133611cc9565b50565b306001600160a01b0383160361197457505050565b8060000361198157505050565b7fffffffffffffffffffffffff11111111111111111111111111111111111111126001600160a01b03841601611a6e576000826001600160a01b03168260405160006040518083038185875af1925050503d80600081146119fe576040519150601f19603f3d011682016040523d82523d6000602084013e611a03565b606091505b505090508061094c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f455448207472616e73666572206661696c65640000000000000000000000000060448201526064016117c7565b6109226001600160a01b0384168383611d39565b600080611a8f8484611dad565b9050801561144f576000848152600160205260409020611aaf9084611e57565b509392505050565b600080611ac48484611e6c565b9050801561144f576000848152600160205260409020611aaf9084611eef565b60006001600160a01b03831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14611c4d57611b1c836001600160a01b0316611f04565b6040517f70a082310000000000000000000000000000000000000000000000000000000081526001600160a01b0385811660048301528416906370a0823190602401602060405180830381865afa158015611b7b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b9f9190612ab9565b9050611bb66001600160a01b038416338685611faa565b6040517f70a082310000000000000000000000000000000000000000000000000000000081526001600160a01b0385811660048301528291908516906370a0823190602401602060405180830381865afa158015611c18573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c3c9190612ab9565b611c4691906128cd565b905061144f565b348214611c86576040517f81de0bf300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b0384163014611caa57611caa6001600160a01b038416858461195f565b50349392505050565b600061144f8383611fe3565b600061085a825490565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16611d35576040517fe2517d3f0000000000000000000000000000000000000000000000000000000081526001600160a01b0382166004820152602481018390526044016117c7565b5050565b6040516001600160a01b0383811660248301526044820183905261092291859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505061200d565b6000828152602081815260408083206001600160a01b038516845290915281205460ff16611e4f576000838152602081815260408083206001600160a01b03861684529091529020805460ff19166001179055611e073390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a450600161085a565b50600061085a565b600061144f836001600160a01b038416612089565b6000828152602081815260408083206001600160a01b038516845290915281205460ff1615611e4f576000838152602081815260408083206001600160a01b0386168085529252808320805460ff1916905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a450600161085a565b600061144f836001600160a01b0384166120d0565b7fffffffffffffffffffffffff11111111111111111111111111111111111111126001600160a01b03821601611f66576040517f7f523fe800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b806001600160a01b03163b60000361195c576040517f7f523fe800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040516001600160a01b03848116602483015283811660448301526064820183905261094c9186918216906323b872dd90608401611d66565b6000826000018281548110611ffa57611ffa612ad2565b9060005260206000200154905092915050565b60006120226001600160a01b038416836121c3565b905080516000141580156120475750808060200190518101906120459190612b01565b155b15610922576040517f5274afe70000000000000000000000000000000000000000000000000000000081526001600160a01b03841660048201526024016117c7565b6000818152600183016020526040812054611e4f5750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561085a565b600081815260018301602052604081205480156121b95760006120f46001836128cd565b8554909150600090612108906001906128cd565b905080821461216d57600086600001828154811061212857612128612ad2565b906000526020600020015490508087600001848154811061214b5761214b612ad2565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061217e5761217e612b1e565b60019003818190600052602060002001600090559055856001016000868152602001908152602001600020600090556001935050505061085a565b600091505061085a565b606061144f8383600084600080856001600160a01b031684866040516121e99190612b4d565b60006040518083038185875af1925050503d8060008114612226576040519150601f19603f3d011682016040523d82523d6000602084013e61222b565b606091505b509150915061223b868383612245565b9695505050505050565b60608261225a57612255826122ba565b61144f565b815115801561227157506001600160a01b0384163b155b156122b3576040517f9996b3150000000000000000000000000000000000000000000000000000000081526001600160a01b03851660048201526024016117c7565b508061144f565b8051156122ca5780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006020828403121561230e57600080fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811461144f57600080fd5b60006020828403121561235057600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b60208101600583106123c1577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b91905290565b6001600160a01b038116811461195c57600080fd5b80356123e7816123c7565b919050565b600080604083850312156123ff57600080fd5b823561240a816123c7565b9150602083013561241a816123c7565b809150509250929050565b6000806040838503121561243857600080fd5b82359150602083013561241a816123c7565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051610120810167ffffffffffffffff8111828210171561249d5761249d61244a565b60405290565b604051610180810167ffffffffffffffff8111828210171561249d5761249d61244a565b600082601f8301126124d857600080fd5b813567ffffffffffffffff808211156124f3576124f361244a565b604051601f83017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f011681019082821181831017156125395761253961244a565b8160405283815286602085880101111561255257600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000806040838503121561258557600080fd5b823567ffffffffffffffff81111561259c57600080fd5b6125a8858286016124c7565b925050602083013561241a816123c7565b63ffffffff8116811461195c57600080fd5b80356123e7816125b9565b801515811461195c57600080fd5b80356123e7816125d6565b6000610120828403121561260257600080fd5b61260a612479565b612613836125cb565b8152612621602084016123dc565b6020820152612632604084016123dc565b6040820152612643606084016123dc565b6060820152612654608084016123dc565b608082015260a083013560a082015260c083013560c082015261267960e084016125e4565b60e0820152610100928301359281019290925250919050565b6000602082840312156126a457600080fd5b813567ffffffffffffffff8111156126bb57600080fd5b6126c7848285016124c7565b949350505050565b600080604083850312156126e257600080fd5b823567ffffffffffffffff8111156126f957600080fd5b612705858286016124c7565b95602094909401359450505050565b6000806040838503121561272757600080fd5b50508035926020909101359150565b815163ffffffff1681526101808101602083015161275c602084018263ffffffff169052565b50604083015161277760408401826001600160a01b03169052565b50606083015161279260608401826001600160a01b03169052565b5060808301516127ad60808401826001600160a01b03169052565b5060a08301516127c860a08401826001600160a01b03169052565b5060c083015160c083015260e083015160e0830152610100808401518184015250610120808401516127fd8285018215159052565b5050610140838101519083015261016092830151929091019190915290565b60006020828403121561282e57600080fd5b813561144f816123c7565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8082018082111561085a5761085a612839565b808202811582820484141761085a5761085a612839565b6000826128c8577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b8181038181111561085a5761085a612839565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361291157612911612839565b5060010190565b60005b8381101561293357818101518382015260200161291b565b50506000910152565b60e08152600088518060e084015261010061295d8282860160208e01612918565b63ffffffff9990991660208401526001600160a01b039788166040840152959096166060820152608081019390935260a0830191909152151560c0820152601f9091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0160190910192915050565b80516123e7816125b9565b80516123e7816123c7565b80516123e7816125d6565b60006101808284031215612a0057600080fd5b612a086124a3565b612a11836129cc565b8152612a1f602084016129cc565b6020820152612a30604084016129d7565b6040820152612a41606084016129d7565b6060820152612a52608084016129d7565b6080820152612a6360a084016129d7565b60a082015260c083015160c082015260e083015160e0820152610100808401518183015250610120612a968185016129e2565b908201526101408381015190820152610160928301519281019290925250919050565b600060208284031215612acb57600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600060208284031215612b1357600080fd5b815161144f816125d6565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b60008251612b5f818460208701612918565b919091019291505056fea26469706673582212207d038d8dfad42c58e5149b646b9e05914f990dd941b51e06388a96d1ed46308264736f6c63430008140033", + Bin: "0x60a06040523480156200001157600080fd5b5060405162002d7a38038062002d7a833981016040819052620000349162000194565b80620000426000826200004f565b50504360805250620001bf565b6000806200005e84846200008c565b90508015620000835760008481526001602052604090206200008190846200013a565b505b90505b92915050565b6000828152602081815260408083206001600160a01b038516845290915281205460ff1662000131576000838152602081815260408083206001600160a01b03861684529091529020805460ff19166001179055620000e83390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a450600162000086565b50600062000086565b600062000083836001600160a01b0384166000818152600183016020526040812054620001315750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915562000086565b600060208284031215620001a757600080fd5b81516001600160a01b03811681146200008357600080fd5b608051612b9f620001db60003960006106510152612b9f6000f3fe60806040526004361061026a5760003560e01c80639010d07c11610153578063add98c70116100cb578063ca15c8731161007f578063d547741f11610064578063d547741f146107a1578063dcf844a7146107c1578063e00a83e0146107ee57600080fd5b8063ca15c8731461074d578063ccc574901461076d57600080fd5b8063b13aa2d6116100b0578063b13aa2d6146106f6578063b250fe6b14610716578063bf333f2c1461073657600080fd5b8063add98c70146106c0578063affed0e0146106e057600080fd5b8063a217fddf11610122578063a5bbe22b11610107578063a5bbe22b1461047f578063aa9641ab14610673578063ac11fb1a1461069357600080fd5b8063a217fddf1461062a578063a3ec191a1461063f57600080fd5b80639010d07c146104f857806391ad50391461053057806391d14854146105b2578063926d7d7f146105f657600080fd5b806341fcb612116101e65780635eb7d946116101b55780638379a24f1161019a5780638379a24f14610495578063886d36ff146104c55780638f0d6f17146104e557600080fd5b80635eb7d9461461045f578063820688d51461047f57600080fd5b806341fcb612146103e2578063458516941461040257806358f85880146104155780635960ccf21461042b57600080fd5b80630f5f6ed71161023d578063248a9ca311610222578063248a9ca3146103725780632f2ff15d146103a257806336568abe146103c257600080fd5b80630f5f6ed714610345578063190da5951461035b57600080fd5b806301ffc9a71461026f57806303ed0ee5146102a4578063051287bc146102e657806306f333f214610323575b600080fd5b34801561027b57600080fd5b5061028f61028a3660046122fc565b610804565b60405190151581526020015b60405180910390f35b3480156102b057600080fd5b506102d87f043c983c49d46f0e102151eaf8085d4a2e6571d5df2d47b013f39bddfd4a639d81565b60405190815260200161029b565b3480156102f257600080fd5b5061031661030136600461233e565b60056020526000908152604090205460ff1681565b60405161029b9190612386565b34801561032f57600080fd5b5061034361033e3660046123ec565b610860565b005b34801561035157600080fd5b506102d861271081565b34801561036757600080fd5b506102d862093a8081565b34801561037e57600080fd5b506102d861038d36600461233e565b60009081526020819052604090206001015490565b3480156103ae57600080fd5b506103436103bd366004612425565b610927565b3480156103ce57600080fd5b506103436103dd366004612425565b610952565b3480156103ee57600080fd5b506103436103fd366004612572565b61099e565b6103436104103660046125ef565b610bd7565b34801561042157600080fd5b506102d860025481565b34801561043757600080fd5b506102d87fdb9556138406326f00296e13ea2ad7db24ba82381212d816b1a40c23b466b32781565b34801561046b57600080fd5b5061034361047a366004612692565b610ee5565b34801561048b57600080fd5b506102d861070881565b3480156104a157600080fd5b5061028f6104b036600461233e565b60076020526000908152604090205460ff1681565b3480156104d157600080fd5b506103436104e03660046126cf565b6110bd565b6103436104f3366004612692565b6111f0565b34801561050457600080fd5b50610518610513366004612714565b611437565b6040516001600160a01b03909116815260200161029b565b34801561053c57600080fd5b5061058661054b36600461233e565b6006602052600090815260409020546bffffffffffffffffffffffff8116906c0100000000000000000000000090046001600160a01b031682565b604080516bffffffffffffffffffffffff90931683526001600160a01b0390911660208301520161029b565b3480156105be57600080fd5b5061028f6105cd366004612425565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b34801561060257600080fd5b506102d87fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc481565b34801561063657600080fd5b506102d8600081565b34801561064b57600080fd5b506102d87f000000000000000000000000000000000000000000000000000000000000000081565b34801561067f57600080fd5b5061028f61068e366004612425565b611456565b34801561069f57600080fd5b506106b36106ae366004612692565b611559565b60405161029b9190612736565b3480156106cc57600080fd5b506103436106db36600461233e565b6115cc565b3480156106ec57600080fd5b506102d860085481565b34801561070257600080fd5b5061034361071136600461233e565b611735565b34801561072257600080fd5b5061034361073136600461233e565b611817565b34801561074257600080fd5b506102d8620f424081565b34801561075957600080fd5b506102d861076836600461233e565b61187f565b34801561077957600080fd5b506102d87f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5581565b3480156107ad57600080fd5b506103436107bc366004612425565b611896565b3480156107cd57600080fd5b506102d86107dc36600461281c565b60036020526000908152604090205481565b3480156107fa57600080fd5b506102d860045481565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f5a05180f00000000000000000000000000000000000000000000000000000000148061085a575061085a826118bb565b92915050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5561088a81611952565b6001600160a01b038316600090815260036020526040812054908190036108b15750505050565b6001600160a01b0384166000818152600360205260408120556108d590848361195f565b604080516001600160a01b038087168252851660208201529081018290527f244e51bc38c1452fa8aaf487bcb4bca36c2baa3a5fbdb776b1eabd8dc6d277cd9060600160405180910390a1505b505050565b60008281526020819052604090206001015461094281611952565b61094c8383611a82565b50505050565b6001600160a01b0381163314610994576040517f6697b23200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6109228282611ab7565b7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc46109c881611952565b8251602084012060006109da85611559565b9050600260008381526005602052604090205460ff166004811115610a0157610a01612357565b14610a38576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000828152600660209081526040918290208251808401909352546bffffffffffffffffffffffff811683526c0100000000000000000000000090046001600160a01b03169082018190523314610abb576040517f4af43a9000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80516107089042036bffffffffffffffffffffffff1611610b08576040517f1992d0bd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000838152600560205260409020805460ff1916600317905561010082015115610b645761010082015160808301516001600160a01b031660009081526003602052604081208054909190610b5e908490612868565b90915550505b608082015160c0830151610b826001600160a01b038316888361195f565b604080516001600160a01b03848116825260208201849052891691339188917f582211c35a2139ac3bbaac74663c6a1f56c6cbb658b41fe11fd45a82074ac67891015b60405180910390a45050505050505050565b46816000015163ffffffff1603610c1a576040517f7029fdf900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60a08101511580610c2d575060c0810151155b15610c64576040517fe38820c800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60608101516001600160a01b03161580610c89575060808101516001600160a01b0316155b15610cc0576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610ccc61070842612868565b8161010001511015610d0a576040517f04b7fcc800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000610d1f3083606001518460a00151611ae4565b90506000806002541115610d4c57620f424060025483610d3f919061287b565b610d499190612892565b90505b610d5681836128cd565b915060006040518061018001604052804663ffffffff168152602001856000015163ffffffff16815260200185602001516001600160a01b0316815260200185604001516001600160a01b0316815260200185606001516001600160a01b0316815260200185608001516001600160a01b031681526020018481526020018560c0015181526020018381526020018560e0015115158152602001856101000151815260200160086000815480929190610e0e906128e0565b909155509052604051610e249190602001612736565b604080518083037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0018152828252805160208083019190912060008181526005835293909320805460ff191660011790558701518751606089015160808a015160c08b015160e08c015195985095966001600160a01b039094169587957f120ea0364f36cdac7983bcfdd55270ca09d7f9b314a2ebc425a3b01ab1d6403a95610ed6958b959094909390928e9261293c565b60405180910390a35050505050565b805160208201206000610ef783611559565b3360009081527fd2043bf65931af3dbecf60d0db8f40e4160406d7beb00522f4200cf4944a1eb8602052604090205490915060ff1615610f74578061014001514211610f6f576040517fe15ff9ea00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610fc0565b62093a80816101400151610f889190612868565b4211610fc0576040517fe15ff9ea00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600160008381526005602052604090205460ff166004811115610fe557610fe5612357565b1461101c576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600082815260056020526040808220805460ff19166004179055820151608083015161010084015160c0850151929391926110579190612868565b905061106d6001600160a01b038316848361195f565b604080516001600160a01b0384811682526020820184905285169187917fb4c55c0c9bc613519b920e88748090150b890a875d307f21bea7d4fb2e8bc958910160405180910390a3505050505050565b7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc46110e781611952565b82516020840120600160008281526005602052604090205460ff16600481111561111357611113612357565b1461114a576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008181526005602090815260408083208054600260ff19909116179055805180820182526bffffffffffffffffffffffff4281168252338285018181528787526006865295849020925195516001600160a01b03166c0100000000000000000000000002959091169490941790555185815283917f4ac8af8a2cd87193d64dfc7a3b8d9923b714ec528b18725d080aa1299be0c5e4910160405180910390a350505050565b7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc461121a81611952565b81516020830120600061122c84611559565b90504663ffffffff16816020015163ffffffff1614611277576040517f7029fdf900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8061014001514211156112b6576040517f559895a300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008281526007602052604090205460ff16156112ff576040517fbef7bb7d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000828152600760205260409020805460ff19166001179055606081015160a082015160e083015160045461012085015161134857506000611342848484611ae4565b506113b9565b7fffffffffffffffffffffffff11111111111111111111111111111111111111126001600160a01b0384160161138c5761134284846113878486612868565b611ae4565b611397848484611ae4565b506113b78473eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee83611ae4565b505b845160808087015160a08089015160c0808b015160e08c01516040805163ffffffff90991689526001600160a01b0396871660208a0152938616938801939093526060870152938501528301849052861691339189917ff8ae392d784b1ea5e8881bfa586d81abf07ef4f1e2fc75f7fe51c90f05199a5c9101610bc5565b600082815260016020526040812061144f9083611cb3565b9392505050565b6000600260008481526005602052604090205460ff16600481111561147d5761147d612357565b146114b4576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000838152600660209081526040918290208251808401909352546bffffffffffffffffffffffff811683526001600160a01b036c01000000000000000000000000909104811691830182905284161461153a576040517f4af43a9000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80516107089042036bffffffffffffffffffffffff1611949350505050565b604080516101808101825260008082526020808301829052928201819052606082018190526080820181905260a0820181905260c0820181905260e082018190526101008201819052610120820181905261014082018190526101608201528251909161085a91840181019084016129ed565b7f043c983c49d46f0e102151eaf8085d4a2e6571d5df2d47b013f39bddfd4a639d6115f681611952565b600260008381526005602052604090205460ff16600481111561161b5761161b612357565b14611652576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000828152600660209081526040918290208251808401909352546bffffffffffffffffffffffff8082168085526c010000000000000000000000009092046001600160a01b031693909201929092526107089142031611156116e1576040517f3e908aac00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000828152600560209081526040808320805460ff19166001179055600690915280822082905551339184917f0695cf1d39b3055dcd0fe02d8b47eaf0d5a13e1996de925de59d0ef9b7f7fad49190a35050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5561175f81611952565b6127108211156117d0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f6e657746656552617465203e206d61780000000000000000000000000000000060448201526064015b60405180910390fd5b600280549083905560408051828152602081018590527f14914da2bf76024616fbe1859783fcd4dbddcb179b1f3a854949fbf920dcb95791015b60405180910390a1505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5561184181611952565b600480549083905560408051828152602081018590527f5cf09b12f3f56b4c564d51b25b40360af6d795198adb61ae0806a36c294323fa910161180a565b600081815260016020526040812061085a90611cbf565b6000828152602081905260409020600101546118b181611952565b61094c8383611ab7565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061085a57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff0000000000000000000000000000000000000000000000000000000083161461085a565b61195c8133611cc9565b50565b306001600160a01b0383160361197457505050565b8060000361198157505050565b7fffffffffffffffffffffffff11111111111111111111111111111111111111126001600160a01b03841601611a6e576000826001600160a01b03168260405160006040518083038185875af1925050503d80600081146119fe576040519150601f19603f3d011682016040523d82523d6000602084013e611a03565b606091505b505090508061094c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f455448207472616e73666572206661696c65640000000000000000000000000060448201526064016117c7565b6109226001600160a01b0384168383611d39565b600080611a8f8484611dad565b9050801561144f576000848152600160205260409020611aaf9084611e57565b509392505050565b600080611ac48484611e6c565b9050801561144f576000848152600160205260409020611aaf9084611eef565b60006001600160a01b03831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14611c4d57611b1c836001600160a01b0316611f04565b6040517f70a082310000000000000000000000000000000000000000000000000000000081526001600160a01b0385811660048301528416906370a0823190602401602060405180830381865afa158015611b7b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b9f9190612ab9565b9050611bb66001600160a01b038416338685611faa565b6040517f70a082310000000000000000000000000000000000000000000000000000000081526001600160a01b0385811660048301528291908516906370a0823190602401602060405180830381865afa158015611c18573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c3c9190612ab9565b611c4691906128cd565b905061144f565b348214611c86576040517f81de0bf300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b0384163014611caa57611caa6001600160a01b038416858461195f565b50349392505050565b600061144f8383611fe3565b600061085a825490565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16611d35576040517fe2517d3f0000000000000000000000000000000000000000000000000000000081526001600160a01b0382166004820152602481018390526044016117c7565b5050565b6040516001600160a01b0383811660248301526044820183905261092291859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505061200d565b6000828152602081815260408083206001600160a01b038516845290915281205460ff16611e4f576000838152602081815260408083206001600160a01b03861684529091529020805460ff19166001179055611e073390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a450600161085a565b50600061085a565b600061144f836001600160a01b038416612089565b6000828152602081815260408083206001600160a01b038516845290915281205460ff1615611e4f576000838152602081815260408083206001600160a01b0386168085529252808320805460ff1916905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a450600161085a565b600061144f836001600160a01b0384166120d0565b7fffffffffffffffffffffffff11111111111111111111111111111111111111126001600160a01b03821601611f66576040517f7f523fe800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b806001600160a01b03163b60000361195c576040517f7f523fe800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040516001600160a01b03848116602483015283811660448301526064820183905261094c9186918216906323b872dd90608401611d66565b6000826000018281548110611ffa57611ffa612ad2565b9060005260206000200154905092915050565b60006120226001600160a01b038416836121c3565b905080516000141580156120475750808060200190518101906120459190612b01565b155b15610922576040517f5274afe70000000000000000000000000000000000000000000000000000000081526001600160a01b03841660048201526024016117c7565b6000818152600183016020526040812054611e4f5750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561085a565b600081815260018301602052604081205480156121b95760006120f46001836128cd565b8554909150600090612108906001906128cd565b905080821461216d57600086600001828154811061212857612128612ad2565b906000526020600020015490508087600001848154811061214b5761214b612ad2565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061217e5761217e612b1e565b60019003818190600052602060002001600090559055856001016000868152602001908152602001600020600090556001935050505061085a565b600091505061085a565b606061144f8383600084600080856001600160a01b031684866040516121e99190612b4d565b60006040518083038185875af1925050503d8060008114612226576040519150601f19603f3d011682016040523d82523d6000602084013e61222b565b606091505b509150915061223b868383612245565b9695505050505050565b60608261225a57612255826122ba565b61144f565b815115801561227157506001600160a01b0384163b155b156122b3576040517f9996b3150000000000000000000000000000000000000000000000000000000081526001600160a01b03851660048201526024016117c7565b508061144f565b8051156122ca5780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006020828403121561230e57600080fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811461144f57600080fd5b60006020828403121561235057600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b60208101600583106123c1577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b91905290565b6001600160a01b038116811461195c57600080fd5b80356123e7816123c7565b919050565b600080604083850312156123ff57600080fd5b823561240a816123c7565b9150602083013561241a816123c7565b809150509250929050565b6000806040838503121561243857600080fd5b82359150602083013561241a816123c7565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051610120810167ffffffffffffffff8111828210171561249d5761249d61244a565b60405290565b604051610180810167ffffffffffffffff8111828210171561249d5761249d61244a565b600082601f8301126124d857600080fd5b813567ffffffffffffffff808211156124f3576124f361244a565b604051601f83017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f011681019082821181831017156125395761253961244a565b8160405283815286602085880101111561255257600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000806040838503121561258557600080fd5b823567ffffffffffffffff81111561259c57600080fd5b6125a8858286016124c7565b925050602083013561241a816123c7565b63ffffffff8116811461195c57600080fd5b80356123e7816125b9565b801515811461195c57600080fd5b80356123e7816125d6565b6000610120828403121561260257600080fd5b61260a612479565b612613836125cb565b8152612621602084016123dc565b6020820152612632604084016123dc565b6040820152612643606084016123dc565b6060820152612654608084016123dc565b608082015260a083013560a082015260c083013560c082015261267960e084016125e4565b60e0820152610100928301359281019290925250919050565b6000602082840312156126a457600080fd5b813567ffffffffffffffff8111156126bb57600080fd5b6126c7848285016124c7565b949350505050565b600080604083850312156126e257600080fd5b823567ffffffffffffffff8111156126f957600080fd5b612705858286016124c7565b95602094909401359450505050565b6000806040838503121561272757600080fd5b50508035926020909101359150565b815163ffffffff1681526101808101602083015161275c602084018263ffffffff169052565b50604083015161277760408401826001600160a01b03169052565b50606083015161279260608401826001600160a01b03169052565b5060808301516127ad60808401826001600160a01b03169052565b5060a08301516127c860a08401826001600160a01b03169052565b5060c083015160c083015260e083015160e0830152610100808401518184015250610120808401516127fd8285018215159052565b5050610140838101519083015261016092830151929091019190915290565b60006020828403121561282e57600080fd5b813561144f816123c7565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8082018082111561085a5761085a612839565b808202811582820484141761085a5761085a612839565b6000826128c8577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b8181038181111561085a5761085a612839565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361291157612911612839565b5060010190565b60005b8381101561293357818101518382015260200161291b565b50506000910152565b60e08152600088518060e084015261010061295d8282860160208e01612918565b63ffffffff9990991660208401526001600160a01b039788166040840152959096166060820152608081019390935260a0830191909152151560c0820152601f9091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0160190910192915050565b80516123e7816125b9565b80516123e7816123c7565b80516123e7816125d6565b60006101808284031215612a0057600080fd5b612a086124a3565b612a11836129cc565b8152612a1f602084016129cc565b6020820152612a30604084016129d7565b6040820152612a41606084016129d7565b6060820152612a52608084016129d7565b6080820152612a6360a084016129d7565b60a082015260c083015160c082015260e083015160e0820152610100808401518183015250610120612a968185016129e2565b908201526101408381015190820152610160928301519281019290925250919050565b600060208284031215612acb57600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600060208284031215612b1357600080fd5b815161144f816125d6565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b60008251612b5f818460208701612918565b919091019291505056fea2646970667358221220e9dd17881b30b52cd3cbfc5932ec6ff3c3a01111638264cfdff6ef34d478bd7764736f6c63430008140033", } // FastBridgeABI is the input ABI used to generate the binding from. @@ -11876,7 +11876,7 @@ func (_IFastBridge *IFastBridgeFilterer) ParseBridgeRequested(log types.Log) (*I // 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: "0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220c6ed48084fea72d6c821edce7a5b7849414ac26c2e14da8d9184448698b54a2964736f6c63430008140033", + Bin: "0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220666e86cec9574f32fc5a03b62558b15e14d370d438ddcd50d491395202b88bd664736f6c63430008140033", } // SafeERC20ABI is the input ABI used to generate the binding from. @@ -12049,7 +12049,7 @@ func (_SafeERC20 *SafeERC20TransactorRaw) Transact(opts *bind.TransactOpts, meth // UniversalTokenLibMetaData contains all meta data concerning the UniversalTokenLib contract. var UniversalTokenLibMetaData = &bind.MetaData{ ABI: "[]", - Bin: "0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea264697066735822122054dc3657c8fde761d2c05cf2a9b92991c4c740565f4124cc2177c16ea935345764736f6c63430008140033", + Bin: "0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220e4e2d25d1ecf953d0c56b6c7466118f3a795674cafbd14e67cc1d0633ea190a764736f6c63430008140033", } // UniversalTokenLibABI is the input ABI used to generate the binding from. diff --git a/services/rfq/contracts/fastbridge/fastbridge.contractinfo.json b/services/rfq/contracts/fastbridge/fastbridge.contractinfo.json index 740c11b54c..09ad87a951 100644 --- a/services/rfq/contracts/fastbridge/fastbridge.contractinfo.json +++ b/services/rfq/contracts/fastbridge/fastbridge.contractinfo.json @@ -1 +1 @@ -{"solidity/FastBridge.sol:AccessControl":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.20 ^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 pure 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/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// lib/openzeppelin-contracts/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 ERC-165 detection.\n */\ninterface IAccessControl {\n /**\n * @dev The `account` is missing a role.\n */\n error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);\n\n /**\n * @dev The caller of a function is not the expected one.\n *\n * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.\n */\n error AccessControlBadConfirmation();\n\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted 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// lib/openzeppelin-contracts/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 ERC-20 standard as defined in the ERC.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the value of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the value of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 value) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n * caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 value) external returns (bool);\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\n * allowance mechanism. `value` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n\n// lib/openzeppelin-contracts/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 ERC-20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[ERC-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC-20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n *\n * ==== Security Considerations\n *\n * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\n * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\n * considered as an intention to spend the allowance in any specific way. The second is that because permits have\n * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\n * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\n * generally recommended is:\n *\n * ```solidity\n * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\n * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\n * doThing(..., value);\n * }\n *\n * function doThing(..., uint256 value) public {\n * token.safeTransferFrom(msg.sender, address(this), value);\n * ...\n * }\n * ```\n *\n * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\n * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\n * {SafeERC20-safeTransferFrom}).\n *\n * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\n * contracts should have entry points that don't rely on permit.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also 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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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 ERC-165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[ERC].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n\n// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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 ERC-165 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// lib/openzeppelin-contracts/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 ERC-165 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// lib/openzeppelin-contracts/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 ERC-20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n /**\n * @dev An operation with an ERC-20 token failed.\n */\n error SafeERC20FailedOperation(address token);\n\n /**\n * @dev Indicates a failed `decreaseAllowance` request.\n */\n error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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/FastBridge.sol\n\ncontract FastBridge is IFastBridge, Admin {\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 enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeStatus) public bridgeStatuses;\n /// @notice Proof of relayed bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeProof) public bridgeProofs;\n /// @notice Whether bridge has been relayed on destination chain\n mapping(bytes32 =\u003e bool) public bridgeRelays;\n\n /// @dev to prevent replays\n uint256 public nonce;\n // @dev 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 /// @notice Pulls a requested token from the user to the requested recipient.\n /// @dev Be careful of re-entrancy issues when msg.value \u003e 0 and recipient != address(this)\n function _pullToken(address recipient, address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token != UniversalTokenLib.ETH_ADDRESS) {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(recipient);\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, recipient, amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(recipient) - amountPulled;\n } else {\n // Otherwise, we need to check that ETH amount matches msg.value\n if (amount != msg.value) revert MsgValueIncorrect();\n // Transfer value to recipient if not this address\n if (recipient != address(this)) token.universalTransfer(recipient, amount);\n // We will forward msg.value in the external call later, if recipient is not this contract\n amountPulled = msg.value;\n }\n }\n\n /// @inheritdoc IFastBridge\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n // check bridge params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\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\n // transfer tokens to bridge contract\n // @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(address(this), 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 BridgeTransaction({\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 sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n\n // check haven't exceeded deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n\n // mark bridge transaction as relayed\n if (bridgeRelays[transactionId]) revert TransactionRelayed();\n bridgeRelays[transactionId] = true;\n\n // transfer tokens to recipient on destination chain and gas rebate if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n uint256 rebate = chainGasAmount;\n if (!transaction.sendChainGas) {\n // forward erc20\n rebate = 0;\n _pullToken(to, token, amount);\n } else if (token == UniversalTokenLib.ETH_ADDRESS) {\n // lump in gas rebate into amount in native gas token\n _pullToken(to, token, amount + rebate);\n } else {\n // forward erc20 then forward gas rebate in native gas token\n _pullToken(to, token, amount);\n _pullToken(to, UniversalTokenLib.ETH_ADDRESS, rebate);\n }\n\n emit BridgeRelayed(\n transactionId,\n msg.sender,\n to,\n transaction.originChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n rebate\n );\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n // update bridge tx status given proof provided\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = BridgeStatus.RELAYER_PROVED;\n bridgeProofs[transactionId] = BridgeProof({timestamp: uint96(block.timestamp), relayer: msg.sender}); // overflow ok\n\n emit BridgeProofProvided(transactionId, msg.sender, destTxHash);\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint96(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint96).max but\n /// proof.timestamp \u003c type(uint96).max via unchecked statement\n /// @param proof The bridge proof\n /// @return delta Time delta since proof submitted\n function _timeSince(BridgeProof memory proof) internal view returns (uint256 delta) {\n unchecked {\n delta = uint96(block.timestamp) - proof.timestamp;\n }\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != relayer) revert SenderIncorrect();\n return _timeSince(proof) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != msg.sender) revert SenderIncorrect();\n if (_timeSince(proof) \u003c= DISPUTE_PERIOD) revert DisputePeriodNotPassed();\n\n bridgeStatuses[transactionId] = 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, msg.sender, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeProofs[transactionId]) \u003e DISPUTE_PERIOD) revert DisputePeriodPassed();\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n delete bridgeProofs[transactionId];\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 BridgeTransaction memory transaction = getBridgeTransaction(request);\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 // set status to refunded if still in requested state\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = 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","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","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.20+commit.a1b79de6\"},\"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/FastBridge.sol\":\"AccessControl\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridge.sol\":{\"keccak256\":\"0x7da00701c906b2b78d838eb9c510ab5903b6dd7f8e5fb12d4c4710c350e3c919\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://faff50fb8d1f3cf10122c1b611d0987ca58f4099d90c17163816c90d3077bce7\",\"dweb:/ipfs/QmWKF2L9D18J9QXiMbm6ucj3x8ebjQtTrycnkNmB4q3JRo\"]}},\"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/FastBridge.sol:AccessControlEnumerable":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.20 ^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 pure 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/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// lib/openzeppelin-contracts/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 ERC-165 detection.\n */\ninterface IAccessControl {\n /**\n * @dev The `account` is missing a role.\n */\n error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);\n\n /**\n * @dev The caller of a function is not the expected one.\n *\n * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.\n */\n error AccessControlBadConfirmation();\n\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted 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// lib/openzeppelin-contracts/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 ERC-20 standard as defined in the ERC.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the value of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the value of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 value) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n * caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 value) external returns (bool);\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\n * allowance mechanism. `value` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n\n// lib/openzeppelin-contracts/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 ERC-20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[ERC-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC-20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n *\n * ==== Security Considerations\n *\n * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\n * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\n * considered as an intention to spend the allowance in any specific way. The second is that because permits have\n * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\n * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\n * generally recommended is:\n *\n * ```solidity\n * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\n * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\n * doThing(..., value);\n * }\n *\n * function doThing(..., uint256 value) public {\n * token.safeTransferFrom(msg.sender, address(this), value);\n * ...\n * }\n * ```\n *\n * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\n * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\n * {SafeERC20-safeTransferFrom}).\n *\n * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\n * contracts should have entry points that don't rely on permit.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also 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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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 ERC-165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[ERC].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n\n// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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 ERC-165 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// lib/openzeppelin-contracts/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 ERC-165 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// lib/openzeppelin-contracts/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 ERC-20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n /**\n * @dev An operation with an ERC-20 token failed.\n */\n error SafeERC20FailedOperation(address token);\n\n /**\n * @dev Indicates a failed `decreaseAllowance` request.\n */\n error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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/FastBridge.sol\n\ncontract FastBridge is IFastBridge, Admin {\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 enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeStatus) public bridgeStatuses;\n /// @notice Proof of relayed bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeProof) public bridgeProofs;\n /// @notice Whether bridge has been relayed on destination chain\n mapping(bytes32 =\u003e bool) public bridgeRelays;\n\n /// @dev to prevent replays\n uint256 public nonce;\n // @dev 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 /// @notice Pulls a requested token from the user to the requested recipient.\n /// @dev Be careful of re-entrancy issues when msg.value \u003e 0 and recipient != address(this)\n function _pullToken(address recipient, address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token != UniversalTokenLib.ETH_ADDRESS) {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(recipient);\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, recipient, amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(recipient) - amountPulled;\n } else {\n // Otherwise, we need to check that ETH amount matches msg.value\n if (amount != msg.value) revert MsgValueIncorrect();\n // Transfer value to recipient if not this address\n if (recipient != address(this)) token.universalTransfer(recipient, amount);\n // We will forward msg.value in the external call later, if recipient is not this contract\n amountPulled = msg.value;\n }\n }\n\n /// @inheritdoc IFastBridge\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n // check bridge params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\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\n // transfer tokens to bridge contract\n // @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(address(this), 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 BridgeTransaction({\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 sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n\n // check haven't exceeded deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n\n // mark bridge transaction as relayed\n if (bridgeRelays[transactionId]) revert TransactionRelayed();\n bridgeRelays[transactionId] = true;\n\n // transfer tokens to recipient on destination chain and gas rebate if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n uint256 rebate = chainGasAmount;\n if (!transaction.sendChainGas) {\n // forward erc20\n rebate = 0;\n _pullToken(to, token, amount);\n } else if (token == UniversalTokenLib.ETH_ADDRESS) {\n // lump in gas rebate into amount in native gas token\n _pullToken(to, token, amount + rebate);\n } else {\n // forward erc20 then forward gas rebate in native gas token\n _pullToken(to, token, amount);\n _pullToken(to, UniversalTokenLib.ETH_ADDRESS, rebate);\n }\n\n emit BridgeRelayed(\n transactionId,\n msg.sender,\n to,\n transaction.originChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n rebate\n );\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n // update bridge tx status given proof provided\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = BridgeStatus.RELAYER_PROVED;\n bridgeProofs[transactionId] = BridgeProof({timestamp: uint96(block.timestamp), relayer: msg.sender}); // overflow ok\n\n emit BridgeProofProvided(transactionId, msg.sender, destTxHash);\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint96(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint96).max but\n /// proof.timestamp \u003c type(uint96).max via unchecked statement\n /// @param proof The bridge proof\n /// @return delta Time delta since proof submitted\n function _timeSince(BridgeProof memory proof) internal view returns (uint256 delta) {\n unchecked {\n delta = uint96(block.timestamp) - proof.timestamp;\n }\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != relayer) revert SenderIncorrect();\n return _timeSince(proof) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != msg.sender) revert SenderIncorrect();\n if (_timeSince(proof) \u003c= DISPUTE_PERIOD) revert DisputePeriodNotPassed();\n\n bridgeStatuses[transactionId] = 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, msg.sender, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeProofs[transactionId]) \u003e DISPUTE_PERIOD) revert DisputePeriodPassed();\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n delete bridgeProofs[transactionId];\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 BridgeTransaction memory transaction = getBridgeTransaction(request);\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 // set status to refunded if still in requested state\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = 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","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","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.20+commit.a1b79de6\"},\"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/FastBridge.sol\":\"AccessControlEnumerable\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridge.sol\":{\"keccak256\":\"0x7da00701c906b2b78d838eb9c510ab5903b6dd7f8e5fb12d4c4710c350e3c919\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://faff50fb8d1f3cf10122c1b611d0987ca58f4099d90c17163816c90d3077bce7\",\"dweb:/ipfs/QmWKF2L9D18J9QXiMbm6ucj3x8ebjQtTrycnkNmB4q3JRo\"]}},\"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/FastBridge.sol:Address":{"code":"0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220484b80cd78ad146ed37d87f73b71fece9b7aef1b9090eddf52e592358acac67e64736f6c63430008140033","runtime-code":"0x73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220484b80cd78ad146ed37d87f73b71fece9b7aef1b9090eddf52e592358acac67e64736f6c63430008140033","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.20 ^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 pure 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/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// lib/openzeppelin-contracts/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 ERC-165 detection.\n */\ninterface IAccessControl {\n /**\n * @dev The `account` is missing a role.\n */\n error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);\n\n /**\n * @dev The caller of a function is not the expected one.\n *\n * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.\n */\n error AccessControlBadConfirmation();\n\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted 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// lib/openzeppelin-contracts/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 ERC-20 standard as defined in the ERC.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the value of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the value of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 value) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n * caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 value) external returns (bool);\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\n * allowance mechanism. `value` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n\n// lib/openzeppelin-contracts/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 ERC-20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[ERC-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC-20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n *\n * ==== Security Considerations\n *\n * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\n * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\n * considered as an intention to spend the allowance in any specific way. The second is that because permits have\n * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\n * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\n * generally recommended is:\n *\n * ```solidity\n * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\n * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\n * doThing(..., value);\n * }\n *\n * function doThing(..., uint256 value) public {\n * token.safeTransferFrom(msg.sender, address(this), value);\n * ...\n * }\n * ```\n *\n * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\n * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\n * {SafeERC20-safeTransferFrom}).\n *\n * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\n * contracts should have entry points that don't rely on permit.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also 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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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 ERC-165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[ERC].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n\n// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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 ERC-165 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// lib/openzeppelin-contracts/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 ERC-165 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// lib/openzeppelin-contracts/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 ERC-20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n /**\n * @dev An operation with an ERC-20 token failed.\n */\n error SafeERC20FailedOperation(address token);\n\n /**\n * @dev Indicates a failed `decreaseAllowance` request.\n */\n error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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/FastBridge.sol\n\ncontract FastBridge is IFastBridge, Admin {\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 enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeStatus) public bridgeStatuses;\n /// @notice Proof of relayed bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeProof) public bridgeProofs;\n /// @notice Whether bridge has been relayed on destination chain\n mapping(bytes32 =\u003e bool) public bridgeRelays;\n\n /// @dev to prevent replays\n uint256 public nonce;\n // @dev 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 /// @notice Pulls a requested token from the user to the requested recipient.\n /// @dev Be careful of re-entrancy issues when msg.value \u003e 0 and recipient != address(this)\n function _pullToken(address recipient, address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token != UniversalTokenLib.ETH_ADDRESS) {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(recipient);\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, recipient, amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(recipient) - amountPulled;\n } else {\n // Otherwise, we need to check that ETH amount matches msg.value\n if (amount != msg.value) revert MsgValueIncorrect();\n // Transfer value to recipient if not this address\n if (recipient != address(this)) token.universalTransfer(recipient, amount);\n // We will forward msg.value in the external call later, if recipient is not this contract\n amountPulled = msg.value;\n }\n }\n\n /// @inheritdoc IFastBridge\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n // check bridge params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\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\n // transfer tokens to bridge contract\n // @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(address(this), 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 BridgeTransaction({\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 sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n\n // check haven't exceeded deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n\n // mark bridge transaction as relayed\n if (bridgeRelays[transactionId]) revert TransactionRelayed();\n bridgeRelays[transactionId] = true;\n\n // transfer tokens to recipient on destination chain and gas rebate if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n uint256 rebate = chainGasAmount;\n if (!transaction.sendChainGas) {\n // forward erc20\n rebate = 0;\n _pullToken(to, token, amount);\n } else if (token == UniversalTokenLib.ETH_ADDRESS) {\n // lump in gas rebate into amount in native gas token\n _pullToken(to, token, amount + rebate);\n } else {\n // forward erc20 then forward gas rebate in native gas token\n _pullToken(to, token, amount);\n _pullToken(to, UniversalTokenLib.ETH_ADDRESS, rebate);\n }\n\n emit BridgeRelayed(\n transactionId,\n msg.sender,\n to,\n transaction.originChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n rebate\n );\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n // update bridge tx status given proof provided\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = BridgeStatus.RELAYER_PROVED;\n bridgeProofs[transactionId] = BridgeProof({timestamp: uint96(block.timestamp), relayer: msg.sender}); // overflow ok\n\n emit BridgeProofProvided(transactionId, msg.sender, destTxHash);\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint96(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint96).max but\n /// proof.timestamp \u003c type(uint96).max via unchecked statement\n /// @param proof The bridge proof\n /// @return delta Time delta since proof submitted\n function _timeSince(BridgeProof memory proof) internal view returns (uint256 delta) {\n unchecked {\n delta = uint96(block.timestamp) - proof.timestamp;\n }\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != relayer) revert SenderIncorrect();\n return _timeSince(proof) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != msg.sender) revert SenderIncorrect();\n if (_timeSince(proof) \u003c= DISPUTE_PERIOD) revert DisputePeriodNotPassed();\n\n bridgeStatuses[transactionId] = 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, msg.sender, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeProofs[transactionId]) \u003e DISPUTE_PERIOD) revert DisputePeriodPassed();\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n delete bridgeProofs[transactionId];\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 BridgeTransaction memory transaction = getBridgeTransaction(request);\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 // set status to refunded if still in requested state\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = 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","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","compilerOptions":"--combined-json bin,bin-runtime,srcmap,srcmap-runtime,abi,userdoc,devdoc,metadata,hashes --optimize --optimize-runs 10000 --allow-paths ., ./, ../ --evm-version=istanbul","srcMap":"15602:6066:0:-:0;;;;;;;;;;;;;;;-1:-1:-1;;;15602:6066:0;;;;;;;;;;;;;;;;;","srcMapRuntime":"15602: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.20+commit.a1b79de6\"},\"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/FastBridge.sol\":\"Address\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridge.sol\":{\"keccak256\":\"0x7da00701c906b2b78d838eb9c510ab5903b6dd7f8e5fb12d4c4710c350e3c919\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://faff50fb8d1f3cf10122c1b611d0987ca58f4099d90c17163816c90d3077bce7\",\"dweb:/ipfs/QmWKF2L9D18J9QXiMbm6ucj3x8ebjQtTrycnkNmB4q3JRo\"]}},\"version\":1}"},"hashes":{}},"solidity/FastBridge.sol:Admin":{"code":"0x60806040523480156200001157600080fd5b50604051620014123803806200141283398101604081905262000034916200018e565b6200004160008262000049565b5050620001b9565b60008062000058848462000086565b905080156200007d5760008481526001602052604090206200007b908462000134565b505b90505b92915050565b6000828152602081815260408083206001600160a01b038516845290915281205460ff166200012b576000838152602081815260408083206001600160a01b03861684529091529020805460ff19166001179055620000e23390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a450600162000080565b50600062000080565b60006200007d836001600160a01b03841660008181526001830160205260408120546200012b5750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915562000080565b600060208284031215620001a157600080fd5b81516001600160a01b03811681146200007d57600080fd5b61124980620001c96000396000f3fe608060405234801561001057600080fd5b50600436106101775760003560e01c806391d14854116100d8578063bf333f2c1161008c578063d547741f11610066578063d547741f14610385578063dcf844a714610398578063e00a83e0146103b857600080fd5b8063bf333f2c14610341578063ca15c8731461034b578063ccc574901461035e57600080fd5b8063a217fddf116100bd578063a217fddf14610313578063b13aa2d61461031b578063b250fe6b1461032e57600080fd5b806391d14854146102a8578063926d7d7f146102ec57600080fd5b80632f2ff15d1161012f57806358f858801161011457806358f85880146102405780635960ccf2146102495780639010d07c1461027057600080fd5b80632f2ff15d1461021a57806336568abe1461022d57600080fd5b806306f333f21161016057806306f333f2146101d95780630f5f6ed7146101ee578063248a9ca3146101f757600080fd5b806301ffc9a71461017c57806303ed0ee5146101a4575b600080fd5b61018f61018a366004611013565b6103c1565b60405190151581526020015b60405180910390f35b6101cb7f043c983c49d46f0e102151eaf8085d4a2e6571d5df2d47b013f39bddfd4a639d81565b60405190815260200161019b565b6101ec6101e736600461107e565b61041d565b005b6101cb61271081565b6101cb6102053660046110b1565b60009081526020819052604090206001015490565b6101ec6102283660046110ca565b61050b565b6101ec61023b3660046110ca565b610536565b6101cb60025481565b6101cb7fdb9556138406326f00296e13ea2ad7db24ba82381212d816b1a40c23b466b32781565b61028361027e3660046110ed565b61058f565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161019b565b61018f6102b63660046110ca565b60009182526020828152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b6101cb7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc481565b6101cb600081565b6101ec6103293660046110b1565b6105ae565b6101ec61033c3660046110b1565b610690565b6101cb620f424081565b6101cb6103593660046110b1565b6106f8565b6101cb7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5581565b6101ec6103933660046110ca565b61070f565b6101cb6103a636600461110f565b60036020526000908152604090205481565b6101cb60045481565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f5a05180f000000000000000000000000000000000000000000000000000000001480610417575061041782610734565b92915050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f55610447816107cb565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600360205260408120549081900361047b5750505050565b73ffffffffffffffffffffffffffffffffffffffff84166000818152600360205260408120556104ac9084836107d8565b6040805173ffffffffffffffffffffffffffffffffffffffff8087168252851660208201529081018290527f244e51bc38c1452fa8aaf487bcb4bca36c2baa3a5fbdb776b1eabd8dc6d277cd9060600160405180910390a1505b505050565b600082815260208190526040902060010154610526816107cb565b610530838361092f565b50505050565b73ffffffffffffffffffffffffffffffffffffffff81163314610585576040517f6697b23200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6105068282610964565b60008281526001602052604081206105a79083610991565b9392505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f556105d8816107cb565b612710821115610649576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f6e657746656552617465203e206d61780000000000000000000000000000000060448201526064015b60405180910390fd5b600280549083905560408051828152602081018590527f14914da2bf76024616fbe1859783fcd4dbddcb179b1f3a854949fbf920dcb95791015b60405180910390a1505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f556106ba816107cb565b600480549083905560408051828152602081018590527f5cf09b12f3f56b4c564d51b25b40360af6d795198adb61ae0806a36c294323fa9101610683565b60008181526001602052604081206104179061099d565b60008281526020819052604090206001015461072a816107cb565b6105308383610964565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061041757507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614610417565b6107d581336109a7565b50565b3073ffffffffffffffffffffffffffffffffffffffff8316036107fa57505050565b8060000361080757505050565b7fffffffffffffffffffffffff111111111111111111111111111111111111111273ffffffffffffffffffffffffffffffffffffffff84160161090e5760008273ffffffffffffffffffffffffffffffffffffffff168260405160006040518083038185875af1925050503d806000811461089e576040519150601f19603f3d011682016040523d82523d6000602084013e6108a3565b606091505b5050905080610530576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f455448207472616e73666572206661696c6564000000000000000000000000006044820152606401610640565b61050673ffffffffffffffffffffffffffffffffffffffff84168383610a31565b60008061093c8484610abe565b905080156105a757600084815260016020526040902061095c9084610bba565b509392505050565b6000806109718484610bdc565b905080156105a757600084815260016020526040902061095c9084610c97565b60006105a78383610cb9565b6000610417825490565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16610a2d576040517fe2517d3f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8216600482015260248101839052604401610640565b5050565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000179052610506908490610ce3565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915281205460ff16610bb25760008381526020818152604080832073ffffffffffffffffffffffffffffffffffffffff86168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055610b503390565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a4506001610417565b506000610417565b60006105a78373ffffffffffffffffffffffffffffffffffffffff8416610d79565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915281205460ff1615610bb25760008381526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8616808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a4506001610417565b60006105a78373ffffffffffffffffffffffffffffffffffffffff8416610dc0565b6000826000018281548110610cd057610cd061112a565b9060005260206000200154905092915050565b6000610d0573ffffffffffffffffffffffffffffffffffffffff841683610eb3565b90508051600014158015610d2a575080806020019051810190610d289190611159565b155b15610506576040517f5274afe700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84166004820152602401610640565b6000818152600183016020526040812054610bb257508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610417565b60008181526001830160205260408120548015610ea9576000610de460018361117b565b8554909150600090610df89060019061117b565b9050808214610e5d576000866000018281548110610e1857610e1861112a565b9060005260206000200154905080876000018481548110610e3b57610e3b61112a565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080610e6e57610e6e6111b5565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610417565b6000915050610417565b60606105a783836000846000808573ffffffffffffffffffffffffffffffffffffffff168486604051610ee691906111e4565b60006040518083038185875af1925050503d8060008114610f23576040519150601f19603f3d011682016040523d82523d6000602084013e610f28565b606091505b5091509150610f38868383610f42565b9695505050505050565b606082610f5757610f5282610fd1565b6105a7565b8151158015610f7b575073ffffffffffffffffffffffffffffffffffffffff84163b155b15610fca576040517f9996b31500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85166004820152602401610640565b50806105a7565b805115610fe15780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006020828403121561102557600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146105a757600080fd5b803573ffffffffffffffffffffffffffffffffffffffff8116811461107957600080fd5b919050565b6000806040838503121561109157600080fd5b61109a83611055565b91506110a860208401611055565b90509250929050565b6000602082840312156110c357600080fd5b5035919050565b600080604083850312156110dd57600080fd5b823591506110a860208401611055565b6000806040838503121561110057600080fd5b50508035926020909101359150565b60006020828403121561112157600080fd5b6105a782611055565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006020828403121561116b57600080fd5b815180151581146105a757600080fd5b81810381811115610417577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b6000825160005b8181101561120557602081860181015185830152016111eb565b50600092019182525091905056fea2646970667358221220ae622a2da80c730eb06fbc09f0feabbb824bbdb349894cba40b3bf6d93d73db164736f6c63430008140033","runtime-code":"0x608060405234801561001057600080fd5b50600436106101775760003560e01c806391d14854116100d8578063bf333f2c1161008c578063d547741f11610066578063d547741f14610385578063dcf844a714610398578063e00a83e0146103b857600080fd5b8063bf333f2c14610341578063ca15c8731461034b578063ccc574901461035e57600080fd5b8063a217fddf116100bd578063a217fddf14610313578063b13aa2d61461031b578063b250fe6b1461032e57600080fd5b806391d14854146102a8578063926d7d7f146102ec57600080fd5b80632f2ff15d1161012f57806358f858801161011457806358f85880146102405780635960ccf2146102495780639010d07c1461027057600080fd5b80632f2ff15d1461021a57806336568abe1461022d57600080fd5b806306f333f21161016057806306f333f2146101d95780630f5f6ed7146101ee578063248a9ca3146101f757600080fd5b806301ffc9a71461017c57806303ed0ee5146101a4575b600080fd5b61018f61018a366004611013565b6103c1565b60405190151581526020015b60405180910390f35b6101cb7f043c983c49d46f0e102151eaf8085d4a2e6571d5df2d47b013f39bddfd4a639d81565b60405190815260200161019b565b6101ec6101e736600461107e565b61041d565b005b6101cb61271081565b6101cb6102053660046110b1565b60009081526020819052604090206001015490565b6101ec6102283660046110ca565b61050b565b6101ec61023b3660046110ca565b610536565b6101cb60025481565b6101cb7fdb9556138406326f00296e13ea2ad7db24ba82381212d816b1a40c23b466b32781565b61028361027e3660046110ed565b61058f565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161019b565b61018f6102b63660046110ca565b60009182526020828152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b6101cb7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc481565b6101cb600081565b6101ec6103293660046110b1565b6105ae565b6101ec61033c3660046110b1565b610690565b6101cb620f424081565b6101cb6103593660046110b1565b6106f8565b6101cb7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5581565b6101ec6103933660046110ca565b61070f565b6101cb6103a636600461110f565b60036020526000908152604090205481565b6101cb60045481565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f5a05180f000000000000000000000000000000000000000000000000000000001480610417575061041782610734565b92915050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f55610447816107cb565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600360205260408120549081900361047b5750505050565b73ffffffffffffffffffffffffffffffffffffffff84166000818152600360205260408120556104ac9084836107d8565b6040805173ffffffffffffffffffffffffffffffffffffffff8087168252851660208201529081018290527f244e51bc38c1452fa8aaf487bcb4bca36c2baa3a5fbdb776b1eabd8dc6d277cd9060600160405180910390a1505b505050565b600082815260208190526040902060010154610526816107cb565b610530838361092f565b50505050565b73ffffffffffffffffffffffffffffffffffffffff81163314610585576040517f6697b23200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6105068282610964565b60008281526001602052604081206105a79083610991565b9392505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f556105d8816107cb565b612710821115610649576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f6e657746656552617465203e206d61780000000000000000000000000000000060448201526064015b60405180910390fd5b600280549083905560408051828152602081018590527f14914da2bf76024616fbe1859783fcd4dbddcb179b1f3a854949fbf920dcb95791015b60405180910390a1505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f556106ba816107cb565b600480549083905560408051828152602081018590527f5cf09b12f3f56b4c564d51b25b40360af6d795198adb61ae0806a36c294323fa9101610683565b60008181526001602052604081206104179061099d565b60008281526020819052604090206001015461072a816107cb565b6105308383610964565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061041757507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614610417565b6107d581336109a7565b50565b3073ffffffffffffffffffffffffffffffffffffffff8316036107fa57505050565b8060000361080757505050565b7fffffffffffffffffffffffff111111111111111111111111111111111111111273ffffffffffffffffffffffffffffffffffffffff84160161090e5760008273ffffffffffffffffffffffffffffffffffffffff168260405160006040518083038185875af1925050503d806000811461089e576040519150601f19603f3d011682016040523d82523d6000602084013e6108a3565b606091505b5050905080610530576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f455448207472616e73666572206661696c6564000000000000000000000000006044820152606401610640565b61050673ffffffffffffffffffffffffffffffffffffffff84168383610a31565b60008061093c8484610abe565b905080156105a757600084815260016020526040902061095c9084610bba565b509392505050565b6000806109718484610bdc565b905080156105a757600084815260016020526040902061095c9084610c97565b60006105a78383610cb9565b6000610417825490565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16610a2d576040517fe2517d3f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8216600482015260248101839052604401610640565b5050565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000179052610506908490610ce3565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915281205460ff16610bb25760008381526020818152604080832073ffffffffffffffffffffffffffffffffffffffff86168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055610b503390565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a4506001610417565b506000610417565b60006105a78373ffffffffffffffffffffffffffffffffffffffff8416610d79565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915281205460ff1615610bb25760008381526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8616808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a4506001610417565b60006105a78373ffffffffffffffffffffffffffffffffffffffff8416610dc0565b6000826000018281548110610cd057610cd061112a565b9060005260206000200154905092915050565b6000610d0573ffffffffffffffffffffffffffffffffffffffff841683610eb3565b90508051600014158015610d2a575080806020019051810190610d289190611159565b155b15610506576040517f5274afe700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84166004820152602401610640565b6000818152600183016020526040812054610bb257508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610417565b60008181526001830160205260408120548015610ea9576000610de460018361117b565b8554909150600090610df89060019061117b565b9050808214610e5d576000866000018281548110610e1857610e1861112a565b9060005260206000200154905080876000018481548110610e3b57610e3b61112a565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080610e6e57610e6e6111b5565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610417565b6000915050610417565b60606105a783836000846000808573ffffffffffffffffffffffffffffffffffffffff168486604051610ee691906111e4565b60006040518083038185875af1925050503d8060008114610f23576040519150601f19603f3d011682016040523d82523d6000602084013e610f28565b606091505b5091509150610f38868383610f42565b9695505050505050565b606082610f5757610f5282610fd1565b6105a7565b8151158015610f7b575073ffffffffffffffffffffffffffffffffffffffff84163b155b15610fca576040517f9996b31500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85166004820152602401610640565b50806105a7565b805115610fe15780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006020828403121561102557600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146105a757600080fd5b803573ffffffffffffffffffffffffffffffffffffffff8116811461107957600080fd5b919050565b6000806040838503121561109157600080fd5b61109a83611055565b91506110a860208401611055565b90509250929050565b6000602082840312156110c357600080fd5b5035919050565b600080604083850312156110dd57600080fd5b823591506110a860208401611055565b6000806040838503121561110057600080fd5b50508035926020909101359150565b60006020828403121561112157600080fd5b6105a782611055565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006020828403121561116b57600080fd5b815180151581146105a757600080fd5b81810381811115610417577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b6000825160005b8181101561120557602081860181015185830152016111eb565b50600092019182525091905056fea2646970667358221220ae622a2da80c730eb06fbc09f0feabbb824bbdb349894cba40b3bf6d93d73db164736f6c63430008140033","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.20 ^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 pure 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/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// lib/openzeppelin-contracts/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 ERC-165 detection.\n */\ninterface IAccessControl {\n /**\n * @dev The `account` is missing a role.\n */\n error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);\n\n /**\n * @dev The caller of a function is not the expected one.\n *\n * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.\n */\n error AccessControlBadConfirmation();\n\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted 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// lib/openzeppelin-contracts/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 ERC-20 standard as defined in the ERC.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the value of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the value of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 value) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n * caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 value) external returns (bool);\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\n * allowance mechanism. `value` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n\n// lib/openzeppelin-contracts/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 ERC-20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[ERC-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC-20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n *\n * ==== Security Considerations\n *\n * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\n * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\n * considered as an intention to spend the allowance in any specific way. The second is that because permits have\n * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\n * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\n * generally recommended is:\n *\n * ```solidity\n * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\n * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\n * doThing(..., value);\n * }\n *\n * function doThing(..., uint256 value) public {\n * token.safeTransferFrom(msg.sender, address(this), value);\n * ...\n * }\n * ```\n *\n * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\n * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\n * {SafeERC20-safeTransferFrom}).\n *\n * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\n * contracts should have entry points that don't rely on permit.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also 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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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 ERC-165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[ERC].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n\n// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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 ERC-165 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// lib/openzeppelin-contracts/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 ERC-165 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// lib/openzeppelin-contracts/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 ERC-20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n /**\n * @dev An operation with an ERC-20 token failed.\n */\n error SafeERC20FailedOperation(address token);\n\n /**\n * @dev Indicates a failed `decreaseAllowance` request.\n */\n error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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/FastBridge.sol\n\ncontract FastBridge is IFastBridge, Admin {\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 enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeStatus) public bridgeStatuses;\n /// @notice Proof of relayed bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeProof) public bridgeProofs;\n /// @notice Whether bridge has been relayed on destination chain\n mapping(bytes32 =\u003e bool) public bridgeRelays;\n\n /// @dev to prevent replays\n uint256 public nonce;\n // @dev 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 /// @notice Pulls a requested token from the user to the requested recipient.\n /// @dev Be careful of re-entrancy issues when msg.value \u003e 0 and recipient != address(this)\n function _pullToken(address recipient, address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token != UniversalTokenLib.ETH_ADDRESS) {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(recipient);\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, recipient, amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(recipient) - amountPulled;\n } else {\n // Otherwise, we need to check that ETH amount matches msg.value\n if (amount != msg.value) revert MsgValueIncorrect();\n // Transfer value to recipient if not this address\n if (recipient != address(this)) token.universalTransfer(recipient, amount);\n // We will forward msg.value in the external call later, if recipient is not this contract\n amountPulled = msg.value;\n }\n }\n\n /// @inheritdoc IFastBridge\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n // check bridge params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\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\n // transfer tokens to bridge contract\n // @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(address(this), 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 BridgeTransaction({\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 sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n\n // check haven't exceeded deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n\n // mark bridge transaction as relayed\n if (bridgeRelays[transactionId]) revert TransactionRelayed();\n bridgeRelays[transactionId] = true;\n\n // transfer tokens to recipient on destination chain and gas rebate if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n uint256 rebate = chainGasAmount;\n if (!transaction.sendChainGas) {\n // forward erc20\n rebate = 0;\n _pullToken(to, token, amount);\n } else if (token == UniversalTokenLib.ETH_ADDRESS) {\n // lump in gas rebate into amount in native gas token\n _pullToken(to, token, amount + rebate);\n } else {\n // forward erc20 then forward gas rebate in native gas token\n _pullToken(to, token, amount);\n _pullToken(to, UniversalTokenLib.ETH_ADDRESS, rebate);\n }\n\n emit BridgeRelayed(\n transactionId,\n msg.sender,\n to,\n transaction.originChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n rebate\n );\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n // update bridge tx status given proof provided\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = BridgeStatus.RELAYER_PROVED;\n bridgeProofs[transactionId] = BridgeProof({timestamp: uint96(block.timestamp), relayer: msg.sender}); // overflow ok\n\n emit BridgeProofProvided(transactionId, msg.sender, destTxHash);\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint96(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint96).max but\n /// proof.timestamp \u003c type(uint96).max via unchecked statement\n /// @param proof The bridge proof\n /// @return delta Time delta since proof submitted\n function _timeSince(BridgeProof memory proof) internal view returns (uint256 delta) {\n unchecked {\n delta = uint96(block.timestamp) - proof.timestamp;\n }\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != relayer) revert SenderIncorrect();\n return _timeSince(proof) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != msg.sender) revert SenderIncorrect();\n if (_timeSince(proof) \u003c= DISPUTE_PERIOD) revert DisputePeriodNotPassed();\n\n bridgeStatuses[transactionId] = 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, msg.sender, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeProofs[transactionId]) \u003e DISPUTE_PERIOD) revert DisputePeriodPassed();\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n delete bridgeProofs[transactionId];\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 BridgeTransaction memory transaction = getBridgeTransaction(request);\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 // set status to refunded if still in requested state\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = 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","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","compilerOptions":"--combined-json bin,bin-runtime,srcmap,srcmap-runtime,abi,userdoc,devdoc,metadata,hashes --optimize --optimize-runs 10000 --allow-paths ., ./, ../ --evm-version=istanbul","srcMap":"56331:1843:0:-:0;;;57158:83;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;57196:38;46368:4;57227:6;57196:10;:38::i;:::-;;57158:83;56331:1843;;55681:257;55767:4;;55798:31;55815:4;55821:7;55798:16;:31::i;:::-;55783:46;;55843:7;55839:69;;;55866:18;;;;:12;:18;;;;;:31;;55889:7;55866:22;:31::i;:::-;;55839:69;55924:7;-1:-1:-1;55681:257:0;;;;;:::o;50315:316::-;50392:4;47090:12;;;;;;;;;;;-1:-1:-1;;;;;47090:29:0;;;;;;;;;;;;50408:217;;50451:6;:12;;;;;;;;;;;-1:-1:-1;;;;;50451:29:0;;;;;;;;;:36;;-1:-1:-1;;50451:36:0;50483:4;50451:36;;;50533:12;22406:10;;22327:96;50533:12;-1:-1:-1;;;;;50506:40:0;50524:7;-1:-1:-1;;;;;50506:40:0;50518:4;50506:40;;;;;;;;;;-1:-1:-1;50567:4:0;50560:11;;50408:217;-1:-1:-1;50609:5:0;50602:12;;31852:150;31922:4;31945:50;31950:3;-1:-1:-1;;;;;31970:23:0;;25840:4;27896:21;;;:14;;;:21;;;;;;25856:321;;-1:-1:-1;25898:23:0;;;;;;;;:11;:23;;;;;;;;;;;;;26080:18;;26056:21;;;:14;;;:21;;;;;;:42;;;;26112: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;56331:1843:0;;;;;;","srcMapRuntime":"56331:1843:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;54341:212;;;;;;:::i;:::-;;:::i;:::-;;;516:14:1;;509:22;491:41;;479:2;464:18;54341:212:0;;;;;;;;56571:60;;56608:23;56571:60;;;;;689:25:1;;;677:2;662:18;56571:60:0;543:177:1;57543:359:0;;;;;;:::i;:::-;;:::i;:::-;;56753:45;;56792:6;56753:45;;47946:120;;;;;;:::i;:::-;48011:7;48037:12;;;;;;;;;;:22;;;;47946:120;48362:136;;;;;;:::i;:::-;;:::i;49464:245::-;;;;;;:::i;:::-;;:::i;56915:30::-;;;;;;56499:66;;56539:26;56499:66;;55138:142;;;;;;:::i;:::-;;:::i;:::-;;;2246:42:1;2234:55;;;2216:74;;2204:2;2189:18;55138:142:0;2070:226:1;46990:136:0;;;;;;:::i;:::-;47067:4;47090:12;;;;;;;;;;;:29;;;;;;;;;;;;;;;;46990:136;56429:64;;56468:25;56429:64;;46323:49;;46368:4;46323:49;;57247:290;;;;;;:::i;:::-;;:::i;57908:264::-;;;;;;:::i;:::-;;:::i;56710:37::-;;56744:3;56710:37;;55448:131;;;;;;:::i;:::-;;:::i;56637:66::-;;56677:26;56637:66;;48778:138;;;;;;:::i;:::-;;:::i;57001:47::-;;;;;;:::i;:::-;;;;;;;;;;;;;;57122:29;;;;;;54341:212;54426:4;54449:57;;;54464:42;54449:57;;:97;;;54510:36;54534:11;54510:23;:36::i;:::-;54442:104;54341:212;-1:-1:-1;;54341:212:0:o;57543:359::-;56677:26;46600:16;46611:4;46600:10;:16::i;:::-;57667:19:::1;::::0;::::1;57647:17;57667:19:::0;;;:12:::1;:19;::::0;;;;;;57700:14;;;57696:27:::1;;57716:7;57543:359:::0;;;:::o;57696:27::-:1;57764:19;::::0;::::1;57786:1;57764:19:::0;;;:12:::1;:19;::::0;;;;:23;57797:45:::1;::::0;57821:9;57832;57797:23:::1;:45::i;:::-;57857:38;::::0;;2889:42:1;2958:15;;;2940:34;;3010:15;;3005:2;2990:18;;2983:43;3042:18;;;3035:34;;;57857:38:0::1;::::0;2867:2:1;2852:18;57857:38:0::1;;;;;;;57637:265;46626:1;57543:359:::0;;;:::o;48362:136::-;48011:7;48037:12;;;;;;;;;;:22;;;46600:16;46611:4;46600:10;:16::i;:::-;48466:25:::1;48477:4;48483:7;48466:10;:25::i;:::-;;48362:136:::0;;;:::o;49464:245::-;49557:34;;;22406:10;49557:34;49553:102;;49614:30;;;;;;;;;;;;;;49553:102;49665:37;49677:4;49683:18;49665:11;:37::i;55138:142::-;55219:7;55245:18;;;:12;:18;;;;;:28;;55267:5;55245:21;:28::i;:::-;55238:35;55138:142;-1:-1:-1;;;55138:142:0:o;57247:290::-;56677:26;46600:16;46611:4;46600:10;:16::i;:::-;56792:6:::1;57346:10;:26;;57338:55;;;::::0;::::1;::::0;;3282:2:1;57338:55:0::1;::::0;::::1;3264:21:1::0;3321:2;3301:18;;;3294:30;3360:18;3340;;;3333:46;3396:18;;57338:55:0::1;;;;;;;;;57424:15;::::0;;57449:28;;;;57492:38:::1;::::0;;3599:25:1;;;3655:2;3640:18;;3633:34;;;57492:38:0::1;::::0;3572:18:1;57492:38:0::1;;;;;;;;57328:209;57247:290:::0;;:::o;57908:264::-;56677:26;46600:16;46611:4;46600:10;:16::i;:::-;58033:14:::1;::::0;;58057:34;;;;58106:59:::1;::::0;;3599:25:1;;;3655:2;3640:18;;3633:34;;;58106:59:0::1;::::0;3572:18:1;58106:59:0::1;3425:248:1::0;55448:131:0;55519:7;55545:18;;;:12;:18;;;;;:27;;:25;:27::i;48778:138::-;48011:7;48037:12;;;;;;;;;;:22;;;46600:16;46611:4;46600:10;:16::i;:::-;48883:26:::1;48895:4;48901:7;48883:11;:26::i;46701:202::-:0;46786:4;46809:47;;;46824:32;46809:47;;:87;;-1:-1:-1;38614:25:0;38599:40;;;;46860:36;38500:146;47335:103;47401:30;47412:4;22406:10;47401;:30::i;:::-;47335:103;:::o;51613:653::-;51788:4;51774:19;;;;51770:32;;51613:653;;;:::o;51770:32::-;51874:5;51883:1;51874:10;51870:23;;51613:653;;;:::o;51870:23::-;51906:20;;;;;51902:358;;52086:12;52103:2;:7;;52118:5;52103:25;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;52085:43;;;52150:7;52142:39;;;;;;;4090:2:1;52142:39:0;;;4072:21:1;4129:2;4109:18;;;4102:30;4168:21;4148:18;;;4141:49;4207:18;;52142:39:0;3888:343:1;51902:358:0;52212:37;:26;;;52239:2;52243:5;52212:26;:37::i;55681:257::-;55767:4;55783:12;55798:31;55815:4;55821:7;55798:16;:31::i;:::-;55783:46;;55843:7;55839:69;;;55866:18;;;;:12;:18;;;;;:31;;55889:7;55866:22;:31::i;:::-;;55924:7;55681:257;-1:-1:-1;;;55681:257:0:o;56041:262::-;56128:4;56144:12;56159:32;56177:4;56183:7;56159:17;:32::i;:::-;56144:47;;56205:7;56201:72;;;56228:18;;;;:12;:18;;;;;:34;;56254:7;56228:25;:34::i;33110:156::-;33184:7;33234:22;33238:3;33250:5;33234:3;:22::i;32653:115::-;32716:7;32742:19;32750:3;28092:18;;28010:107;47568:197;47067:4;47090:12;;;;;;;;;;;:29;;;;;;;;;;;;;47651:108;;47701:47;;;;;4440:42:1;4428:55;;47701:47:0;;;4410:74:1;4500:18;;;4493:34;;;4383:18;;47701:47:0;4236:297:1;47651:108:0;47568:197;;:::o;39818:160::-;39927:43;;;39942:14;4428:55:1;;39927:43:0;;;4410:74:1;4500:18;;;;4493:34;;;39927:43:0;;;;;;;;;;4383:18:1;;;;39927:43:0;;;;;;;;;;;;;;39900:71;;39920:5;;39900:19;:71::i;50315:316::-;50392:4;47090:12;;;;;;;;;;;:29;;;;;;;;;;;;;50408:217;;50451:6;:12;;;;;;;;;;;:29;;;;;;;;;;:36;;;;50483:4;50451:36;;;50533:12;22406:10;;22327:96;50533:12;50506:40;;50524:7;50506:40;;50518:4;50506:40;;;;;;;;;;-1:-1:-1;50567:4:0;50560:11;;50408:217;-1:-1:-1;50609:5:0;50602:12;;31852:150;31922:4;31945:50;31950:3;31970:23;;;31945:4;:50::i;50866:317::-;50944:4;47090:12;;;;;;;;;;;:29;;;;;;;;;;;;;50960:217;;;51034:5;51002:12;;;;;;;;;;;:29;;;;;;;;;;;:37;;;;;;51058:40;22406:10;;51002:12;;51058:40;;51034:5;51058:40;-1:-1:-1;51119:4:0;51112:11;;32170:156;32243:4;32266:53;32274:3;32294:23;;;32266:7;:53::i;28459:118::-;28526:7;28552:3;:11;;28564:5;28552:18;;;;;;;;:::i;:::-;;;;;;;;;28545:25;;28459:118;;;;:::o;42574:629::-;42993:23;43019:33;:27;;;43047:4;43019:27;:33::i;:::-;42993:59;;43066:10;:17;43087:1;43066:22;;:57;;;;;43104:10;43093:30;;;;;;;;;;;;:::i;:::-;43092:31;43066:57;43062:135;;;43146:40;;;;;2246:42:1;2234:55;;43146:40:0;;;2216:74:1;2189:18;;43146:40:0;2070:226:1;25777:406:0;25840:4;27896:21;;;:14;;;:21;;;;;;25856:321;;-1:-1:-1;25898:23:0;;;;;;;;:11;:23;;;;;;;;;;;;;26080:18;;26056:21;;;:14;;;:21;;;;;;:42;;;;26112:11;;26351:1368;26417:4;26546:21;;;:14;;;:21;;;;;;26582:13;;26578:1135;;26949:18;26970:12;26981:1;26970:8;:12;:::i;:::-;27016:18;;26949:33;;-1:-1:-1;26996:17:0;;27016:22;;27037:1;;27016:22;:::i;:::-;26996:42;;27071:9;27057:10;:23;27053:378;;27100:17;27120:3;:11;;27132:9;27120:22;;;;;;;;:::i;:::-;;;;;;;;;27100:42;;27267:9;27241:3;:11;;27253:10;27241:23;;;;;;;;:::i;:::-;;;;;;;;;;;;:35;;;;27380:25;;;:14;;;:25;;;;;:36;;;27053:378;27509:17;;:3;;:17;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;27612:3;:14;;:21;27627:5;27612:21;;;;;;;;;;;27605:28;;;27655:4;27648:11;;;;;;;26578:1135;27697:5;27690:12;;;;;18112:151;18187:12;18218:38;18240:6;18248:4;18254:1;18187:12;18828;18842:23;18869:6;:11;;18888:5;18895:4;18869:31;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;18827:73;;;;18917:55;18944:6;18952:7;18961:10;18917:26;:55::i;:::-;18910:62;18587:392;-1:-1:-1;;;;;;18587:392:0:o;20032:582::-;20176:12;20205:7;20200:408;;20228:19;20236:10;20228:7;:19::i;:::-;20200:408;;;20452:17;;:22;:49;;;;-1:-1:-1;20478:18:0;;;;:23;20452:49;20448:119;;;20528:24;;;;;2246:42:1;2234:55;;20528:24:0;;;2216:74:1;2189:18;;20528:24:0;2070:226:1;20448:119:0;-1:-1:-1;20587:10:0;20580:17;;21150:516;21281:17;;:21;21277:383;;21509:10;21503:17;21565:15;21552:10;21548:2;21544:19;21537:44;21277:383;21632: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 ERC-20 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.20+commit.a1b79de6\"},\"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 ERC-20 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/FastBridge.sol\":\"Admin\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridge.sol\":{\"keccak256\":\"0x7da00701c906b2b78d838eb9c510ab5903b6dd7f8e5fb12d4c4710c350e3c919\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://faff50fb8d1f3cf10122c1b611d0987ca58f4099d90c17163816c90d3077bce7\",\"dweb:/ipfs/QmWKF2L9D18J9QXiMbm6ucj3x8ebjQtTrycnkNmB4q3JRo\"]}},\"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/FastBridge.sol:Context":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.20 ^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 pure 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/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// lib/openzeppelin-contracts/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 ERC-165 detection.\n */\ninterface IAccessControl {\n /**\n * @dev The `account` is missing a role.\n */\n error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);\n\n /**\n * @dev The caller of a function is not the expected one.\n *\n * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.\n */\n error AccessControlBadConfirmation();\n\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted 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// lib/openzeppelin-contracts/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 ERC-20 standard as defined in the ERC.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the value of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the value of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 value) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n * caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 value) external returns (bool);\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\n * allowance mechanism. `value` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n\n// lib/openzeppelin-contracts/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 ERC-20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[ERC-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC-20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n *\n * ==== Security Considerations\n *\n * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\n * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\n * considered as an intention to spend the allowance in any specific way. The second is that because permits have\n * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\n * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\n * generally recommended is:\n *\n * ```solidity\n * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\n * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\n * doThing(..., value);\n * }\n *\n * function doThing(..., uint256 value) public {\n * token.safeTransferFrom(msg.sender, address(this), value);\n * ...\n * }\n * ```\n *\n * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\n * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\n * {SafeERC20-safeTransferFrom}).\n *\n * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\n * contracts should have entry points that don't rely on permit.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also 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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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 ERC-165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[ERC].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n\n// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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 ERC-165 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// lib/openzeppelin-contracts/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 ERC-165 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// lib/openzeppelin-contracts/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 ERC-20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n /**\n * @dev An operation with an ERC-20 token failed.\n */\n error SafeERC20FailedOperation(address token);\n\n /**\n * @dev Indicates a failed `decreaseAllowance` request.\n */\n error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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/FastBridge.sol\n\ncontract FastBridge is IFastBridge, Admin {\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 enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeStatus) public bridgeStatuses;\n /// @notice Proof of relayed bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeProof) public bridgeProofs;\n /// @notice Whether bridge has been relayed on destination chain\n mapping(bytes32 =\u003e bool) public bridgeRelays;\n\n /// @dev to prevent replays\n uint256 public nonce;\n // @dev 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 /// @notice Pulls a requested token from the user to the requested recipient.\n /// @dev Be careful of re-entrancy issues when msg.value \u003e 0 and recipient != address(this)\n function _pullToken(address recipient, address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token != UniversalTokenLib.ETH_ADDRESS) {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(recipient);\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, recipient, amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(recipient) - amountPulled;\n } else {\n // Otherwise, we need to check that ETH amount matches msg.value\n if (amount != msg.value) revert MsgValueIncorrect();\n // Transfer value to recipient if not this address\n if (recipient != address(this)) token.universalTransfer(recipient, amount);\n // We will forward msg.value in the external call later, if recipient is not this contract\n amountPulled = msg.value;\n }\n }\n\n /// @inheritdoc IFastBridge\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n // check bridge params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\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\n // transfer tokens to bridge contract\n // @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(address(this), 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 BridgeTransaction({\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 sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n\n // check haven't exceeded deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n\n // mark bridge transaction as relayed\n if (bridgeRelays[transactionId]) revert TransactionRelayed();\n bridgeRelays[transactionId] = true;\n\n // transfer tokens to recipient on destination chain and gas rebate if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n uint256 rebate = chainGasAmount;\n if (!transaction.sendChainGas) {\n // forward erc20\n rebate = 0;\n _pullToken(to, token, amount);\n } else if (token == UniversalTokenLib.ETH_ADDRESS) {\n // lump in gas rebate into amount in native gas token\n _pullToken(to, token, amount + rebate);\n } else {\n // forward erc20 then forward gas rebate in native gas token\n _pullToken(to, token, amount);\n _pullToken(to, UniversalTokenLib.ETH_ADDRESS, rebate);\n }\n\n emit BridgeRelayed(\n transactionId,\n msg.sender,\n to,\n transaction.originChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n rebate\n );\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n // update bridge tx status given proof provided\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = BridgeStatus.RELAYER_PROVED;\n bridgeProofs[transactionId] = BridgeProof({timestamp: uint96(block.timestamp), relayer: msg.sender}); // overflow ok\n\n emit BridgeProofProvided(transactionId, msg.sender, destTxHash);\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint96(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint96).max but\n /// proof.timestamp \u003c type(uint96).max via unchecked statement\n /// @param proof The bridge proof\n /// @return delta Time delta since proof submitted\n function _timeSince(BridgeProof memory proof) internal view returns (uint256 delta) {\n unchecked {\n delta = uint96(block.timestamp) - proof.timestamp;\n }\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != relayer) revert SenderIncorrect();\n return _timeSince(proof) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != msg.sender) revert SenderIncorrect();\n if (_timeSince(proof) \u003c= DISPUTE_PERIOD) revert DisputePeriodNotPassed();\n\n bridgeStatuses[transactionId] = 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, msg.sender, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeProofs[transactionId]) \u003e DISPUTE_PERIOD) revert DisputePeriodPassed();\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n delete bridgeProofs[transactionId];\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 BridgeTransaction memory transaction = getBridgeTransaction(request);\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 // set status to refunded if still in requested state\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = 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","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","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.20+commit.a1b79de6\"},\"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/FastBridge.sol\":\"Context\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridge.sol\":{\"keccak256\":\"0x7da00701c906b2b78d838eb9c510ab5903b6dd7f8e5fb12d4c4710c350e3c919\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://faff50fb8d1f3cf10122c1b611d0987ca58f4099d90c17163816c90d3077bce7\",\"dweb:/ipfs/QmWKF2L9D18J9QXiMbm6ucj3x8ebjQtTrycnkNmB4q3JRo\"]}},\"version\":1}"},"hashes":{}},"solidity/FastBridge.sol:ERC165":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.20 ^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 pure 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/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// lib/openzeppelin-contracts/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 ERC-165 detection.\n */\ninterface IAccessControl {\n /**\n * @dev The `account` is missing a role.\n */\n error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);\n\n /**\n * @dev The caller of a function is not the expected one.\n *\n * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.\n */\n error AccessControlBadConfirmation();\n\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted 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// lib/openzeppelin-contracts/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 ERC-20 standard as defined in the ERC.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the value of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the value of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 value) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n * caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 value) external returns (bool);\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\n * allowance mechanism. `value` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n\n// lib/openzeppelin-contracts/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 ERC-20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[ERC-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC-20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n *\n * ==== Security Considerations\n *\n * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\n * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\n * considered as an intention to spend the allowance in any specific way. The second is that because permits have\n * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\n * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\n * generally recommended is:\n *\n * ```solidity\n * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\n * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\n * doThing(..., value);\n * }\n *\n * function doThing(..., uint256 value) public {\n * token.safeTransferFrom(msg.sender, address(this), value);\n * ...\n * }\n * ```\n *\n * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\n * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\n * {SafeERC20-safeTransferFrom}).\n *\n * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\n * contracts should have entry points that don't rely on permit.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also 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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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 ERC-165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[ERC].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n\n// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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 ERC-165 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// lib/openzeppelin-contracts/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 ERC-165 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// lib/openzeppelin-contracts/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 ERC-20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n /**\n * @dev An operation with an ERC-20 token failed.\n */\n error SafeERC20FailedOperation(address token);\n\n /**\n * @dev Indicates a failed `decreaseAllowance` request.\n */\n error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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/FastBridge.sol\n\ncontract FastBridge is IFastBridge, Admin {\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 enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeStatus) public bridgeStatuses;\n /// @notice Proof of relayed bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeProof) public bridgeProofs;\n /// @notice Whether bridge has been relayed on destination chain\n mapping(bytes32 =\u003e bool) public bridgeRelays;\n\n /// @dev to prevent replays\n uint256 public nonce;\n // @dev 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 /// @notice Pulls a requested token from the user to the requested recipient.\n /// @dev Be careful of re-entrancy issues when msg.value \u003e 0 and recipient != address(this)\n function _pullToken(address recipient, address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token != UniversalTokenLib.ETH_ADDRESS) {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(recipient);\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, recipient, amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(recipient) - amountPulled;\n } else {\n // Otherwise, we need to check that ETH amount matches msg.value\n if (amount != msg.value) revert MsgValueIncorrect();\n // Transfer value to recipient if not this address\n if (recipient != address(this)) token.universalTransfer(recipient, amount);\n // We will forward msg.value in the external call later, if recipient is not this contract\n amountPulled = msg.value;\n }\n }\n\n /// @inheritdoc IFastBridge\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n // check bridge params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\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\n // transfer tokens to bridge contract\n // @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(address(this), 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 BridgeTransaction({\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 sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n\n // check haven't exceeded deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n\n // mark bridge transaction as relayed\n if (bridgeRelays[transactionId]) revert TransactionRelayed();\n bridgeRelays[transactionId] = true;\n\n // transfer tokens to recipient on destination chain and gas rebate if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n uint256 rebate = chainGasAmount;\n if (!transaction.sendChainGas) {\n // forward erc20\n rebate = 0;\n _pullToken(to, token, amount);\n } else if (token == UniversalTokenLib.ETH_ADDRESS) {\n // lump in gas rebate into amount in native gas token\n _pullToken(to, token, amount + rebate);\n } else {\n // forward erc20 then forward gas rebate in native gas token\n _pullToken(to, token, amount);\n _pullToken(to, UniversalTokenLib.ETH_ADDRESS, rebate);\n }\n\n emit BridgeRelayed(\n transactionId,\n msg.sender,\n to,\n transaction.originChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n rebate\n );\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n // update bridge tx status given proof provided\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = BridgeStatus.RELAYER_PROVED;\n bridgeProofs[transactionId] = BridgeProof({timestamp: uint96(block.timestamp), relayer: msg.sender}); // overflow ok\n\n emit BridgeProofProvided(transactionId, msg.sender, destTxHash);\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint96(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint96).max but\n /// proof.timestamp \u003c type(uint96).max via unchecked statement\n /// @param proof The bridge proof\n /// @return delta Time delta since proof submitted\n function _timeSince(BridgeProof memory proof) internal view returns (uint256 delta) {\n unchecked {\n delta = uint96(block.timestamp) - proof.timestamp;\n }\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != relayer) revert SenderIncorrect();\n return _timeSince(proof) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != msg.sender) revert SenderIncorrect();\n if (_timeSince(proof) \u003c= DISPUTE_PERIOD) revert DisputePeriodNotPassed();\n\n bridgeStatuses[transactionId] = 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, msg.sender, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeProofs[transactionId]) \u003e DISPUTE_PERIOD) revert DisputePeriodPassed();\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n delete bridgeProofs[transactionId];\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 BridgeTransaction memory transaction = getBridgeTransaction(request);\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 // set status to refunded if still in requested state\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = 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","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","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 ERC-165 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.20+commit.a1b79de6\"},\"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 ERC-165 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/FastBridge.sol\":\"ERC165\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridge.sol\":{\"keccak256\":\"0x7da00701c906b2b78d838eb9c510ab5903b6dd7f8e5fb12d4c4710c350e3c919\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://faff50fb8d1f3cf10122c1b611d0987ca58f4099d90c17163816c90d3077bce7\",\"dweb:/ipfs/QmWKF2L9D18J9QXiMbm6ucj3x8ebjQtTrycnkNmB4q3JRo\"]}},\"version\":1}"},"hashes":{"supportsInterface(bytes4)":"01ffc9a7"}},"solidity/FastBridge.sol:EnumerableSet":{"code":"0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220ccb9bee87c33656dd99a59e58a032b4a522fa9282d7547294079dc934f18ba3f64736f6c63430008140033","runtime-code":"0x73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220ccb9bee87c33656dd99a59e58a032b4a522fa9282d7547294079dc934f18ba3f64736f6c63430008140033","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.20 ^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 pure 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/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// lib/openzeppelin-contracts/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 ERC-165 detection.\n */\ninterface IAccessControl {\n /**\n * @dev The `account` is missing a role.\n */\n error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);\n\n /**\n * @dev The caller of a function is not the expected one.\n *\n * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.\n */\n error AccessControlBadConfirmation();\n\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted 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// lib/openzeppelin-contracts/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 ERC-20 standard as defined in the ERC.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the value of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the value of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 value) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n * caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 value) external returns (bool);\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\n * allowance mechanism. `value` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n\n// lib/openzeppelin-contracts/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 ERC-20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[ERC-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC-20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n *\n * ==== Security Considerations\n *\n * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\n * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\n * considered as an intention to spend the allowance in any specific way. The second is that because permits have\n * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\n * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\n * generally recommended is:\n *\n * ```solidity\n * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\n * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\n * doThing(..., value);\n * }\n *\n * function doThing(..., uint256 value) public {\n * token.safeTransferFrom(msg.sender, address(this), value);\n * ...\n * }\n * ```\n *\n * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\n * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\n * {SafeERC20-safeTransferFrom}).\n *\n * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\n * contracts should have entry points that don't rely on permit.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also 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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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 ERC-165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[ERC].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n\n// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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 ERC-165 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// lib/openzeppelin-contracts/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 ERC-165 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// lib/openzeppelin-contracts/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 ERC-20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n /**\n * @dev An operation with an ERC-20 token failed.\n */\n error SafeERC20FailedOperation(address token);\n\n /**\n * @dev Indicates a failed `decreaseAllowance` request.\n */\n error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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/FastBridge.sol\n\ncontract FastBridge is IFastBridge, Admin {\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 enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeStatus) public bridgeStatuses;\n /// @notice Proof of relayed bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeProof) public bridgeProofs;\n /// @notice Whether bridge has been relayed on destination chain\n mapping(bytes32 =\u003e bool) public bridgeRelays;\n\n /// @dev to prevent replays\n uint256 public nonce;\n // @dev 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 /// @notice Pulls a requested token from the user to the requested recipient.\n /// @dev Be careful of re-entrancy issues when msg.value \u003e 0 and recipient != address(this)\n function _pullToken(address recipient, address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token != UniversalTokenLib.ETH_ADDRESS) {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(recipient);\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, recipient, amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(recipient) - amountPulled;\n } else {\n // Otherwise, we need to check that ETH amount matches msg.value\n if (amount != msg.value) revert MsgValueIncorrect();\n // Transfer value to recipient if not this address\n if (recipient != address(this)) token.universalTransfer(recipient, amount);\n // We will forward msg.value in the external call later, if recipient is not this contract\n amountPulled = msg.value;\n }\n }\n\n /// @inheritdoc IFastBridge\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n // check bridge params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\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\n // transfer tokens to bridge contract\n // @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(address(this), 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 BridgeTransaction({\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 sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n\n // check haven't exceeded deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n\n // mark bridge transaction as relayed\n if (bridgeRelays[transactionId]) revert TransactionRelayed();\n bridgeRelays[transactionId] = true;\n\n // transfer tokens to recipient on destination chain and gas rebate if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n uint256 rebate = chainGasAmount;\n if (!transaction.sendChainGas) {\n // forward erc20\n rebate = 0;\n _pullToken(to, token, amount);\n } else if (token == UniversalTokenLib.ETH_ADDRESS) {\n // lump in gas rebate into amount in native gas token\n _pullToken(to, token, amount + rebate);\n } else {\n // forward erc20 then forward gas rebate in native gas token\n _pullToken(to, token, amount);\n _pullToken(to, UniversalTokenLib.ETH_ADDRESS, rebate);\n }\n\n emit BridgeRelayed(\n transactionId,\n msg.sender,\n to,\n transaction.originChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n rebate\n );\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n // update bridge tx status given proof provided\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = BridgeStatus.RELAYER_PROVED;\n bridgeProofs[transactionId] = BridgeProof({timestamp: uint96(block.timestamp), relayer: msg.sender}); // overflow ok\n\n emit BridgeProofProvided(transactionId, msg.sender, destTxHash);\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint96(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint96).max but\n /// proof.timestamp \u003c type(uint96).max via unchecked statement\n /// @param proof The bridge proof\n /// @return delta Time delta since proof submitted\n function _timeSince(BridgeProof memory proof) internal view returns (uint256 delta) {\n unchecked {\n delta = uint96(block.timestamp) - proof.timestamp;\n }\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != relayer) revert SenderIncorrect();\n return _timeSince(proof) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != msg.sender) revert SenderIncorrect();\n if (_timeSince(proof) \u003c= DISPUTE_PERIOD) revert DisputePeriodNotPassed();\n\n bridgeStatuses[transactionId] = 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, msg.sender, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeProofs[transactionId]) \u003e DISPUTE_PERIOD) revert DisputePeriodPassed();\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n delete bridgeProofs[transactionId];\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 BridgeTransaction memory transaction = getBridgeTransaction(request);\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 // set status to refunded if still in requested state\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = 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","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","compilerOptions":"--combined-json bin,bin-runtime,srcmap,srcmap-runtime,abi,userdoc,devdoc,metadata,hashes --optimize --optimize-runs 10000 --allow-paths ., ./, ../ --evm-version=istanbul","srcMap":"24866:11640:0:-:0;;;;;;;;;;;;;;;-1:-1:-1;;;24866:11640:0;;;;;;;;;;;;;;;;;","srcMapRuntime":"24866: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.20+commit.a1b79de6\"},\"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/FastBridge.sol\":\"EnumerableSet\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridge.sol\":{\"keccak256\":\"0x7da00701c906b2b78d838eb9c510ab5903b6dd7f8e5fb12d4c4710c350e3c919\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://faff50fb8d1f3cf10122c1b611d0987ca58f4099d90c17163816c90d3077bce7\",\"dweb:/ipfs/QmWKF2L9D18J9QXiMbm6ucj3x8ebjQtTrycnkNmB4q3JRo\"]}},\"version\":1}"},"hashes":{}},"solidity/FastBridge.sol:FastBridge":{"code":"0x60a06040523480156200001157600080fd5b5060405162002d7a38038062002d7a833981016040819052620000349162000194565b80620000426000826200004f565b50504360805250620001bf565b6000806200005e84846200008c565b90508015620000835760008481526001602052604090206200008190846200013a565b505b90505b92915050565b6000828152602081815260408083206001600160a01b038516845290915281205460ff1662000131576000838152602081815260408083206001600160a01b03861684529091529020805460ff19166001179055620000e83390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a450600162000086565b50600062000086565b600062000083836001600160a01b0384166000818152600183016020526040812054620001315750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915562000086565b600060208284031215620001a757600080fd5b81516001600160a01b03811681146200008357600080fd5b608051612b9f620001db60003960006106510152612b9f6000f3fe60806040526004361061026a5760003560e01c80639010d07c11610153578063add98c70116100cb578063ca15c8731161007f578063d547741f11610064578063d547741f146107a1578063dcf844a7146107c1578063e00a83e0146107ee57600080fd5b8063ca15c8731461074d578063ccc574901461076d57600080fd5b8063b13aa2d6116100b0578063b13aa2d6146106f6578063b250fe6b14610716578063bf333f2c1461073657600080fd5b8063add98c70146106c0578063affed0e0146106e057600080fd5b8063a217fddf11610122578063a5bbe22b11610107578063a5bbe22b1461047f578063aa9641ab14610673578063ac11fb1a1461069357600080fd5b8063a217fddf1461062a578063a3ec191a1461063f57600080fd5b80639010d07c146104f857806391ad50391461053057806391d14854146105b2578063926d7d7f146105f657600080fd5b806341fcb612116101e65780635eb7d946116101b55780638379a24f1161019a5780638379a24f14610495578063886d36ff146104c55780638f0d6f17146104e557600080fd5b80635eb7d9461461045f578063820688d51461047f57600080fd5b806341fcb612146103e2578063458516941461040257806358f85880146104155780635960ccf21461042b57600080fd5b80630f5f6ed71161023d578063248a9ca311610222578063248a9ca3146103725780632f2ff15d146103a257806336568abe146103c257600080fd5b80630f5f6ed714610345578063190da5951461035b57600080fd5b806301ffc9a71461026f57806303ed0ee5146102a4578063051287bc146102e657806306f333f214610323575b600080fd5b34801561027b57600080fd5b5061028f61028a3660046122fc565b610804565b60405190151581526020015b60405180910390f35b3480156102b057600080fd5b506102d87f043c983c49d46f0e102151eaf8085d4a2e6571d5df2d47b013f39bddfd4a639d81565b60405190815260200161029b565b3480156102f257600080fd5b5061031661030136600461233e565b60056020526000908152604090205460ff1681565b60405161029b9190612386565b34801561032f57600080fd5b5061034361033e3660046123ec565b610860565b005b34801561035157600080fd5b506102d861271081565b34801561036757600080fd5b506102d862093a8081565b34801561037e57600080fd5b506102d861038d36600461233e565b60009081526020819052604090206001015490565b3480156103ae57600080fd5b506103436103bd366004612425565b610927565b3480156103ce57600080fd5b506103436103dd366004612425565b610952565b3480156103ee57600080fd5b506103436103fd366004612572565b61099e565b6103436104103660046125ef565b610bd7565b34801561042157600080fd5b506102d860025481565b34801561043757600080fd5b506102d87fdb9556138406326f00296e13ea2ad7db24ba82381212d816b1a40c23b466b32781565b34801561046b57600080fd5b5061034361047a366004612692565b610ee5565b34801561048b57600080fd5b506102d861070881565b3480156104a157600080fd5b5061028f6104b036600461233e565b60076020526000908152604090205460ff1681565b3480156104d157600080fd5b506103436104e03660046126cf565b6110bd565b6103436104f3366004612692565b6111f0565b34801561050457600080fd5b50610518610513366004612714565b611437565b6040516001600160a01b03909116815260200161029b565b34801561053c57600080fd5b5061058661054b36600461233e565b6006602052600090815260409020546bffffffffffffffffffffffff8116906c0100000000000000000000000090046001600160a01b031682565b604080516bffffffffffffffffffffffff90931683526001600160a01b0390911660208301520161029b565b3480156105be57600080fd5b5061028f6105cd366004612425565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b34801561060257600080fd5b506102d87fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc481565b34801561063657600080fd5b506102d8600081565b34801561064b57600080fd5b506102d87f000000000000000000000000000000000000000000000000000000000000000081565b34801561067f57600080fd5b5061028f61068e366004612425565b611456565b34801561069f57600080fd5b506106b36106ae366004612692565b611559565b60405161029b9190612736565b3480156106cc57600080fd5b506103436106db36600461233e565b6115cc565b3480156106ec57600080fd5b506102d860085481565b34801561070257600080fd5b5061034361071136600461233e565b611735565b34801561072257600080fd5b5061034361073136600461233e565b611817565b34801561074257600080fd5b506102d8620f424081565b34801561075957600080fd5b506102d861076836600461233e565b61187f565b34801561077957600080fd5b506102d87f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5581565b3480156107ad57600080fd5b506103436107bc366004612425565b611896565b3480156107cd57600080fd5b506102d86107dc36600461281c565b60036020526000908152604090205481565b3480156107fa57600080fd5b506102d860045481565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f5a05180f00000000000000000000000000000000000000000000000000000000148061085a575061085a826118bb565b92915050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5561088a81611952565b6001600160a01b038316600090815260036020526040812054908190036108b15750505050565b6001600160a01b0384166000818152600360205260408120556108d590848361195f565b604080516001600160a01b038087168252851660208201529081018290527f244e51bc38c1452fa8aaf487bcb4bca36c2baa3a5fbdb776b1eabd8dc6d277cd9060600160405180910390a1505b505050565b60008281526020819052604090206001015461094281611952565b61094c8383611a82565b50505050565b6001600160a01b0381163314610994576040517f6697b23200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6109228282611ab7565b7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc46109c881611952565b8251602084012060006109da85611559565b9050600260008381526005602052604090205460ff166004811115610a0157610a01612357565b14610a38576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000828152600660209081526040918290208251808401909352546bffffffffffffffffffffffff811683526c0100000000000000000000000090046001600160a01b03169082018190523314610abb576040517f4af43a9000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80516107089042036bffffffffffffffffffffffff1611610b08576040517f1992d0bd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000838152600560205260409020805460ff1916600317905561010082015115610b645761010082015160808301516001600160a01b031660009081526003602052604081208054909190610b5e908490612868565b90915550505b608082015160c0830151610b826001600160a01b038316888361195f565b604080516001600160a01b03848116825260208201849052891691339188917f582211c35a2139ac3bbaac74663c6a1f56c6cbb658b41fe11fd45a82074ac67891015b60405180910390a45050505050505050565b46816000015163ffffffff1603610c1a576040517f7029fdf900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60a08101511580610c2d575060c0810151155b15610c64576040517fe38820c800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60608101516001600160a01b03161580610c89575060808101516001600160a01b0316155b15610cc0576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610ccc61070842612868565b8161010001511015610d0a576040517f04b7fcc800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000610d1f3083606001518460a00151611ae4565b90506000806002541115610d4c57620f424060025483610d3f919061287b565b610d499190612892565b90505b610d5681836128cd565b915060006040518061018001604052804663ffffffff168152602001856000015163ffffffff16815260200185602001516001600160a01b0316815260200185604001516001600160a01b0316815260200185606001516001600160a01b0316815260200185608001516001600160a01b031681526020018481526020018560c0015181526020018381526020018560e0015115158152602001856101000151815260200160086000815480929190610e0e906128e0565b909155509052604051610e249190602001612736565b604080518083037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0018152828252805160208083019190912060008181526005835293909320805460ff191660011790558701518751606089015160808a015160c08b015160e08c015195985095966001600160a01b039094169587957f120ea0364f36cdac7983bcfdd55270ca09d7f9b314a2ebc425a3b01ab1d6403a95610ed6958b959094909390928e9261293c565b60405180910390a35050505050565b805160208201206000610ef783611559565b3360009081527fd2043bf65931af3dbecf60d0db8f40e4160406d7beb00522f4200cf4944a1eb8602052604090205490915060ff1615610f74578061014001514211610f6f576040517fe15ff9ea00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610fc0565b62093a80816101400151610f889190612868565b4211610fc0576040517fe15ff9ea00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600160008381526005602052604090205460ff166004811115610fe557610fe5612357565b1461101c576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600082815260056020526040808220805460ff19166004179055820151608083015161010084015160c0850151929391926110579190612868565b905061106d6001600160a01b038316848361195f565b604080516001600160a01b0384811682526020820184905285169187917fb4c55c0c9bc613519b920e88748090150b890a875d307f21bea7d4fb2e8bc958910160405180910390a3505050505050565b7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc46110e781611952565b82516020840120600160008281526005602052604090205460ff16600481111561111357611113612357565b1461114a576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008181526005602090815260408083208054600260ff19909116179055805180820182526bffffffffffffffffffffffff4281168252338285018181528787526006865295849020925195516001600160a01b03166c0100000000000000000000000002959091169490941790555185815283917f4ac8af8a2cd87193d64dfc7a3b8d9923b714ec528b18725d080aa1299be0c5e4910160405180910390a350505050565b7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc461121a81611952565b81516020830120600061122c84611559565b90504663ffffffff16816020015163ffffffff1614611277576040517f7029fdf900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8061014001514211156112b6576040517f559895a300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008281526007602052604090205460ff16156112ff576040517fbef7bb7d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000828152600760205260409020805460ff19166001179055606081015160a082015160e083015160045461012085015161134857506000611342848484611ae4565b506113b9565b7fffffffffffffffffffffffff11111111111111111111111111111111111111126001600160a01b0384160161138c5761134284846113878486612868565b611ae4565b611397848484611ae4565b506113b78473eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee83611ae4565b505b845160808087015160a08089015160c0808b015160e08c01516040805163ffffffff90991689526001600160a01b0396871660208a0152938616938801939093526060870152938501528301849052861691339189917ff8ae392d784b1ea5e8881bfa586d81abf07ef4f1e2fc75f7fe51c90f05199a5c9101610bc5565b600082815260016020526040812061144f9083611cb3565b9392505050565b6000600260008481526005602052604090205460ff16600481111561147d5761147d612357565b146114b4576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000838152600660209081526040918290208251808401909352546bffffffffffffffffffffffff811683526001600160a01b036c01000000000000000000000000909104811691830182905284161461153a576040517f4af43a9000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80516107089042036bffffffffffffffffffffffff1611949350505050565b604080516101808101825260008082526020808301829052928201819052606082018190526080820181905260a0820181905260c0820181905260e082018190526101008201819052610120820181905261014082018190526101608201528251909161085a91840181019084016129ed565b7f043c983c49d46f0e102151eaf8085d4a2e6571d5df2d47b013f39bddfd4a639d6115f681611952565b600260008381526005602052604090205460ff16600481111561161b5761161b612357565b14611652576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000828152600660209081526040918290208251808401909352546bffffffffffffffffffffffff8082168085526c010000000000000000000000009092046001600160a01b031693909201929092526107089142031611156116e1576040517f3e908aac00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000828152600560209081526040808320805460ff19166001179055600690915280822082905551339184917f0695cf1d39b3055dcd0fe02d8b47eaf0d5a13e1996de925de59d0ef9b7f7fad49190a35050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5561175f81611952565b6127108211156117d0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f6e657746656552617465203e206d61780000000000000000000000000000000060448201526064015b60405180910390fd5b600280549083905560408051828152602081018590527f14914da2bf76024616fbe1859783fcd4dbddcb179b1f3a854949fbf920dcb95791015b60405180910390a1505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5561184181611952565b600480549083905560408051828152602081018590527f5cf09b12f3f56b4c564d51b25b40360af6d795198adb61ae0806a36c294323fa910161180a565b600081815260016020526040812061085a90611cbf565b6000828152602081905260409020600101546118b181611952565b61094c8383611ab7565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061085a57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff0000000000000000000000000000000000000000000000000000000083161461085a565b61195c8133611cc9565b50565b306001600160a01b0383160361197457505050565b8060000361198157505050565b7fffffffffffffffffffffffff11111111111111111111111111111111111111126001600160a01b03841601611a6e576000826001600160a01b03168260405160006040518083038185875af1925050503d80600081146119fe576040519150601f19603f3d011682016040523d82523d6000602084013e611a03565b606091505b505090508061094c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f455448207472616e73666572206661696c65640000000000000000000000000060448201526064016117c7565b6109226001600160a01b0384168383611d39565b600080611a8f8484611dad565b9050801561144f576000848152600160205260409020611aaf9084611e57565b509392505050565b600080611ac48484611e6c565b9050801561144f576000848152600160205260409020611aaf9084611eef565b60006001600160a01b03831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14611c4d57611b1c836001600160a01b0316611f04565b6040517f70a082310000000000000000000000000000000000000000000000000000000081526001600160a01b0385811660048301528416906370a0823190602401602060405180830381865afa158015611b7b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b9f9190612ab9565b9050611bb66001600160a01b038416338685611faa565b6040517f70a082310000000000000000000000000000000000000000000000000000000081526001600160a01b0385811660048301528291908516906370a0823190602401602060405180830381865afa158015611c18573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c3c9190612ab9565b611c4691906128cd565b905061144f565b348214611c86576040517f81de0bf300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b0384163014611caa57611caa6001600160a01b038416858461195f565b50349392505050565b600061144f8383611fe3565b600061085a825490565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16611d35576040517fe2517d3f0000000000000000000000000000000000000000000000000000000081526001600160a01b0382166004820152602481018390526044016117c7565b5050565b6040516001600160a01b0383811660248301526044820183905261092291859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505061200d565b6000828152602081815260408083206001600160a01b038516845290915281205460ff16611e4f576000838152602081815260408083206001600160a01b03861684529091529020805460ff19166001179055611e073390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a450600161085a565b50600061085a565b600061144f836001600160a01b038416612089565b6000828152602081815260408083206001600160a01b038516845290915281205460ff1615611e4f576000838152602081815260408083206001600160a01b0386168085529252808320805460ff1916905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a450600161085a565b600061144f836001600160a01b0384166120d0565b7fffffffffffffffffffffffff11111111111111111111111111111111111111126001600160a01b03821601611f66576040517f7f523fe800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b806001600160a01b03163b60000361195c576040517f7f523fe800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040516001600160a01b03848116602483015283811660448301526064820183905261094c9186918216906323b872dd90608401611d66565b6000826000018281548110611ffa57611ffa612ad2565b9060005260206000200154905092915050565b60006120226001600160a01b038416836121c3565b905080516000141580156120475750808060200190518101906120459190612b01565b155b15610922576040517f5274afe70000000000000000000000000000000000000000000000000000000081526001600160a01b03841660048201526024016117c7565b6000818152600183016020526040812054611e4f5750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561085a565b600081815260018301602052604081205480156121b95760006120f46001836128cd565b8554909150600090612108906001906128cd565b905080821461216d57600086600001828154811061212857612128612ad2565b906000526020600020015490508087600001848154811061214b5761214b612ad2565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061217e5761217e612b1e565b60019003818190600052602060002001600090559055856001016000868152602001908152602001600020600090556001935050505061085a565b600091505061085a565b606061144f8383600084600080856001600160a01b031684866040516121e99190612b4d565b60006040518083038185875af1925050503d8060008114612226576040519150601f19603f3d011682016040523d82523d6000602084013e61222b565b606091505b509150915061223b868383612245565b9695505050505050565b60608261225a57612255826122ba565b61144f565b815115801561227157506001600160a01b0384163b155b156122b3576040517f9996b3150000000000000000000000000000000000000000000000000000000081526001600160a01b03851660048201526024016117c7565b508061144f565b8051156122ca5780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006020828403121561230e57600080fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811461144f57600080fd5b60006020828403121561235057600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b60208101600583106123c1577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b91905290565b6001600160a01b038116811461195c57600080fd5b80356123e7816123c7565b919050565b600080604083850312156123ff57600080fd5b823561240a816123c7565b9150602083013561241a816123c7565b809150509250929050565b6000806040838503121561243857600080fd5b82359150602083013561241a816123c7565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051610120810167ffffffffffffffff8111828210171561249d5761249d61244a565b60405290565b604051610180810167ffffffffffffffff8111828210171561249d5761249d61244a565b600082601f8301126124d857600080fd5b813567ffffffffffffffff808211156124f3576124f361244a565b604051601f83017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f011681019082821181831017156125395761253961244a565b8160405283815286602085880101111561255257600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000806040838503121561258557600080fd5b823567ffffffffffffffff81111561259c57600080fd5b6125a8858286016124c7565b925050602083013561241a816123c7565b63ffffffff8116811461195c57600080fd5b80356123e7816125b9565b801515811461195c57600080fd5b80356123e7816125d6565b6000610120828403121561260257600080fd5b61260a612479565b612613836125cb565b8152612621602084016123dc565b6020820152612632604084016123dc565b6040820152612643606084016123dc565b6060820152612654608084016123dc565b608082015260a083013560a082015260c083013560c082015261267960e084016125e4565b60e0820152610100928301359281019290925250919050565b6000602082840312156126a457600080fd5b813567ffffffffffffffff8111156126bb57600080fd5b6126c7848285016124c7565b949350505050565b600080604083850312156126e257600080fd5b823567ffffffffffffffff8111156126f957600080fd5b612705858286016124c7565b95602094909401359450505050565b6000806040838503121561272757600080fd5b50508035926020909101359150565b815163ffffffff1681526101808101602083015161275c602084018263ffffffff169052565b50604083015161277760408401826001600160a01b03169052565b50606083015161279260608401826001600160a01b03169052565b5060808301516127ad60808401826001600160a01b03169052565b5060a08301516127c860a08401826001600160a01b03169052565b5060c083015160c083015260e083015160e0830152610100808401518184015250610120808401516127fd8285018215159052565b5050610140838101519083015261016092830151929091019190915290565b60006020828403121561282e57600080fd5b813561144f816123c7565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8082018082111561085a5761085a612839565b808202811582820484141761085a5761085a612839565b6000826128c8577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b8181038181111561085a5761085a612839565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361291157612911612839565b5060010190565b60005b8381101561293357818101518382015260200161291b565b50506000910152565b60e08152600088518060e084015261010061295d8282860160208e01612918565b63ffffffff9990991660208401526001600160a01b039788166040840152959096166060820152608081019390935260a0830191909152151560c0820152601f9091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0160190910192915050565b80516123e7816125b9565b80516123e7816123c7565b80516123e7816125d6565b60006101808284031215612a0057600080fd5b612a086124a3565b612a11836129cc565b8152612a1f602084016129cc565b6020820152612a30604084016129d7565b6040820152612a41606084016129d7565b6060820152612a52608084016129d7565b6080820152612a6360a084016129d7565b60a082015260c083015160c082015260e083015160e0820152610100808401518183015250610120612a968185016129e2565b908201526101408381015190820152610160928301519281019290925250919050565b600060208284031215612acb57600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600060208284031215612b1357600080fd5b815161144f816125d6565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b60008251612b5f818460208701612918565b919091019291505056fea26469706673582212207d038d8dfad42c58e5149b646b9e05914f990dd941b51e06388a96d1ed46308264736f6c63430008140033","runtime-code":"0x60806040526004361061026a5760003560e01c80639010d07c11610153578063add98c70116100cb578063ca15c8731161007f578063d547741f11610064578063d547741f146107a1578063dcf844a7146107c1578063e00a83e0146107ee57600080fd5b8063ca15c8731461074d578063ccc574901461076d57600080fd5b8063b13aa2d6116100b0578063b13aa2d6146106f6578063b250fe6b14610716578063bf333f2c1461073657600080fd5b8063add98c70146106c0578063affed0e0146106e057600080fd5b8063a217fddf11610122578063a5bbe22b11610107578063a5bbe22b1461047f578063aa9641ab14610673578063ac11fb1a1461069357600080fd5b8063a217fddf1461062a578063a3ec191a1461063f57600080fd5b80639010d07c146104f857806391ad50391461053057806391d14854146105b2578063926d7d7f146105f657600080fd5b806341fcb612116101e65780635eb7d946116101b55780638379a24f1161019a5780638379a24f14610495578063886d36ff146104c55780638f0d6f17146104e557600080fd5b80635eb7d9461461045f578063820688d51461047f57600080fd5b806341fcb612146103e2578063458516941461040257806358f85880146104155780635960ccf21461042b57600080fd5b80630f5f6ed71161023d578063248a9ca311610222578063248a9ca3146103725780632f2ff15d146103a257806336568abe146103c257600080fd5b80630f5f6ed714610345578063190da5951461035b57600080fd5b806301ffc9a71461026f57806303ed0ee5146102a4578063051287bc146102e657806306f333f214610323575b600080fd5b34801561027b57600080fd5b5061028f61028a3660046122fc565b610804565b60405190151581526020015b60405180910390f35b3480156102b057600080fd5b506102d87f043c983c49d46f0e102151eaf8085d4a2e6571d5df2d47b013f39bddfd4a639d81565b60405190815260200161029b565b3480156102f257600080fd5b5061031661030136600461233e565b60056020526000908152604090205460ff1681565b60405161029b9190612386565b34801561032f57600080fd5b5061034361033e3660046123ec565b610860565b005b34801561035157600080fd5b506102d861271081565b34801561036757600080fd5b506102d862093a8081565b34801561037e57600080fd5b506102d861038d36600461233e565b60009081526020819052604090206001015490565b3480156103ae57600080fd5b506103436103bd366004612425565b610927565b3480156103ce57600080fd5b506103436103dd366004612425565b610952565b3480156103ee57600080fd5b506103436103fd366004612572565b61099e565b6103436104103660046125ef565b610bd7565b34801561042157600080fd5b506102d860025481565b34801561043757600080fd5b506102d87fdb9556138406326f00296e13ea2ad7db24ba82381212d816b1a40c23b466b32781565b34801561046b57600080fd5b5061034361047a366004612692565b610ee5565b34801561048b57600080fd5b506102d861070881565b3480156104a157600080fd5b5061028f6104b036600461233e565b60076020526000908152604090205460ff1681565b3480156104d157600080fd5b506103436104e03660046126cf565b6110bd565b6103436104f3366004612692565b6111f0565b34801561050457600080fd5b50610518610513366004612714565b611437565b6040516001600160a01b03909116815260200161029b565b34801561053c57600080fd5b5061058661054b36600461233e565b6006602052600090815260409020546bffffffffffffffffffffffff8116906c0100000000000000000000000090046001600160a01b031682565b604080516bffffffffffffffffffffffff90931683526001600160a01b0390911660208301520161029b565b3480156105be57600080fd5b5061028f6105cd366004612425565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b34801561060257600080fd5b506102d87fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc481565b34801561063657600080fd5b506102d8600081565b34801561064b57600080fd5b506102d87f000000000000000000000000000000000000000000000000000000000000000081565b34801561067f57600080fd5b5061028f61068e366004612425565b611456565b34801561069f57600080fd5b506106b36106ae366004612692565b611559565b60405161029b9190612736565b3480156106cc57600080fd5b506103436106db36600461233e565b6115cc565b3480156106ec57600080fd5b506102d860085481565b34801561070257600080fd5b5061034361071136600461233e565b611735565b34801561072257600080fd5b5061034361073136600461233e565b611817565b34801561074257600080fd5b506102d8620f424081565b34801561075957600080fd5b506102d861076836600461233e565b61187f565b34801561077957600080fd5b506102d87f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5581565b3480156107ad57600080fd5b506103436107bc366004612425565b611896565b3480156107cd57600080fd5b506102d86107dc36600461281c565b60036020526000908152604090205481565b3480156107fa57600080fd5b506102d860045481565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f5a05180f00000000000000000000000000000000000000000000000000000000148061085a575061085a826118bb565b92915050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5561088a81611952565b6001600160a01b038316600090815260036020526040812054908190036108b15750505050565b6001600160a01b0384166000818152600360205260408120556108d590848361195f565b604080516001600160a01b038087168252851660208201529081018290527f244e51bc38c1452fa8aaf487bcb4bca36c2baa3a5fbdb776b1eabd8dc6d277cd9060600160405180910390a1505b505050565b60008281526020819052604090206001015461094281611952565b61094c8383611a82565b50505050565b6001600160a01b0381163314610994576040517f6697b23200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6109228282611ab7565b7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc46109c881611952565b8251602084012060006109da85611559565b9050600260008381526005602052604090205460ff166004811115610a0157610a01612357565b14610a38576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000828152600660209081526040918290208251808401909352546bffffffffffffffffffffffff811683526c0100000000000000000000000090046001600160a01b03169082018190523314610abb576040517f4af43a9000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80516107089042036bffffffffffffffffffffffff1611610b08576040517f1992d0bd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000838152600560205260409020805460ff1916600317905561010082015115610b645761010082015160808301516001600160a01b031660009081526003602052604081208054909190610b5e908490612868565b90915550505b608082015160c0830151610b826001600160a01b038316888361195f565b604080516001600160a01b03848116825260208201849052891691339188917f582211c35a2139ac3bbaac74663c6a1f56c6cbb658b41fe11fd45a82074ac67891015b60405180910390a45050505050505050565b46816000015163ffffffff1603610c1a576040517f7029fdf900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60a08101511580610c2d575060c0810151155b15610c64576040517fe38820c800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60608101516001600160a01b03161580610c89575060808101516001600160a01b0316155b15610cc0576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610ccc61070842612868565b8161010001511015610d0a576040517f04b7fcc800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000610d1f3083606001518460a00151611ae4565b90506000806002541115610d4c57620f424060025483610d3f919061287b565b610d499190612892565b90505b610d5681836128cd565b915060006040518061018001604052804663ffffffff168152602001856000015163ffffffff16815260200185602001516001600160a01b0316815260200185604001516001600160a01b0316815260200185606001516001600160a01b0316815260200185608001516001600160a01b031681526020018481526020018560c0015181526020018381526020018560e0015115158152602001856101000151815260200160086000815480929190610e0e906128e0565b909155509052604051610e249190602001612736565b604080518083037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0018152828252805160208083019190912060008181526005835293909320805460ff191660011790558701518751606089015160808a015160c08b015160e08c015195985095966001600160a01b039094169587957f120ea0364f36cdac7983bcfdd55270ca09d7f9b314a2ebc425a3b01ab1d6403a95610ed6958b959094909390928e9261293c565b60405180910390a35050505050565b805160208201206000610ef783611559565b3360009081527fd2043bf65931af3dbecf60d0db8f40e4160406d7beb00522f4200cf4944a1eb8602052604090205490915060ff1615610f74578061014001514211610f6f576040517fe15ff9ea00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610fc0565b62093a80816101400151610f889190612868565b4211610fc0576040517fe15ff9ea00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600160008381526005602052604090205460ff166004811115610fe557610fe5612357565b1461101c576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600082815260056020526040808220805460ff19166004179055820151608083015161010084015160c0850151929391926110579190612868565b905061106d6001600160a01b038316848361195f565b604080516001600160a01b0384811682526020820184905285169187917fb4c55c0c9bc613519b920e88748090150b890a875d307f21bea7d4fb2e8bc958910160405180910390a3505050505050565b7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc46110e781611952565b82516020840120600160008281526005602052604090205460ff16600481111561111357611113612357565b1461114a576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008181526005602090815260408083208054600260ff19909116179055805180820182526bffffffffffffffffffffffff4281168252338285018181528787526006865295849020925195516001600160a01b03166c0100000000000000000000000002959091169490941790555185815283917f4ac8af8a2cd87193d64dfc7a3b8d9923b714ec528b18725d080aa1299be0c5e4910160405180910390a350505050565b7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc461121a81611952565b81516020830120600061122c84611559565b90504663ffffffff16816020015163ffffffff1614611277576040517f7029fdf900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8061014001514211156112b6576040517f559895a300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008281526007602052604090205460ff16156112ff576040517fbef7bb7d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000828152600760205260409020805460ff19166001179055606081015160a082015160e083015160045461012085015161134857506000611342848484611ae4565b506113b9565b7fffffffffffffffffffffffff11111111111111111111111111111111111111126001600160a01b0384160161138c5761134284846113878486612868565b611ae4565b611397848484611ae4565b506113b78473eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee83611ae4565b505b845160808087015160a08089015160c0808b015160e08c01516040805163ffffffff90991689526001600160a01b0396871660208a0152938616938801939093526060870152938501528301849052861691339189917ff8ae392d784b1ea5e8881bfa586d81abf07ef4f1e2fc75f7fe51c90f05199a5c9101610bc5565b600082815260016020526040812061144f9083611cb3565b9392505050565b6000600260008481526005602052604090205460ff16600481111561147d5761147d612357565b146114b4576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000838152600660209081526040918290208251808401909352546bffffffffffffffffffffffff811683526001600160a01b036c01000000000000000000000000909104811691830182905284161461153a576040517f4af43a9000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80516107089042036bffffffffffffffffffffffff1611949350505050565b604080516101808101825260008082526020808301829052928201819052606082018190526080820181905260a0820181905260c0820181905260e082018190526101008201819052610120820181905261014082018190526101608201528251909161085a91840181019084016129ed565b7f043c983c49d46f0e102151eaf8085d4a2e6571d5df2d47b013f39bddfd4a639d6115f681611952565b600260008381526005602052604090205460ff16600481111561161b5761161b612357565b14611652576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000828152600660209081526040918290208251808401909352546bffffffffffffffffffffffff8082168085526c010000000000000000000000009092046001600160a01b031693909201929092526107089142031611156116e1576040517f3e908aac00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000828152600560209081526040808320805460ff19166001179055600690915280822082905551339184917f0695cf1d39b3055dcd0fe02d8b47eaf0d5a13e1996de925de59d0ef9b7f7fad49190a35050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5561175f81611952565b6127108211156117d0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f6e657746656552617465203e206d61780000000000000000000000000000000060448201526064015b60405180910390fd5b600280549083905560408051828152602081018590527f14914da2bf76024616fbe1859783fcd4dbddcb179b1f3a854949fbf920dcb95791015b60405180910390a1505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5561184181611952565b600480549083905560408051828152602081018590527f5cf09b12f3f56b4c564d51b25b40360af6d795198adb61ae0806a36c294323fa910161180a565b600081815260016020526040812061085a90611cbf565b6000828152602081905260409020600101546118b181611952565b61094c8383611ab7565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061085a57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff0000000000000000000000000000000000000000000000000000000083161461085a565b61195c8133611cc9565b50565b306001600160a01b0383160361197457505050565b8060000361198157505050565b7fffffffffffffffffffffffff11111111111111111111111111111111111111126001600160a01b03841601611a6e576000826001600160a01b03168260405160006040518083038185875af1925050503d80600081146119fe576040519150601f19603f3d011682016040523d82523d6000602084013e611a03565b606091505b505090508061094c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f455448207472616e73666572206661696c65640000000000000000000000000060448201526064016117c7565b6109226001600160a01b0384168383611d39565b600080611a8f8484611dad565b9050801561144f576000848152600160205260409020611aaf9084611e57565b509392505050565b600080611ac48484611e6c565b9050801561144f576000848152600160205260409020611aaf9084611eef565b60006001600160a01b03831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14611c4d57611b1c836001600160a01b0316611f04565b6040517f70a082310000000000000000000000000000000000000000000000000000000081526001600160a01b0385811660048301528416906370a0823190602401602060405180830381865afa158015611b7b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b9f9190612ab9565b9050611bb66001600160a01b038416338685611faa565b6040517f70a082310000000000000000000000000000000000000000000000000000000081526001600160a01b0385811660048301528291908516906370a0823190602401602060405180830381865afa158015611c18573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c3c9190612ab9565b611c4691906128cd565b905061144f565b348214611c86576040517f81de0bf300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b0384163014611caa57611caa6001600160a01b038416858461195f565b50349392505050565b600061144f8383611fe3565b600061085a825490565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16611d35576040517fe2517d3f0000000000000000000000000000000000000000000000000000000081526001600160a01b0382166004820152602481018390526044016117c7565b5050565b6040516001600160a01b0383811660248301526044820183905261092291859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505061200d565b6000828152602081815260408083206001600160a01b038516845290915281205460ff16611e4f576000838152602081815260408083206001600160a01b03861684529091529020805460ff19166001179055611e073390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a450600161085a565b50600061085a565b600061144f836001600160a01b038416612089565b6000828152602081815260408083206001600160a01b038516845290915281205460ff1615611e4f576000838152602081815260408083206001600160a01b0386168085529252808320805460ff1916905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a450600161085a565b600061144f836001600160a01b0384166120d0565b7fffffffffffffffffffffffff11111111111111111111111111111111111111126001600160a01b03821601611f66576040517f7f523fe800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b806001600160a01b03163b60000361195c576040517f7f523fe800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040516001600160a01b03848116602483015283811660448301526064820183905261094c9186918216906323b872dd90608401611d66565b6000826000018281548110611ffa57611ffa612ad2565b9060005260206000200154905092915050565b60006120226001600160a01b038416836121c3565b905080516000141580156120475750808060200190518101906120459190612b01565b155b15610922576040517f5274afe70000000000000000000000000000000000000000000000000000000081526001600160a01b03841660048201526024016117c7565b6000818152600183016020526040812054611e4f5750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561085a565b600081815260018301602052604081205480156121b95760006120f46001836128cd565b8554909150600090612108906001906128cd565b905080821461216d57600086600001828154811061212857612128612ad2565b906000526020600020015490508087600001848154811061214b5761214b612ad2565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061217e5761217e612b1e565b60019003818190600052602060002001600090559055856001016000868152602001908152602001600020600090556001935050505061085a565b600091505061085a565b606061144f8383600084600080856001600160a01b031684866040516121e99190612b4d565b60006040518083038185875af1925050503d8060008114612226576040519150601f19603f3d011682016040523d82523d6000602084013e61222b565b606091505b509150915061223b868383612245565b9695505050505050565b60608261225a57612255826122ba565b61144f565b815115801561227157506001600160a01b0384163b155b156122b3576040517f9996b3150000000000000000000000000000000000000000000000000000000081526001600160a01b03851660048201526024016117c7565b508061144f565b8051156122ca5780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006020828403121561230e57600080fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811461144f57600080fd5b60006020828403121561235057600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b60208101600583106123c1577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b91905290565b6001600160a01b038116811461195c57600080fd5b80356123e7816123c7565b919050565b600080604083850312156123ff57600080fd5b823561240a816123c7565b9150602083013561241a816123c7565b809150509250929050565b6000806040838503121561243857600080fd5b82359150602083013561241a816123c7565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051610120810167ffffffffffffffff8111828210171561249d5761249d61244a565b60405290565b604051610180810167ffffffffffffffff8111828210171561249d5761249d61244a565b600082601f8301126124d857600080fd5b813567ffffffffffffffff808211156124f3576124f361244a565b604051601f83017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f011681019082821181831017156125395761253961244a565b8160405283815286602085880101111561255257600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000806040838503121561258557600080fd5b823567ffffffffffffffff81111561259c57600080fd5b6125a8858286016124c7565b925050602083013561241a816123c7565b63ffffffff8116811461195c57600080fd5b80356123e7816125b9565b801515811461195c57600080fd5b80356123e7816125d6565b6000610120828403121561260257600080fd5b61260a612479565b612613836125cb565b8152612621602084016123dc565b6020820152612632604084016123dc565b6040820152612643606084016123dc565b6060820152612654608084016123dc565b608082015260a083013560a082015260c083013560c082015261267960e084016125e4565b60e0820152610100928301359281019290925250919050565b6000602082840312156126a457600080fd5b813567ffffffffffffffff8111156126bb57600080fd5b6126c7848285016124c7565b949350505050565b600080604083850312156126e257600080fd5b823567ffffffffffffffff8111156126f957600080fd5b612705858286016124c7565b95602094909401359450505050565b6000806040838503121561272757600080fd5b50508035926020909101359150565b815163ffffffff1681526101808101602083015161275c602084018263ffffffff169052565b50604083015161277760408401826001600160a01b03169052565b50606083015161279260608401826001600160a01b03169052565b5060808301516127ad60808401826001600160a01b03169052565b5060a08301516127c860a08401826001600160a01b03169052565b5060c083015160c083015260e083015160e0830152610100808401518184015250610120808401516127fd8285018215159052565b5050610140838101519083015261016092830151929091019190915290565b60006020828403121561282e57600080fd5b813561144f816123c7565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8082018082111561085a5761085a612839565b808202811582820484141761085a5761085a612839565b6000826128c8577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b8181038181111561085a5761085a612839565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361291157612911612839565b5060010190565b60005b8381101561293357818101518382015260200161291b565b50506000910152565b60e08152600088518060e084015261010061295d8282860160208e01612918565b63ffffffff9990991660208401526001600160a01b039788166040840152959096166060820152608081019390935260a0830191909152151560c0820152601f9091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0160190910192915050565b80516123e7816125b9565b80516123e7816123c7565b80516123e7816125d6565b60006101808284031215612a0057600080fd5b612a086124a3565b612a11836129cc565b8152612a1f602084016129cc565b6020820152612a30604084016129d7565b6040820152612a41606084016129d7565b6060820152612a52608084016129d7565b6080820152612a6360a084016129d7565b60a082015260c083015160c082015260e083015160e0820152610100808401518183015250610120612a968185016129e2565b908201526101408381015190820152610160928301519281019290925250919050565b600060208284031215612acb57600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600060208284031215612b1357600080fd5b815161144f816125d6565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b60008251612b5f818460208701612918565b919091019291505056fea26469706673582212207d038d8dfad42c58e5149b646b9e05914f990dd941b51e06388a96d1ed46308264736f6c63430008140033","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.20 ^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 pure 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/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// lib/openzeppelin-contracts/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 ERC-165 detection.\n */\ninterface IAccessControl {\n /**\n * @dev The `account` is missing a role.\n */\n error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);\n\n /**\n * @dev The caller of a function is not the expected one.\n *\n * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.\n */\n error AccessControlBadConfirmation();\n\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted 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// lib/openzeppelin-contracts/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 ERC-20 standard as defined in the ERC.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the value of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the value of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 value) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n * caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 value) external returns (bool);\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\n * allowance mechanism. `value` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n\n// lib/openzeppelin-contracts/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 ERC-20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[ERC-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC-20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n *\n * ==== Security Considerations\n *\n * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\n * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\n * considered as an intention to spend the allowance in any specific way. The second is that because permits have\n * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\n * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\n * generally recommended is:\n *\n * ```solidity\n * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\n * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\n * doThing(..., value);\n * }\n *\n * function doThing(..., uint256 value) public {\n * token.safeTransferFrom(msg.sender, address(this), value);\n * ...\n * }\n * ```\n *\n * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\n * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\n * {SafeERC20-safeTransferFrom}).\n *\n * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\n * contracts should have entry points that don't rely on permit.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also 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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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 ERC-165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[ERC].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n\n// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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 ERC-165 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// lib/openzeppelin-contracts/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 ERC-165 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// lib/openzeppelin-contracts/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 ERC-20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n /**\n * @dev An operation with an ERC-20 token failed.\n */\n error SafeERC20FailedOperation(address token);\n\n /**\n * @dev Indicates a failed `decreaseAllowance` request.\n */\n error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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/FastBridge.sol\n\ncontract FastBridge is IFastBridge, Admin {\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 enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeStatus) public bridgeStatuses;\n /// @notice Proof of relayed bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeProof) public bridgeProofs;\n /// @notice Whether bridge has been relayed on destination chain\n mapping(bytes32 =\u003e bool) public bridgeRelays;\n\n /// @dev to prevent replays\n uint256 public nonce;\n // @dev 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 /// @notice Pulls a requested token from the user to the requested recipient.\n /// @dev Be careful of re-entrancy issues when msg.value \u003e 0 and recipient != address(this)\n function _pullToken(address recipient, address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token != UniversalTokenLib.ETH_ADDRESS) {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(recipient);\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, recipient, amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(recipient) - amountPulled;\n } else {\n // Otherwise, we need to check that ETH amount matches msg.value\n if (amount != msg.value) revert MsgValueIncorrect();\n // Transfer value to recipient if not this address\n if (recipient != address(this)) token.universalTransfer(recipient, amount);\n // We will forward msg.value in the external call later, if recipient is not this contract\n amountPulled = msg.value;\n }\n }\n\n /// @inheritdoc IFastBridge\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n // check bridge params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\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\n // transfer tokens to bridge contract\n // @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(address(this), 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 BridgeTransaction({\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 sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n\n // check haven't exceeded deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n\n // mark bridge transaction as relayed\n if (bridgeRelays[transactionId]) revert TransactionRelayed();\n bridgeRelays[transactionId] = true;\n\n // transfer tokens to recipient on destination chain and gas rebate if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n uint256 rebate = chainGasAmount;\n if (!transaction.sendChainGas) {\n // forward erc20\n rebate = 0;\n _pullToken(to, token, amount);\n } else if (token == UniversalTokenLib.ETH_ADDRESS) {\n // lump in gas rebate into amount in native gas token\n _pullToken(to, token, amount + rebate);\n } else {\n // forward erc20 then forward gas rebate in native gas token\n _pullToken(to, token, amount);\n _pullToken(to, UniversalTokenLib.ETH_ADDRESS, rebate);\n }\n\n emit BridgeRelayed(\n transactionId,\n msg.sender,\n to,\n transaction.originChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n rebate\n );\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n // update bridge tx status given proof provided\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = BridgeStatus.RELAYER_PROVED;\n bridgeProofs[transactionId] = BridgeProof({timestamp: uint96(block.timestamp), relayer: msg.sender}); // overflow ok\n\n emit BridgeProofProvided(transactionId, msg.sender, destTxHash);\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint96(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint96).max but\n /// proof.timestamp \u003c type(uint96).max via unchecked statement\n /// @param proof The bridge proof\n /// @return delta Time delta since proof submitted\n function _timeSince(BridgeProof memory proof) internal view returns (uint256 delta) {\n unchecked {\n delta = uint96(block.timestamp) - proof.timestamp;\n }\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != relayer) revert SenderIncorrect();\n return _timeSince(proof) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != msg.sender) revert SenderIncorrect();\n if (_timeSince(proof) \u003c= DISPUTE_PERIOD) revert DisputePeriodNotPassed();\n\n bridgeStatuses[transactionId] = 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, msg.sender, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeProofs[transactionId]) \u003e DISPUTE_PERIOD) revert DisputePeriodPassed();\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n delete bridgeProofs[transactionId];\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 BridgeTransaction memory transaction = getBridgeTransaction(request);\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 // set status to refunded if still in requested state\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = 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","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","compilerOptions":"--combined-json bin,bin-runtime,srcmap,srcmap-runtime,abi,userdoc,devdoc,metadata,hashes --optimize --optimize-runs 10000 --allow-paths ., ./, ../ --evm-version=istanbul","srcMap":"58205:11304:0:-:0;;;59380:85;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;59414:6;57196:38;46368:4;59414:6;57196:10;:38::i;:::-;-1:-1:-1;;59446:12:0::1;59432:26;::::0;-1:-1:-1;58205:11304:0;;55681:257;55767:4;;55798:31;55815:4;55821:7;55798:16;:31::i;:::-;55783:46;;55843:7;55839:69;;;55866:18;;;;:12;:18;;;;;:31;;55889:7;55866:22;:31::i;:::-;;55839:69;55924:7;-1:-1:-1;55681:257:0;;;;;:::o;50315:316::-;50392:4;47090:12;;;;;;;;;;;-1:-1:-1;;;;;47090:29:0;;;;;;;;;;;;50408:217;;50451:6;:12;;;;;;;;;;;-1:-1:-1;;;;;50451:29:0;;;;;;;;;:36;;-1:-1:-1;;50451:36:0;50483:4;50451:36;;;50533:12;22406:10;;22327:96;50533:12;-1:-1:-1;;;;;50506:40:0;50524:7;-1:-1:-1;;;;;50506:40:0;50518:4;50506:40;;;;;;;;;;-1:-1:-1;50567:4:0;50560:11;;50408:217;-1:-1:-1;50609:5:0;50602:12;;31852:150;31922:4;31945:50;31950:3;-1:-1:-1;;;;;31970:23:0;;25840:4;27896:21;;;:14;;;:21;;;;;;25856:321;;-1:-1:-1;25898:23:0;;;;;;;;:11;:23;;;;;;;;;;;;;26080:18;;26056:21;;;:14;;;:21;;;;;;:42;;;;26112: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;58205:11304:0;;;;;;;;;;;;","srcMapRuntime":"58205:11304:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;54341:212;;;;;;;;;;-1:-1:-1;54341:212:0;;;;;:::i;:::-;;:::i;:::-;;;612:14:1;;605:22;587:41;;575:2;560:18;54341:212:0;;;;;;;;56571:60;;;;;;;;;;;;56608:23;56571:60;;;;;785:25:1;;;773:2;758:18;56571:60:0;639:177:1;58932:54:0;;;;;;;;;;-1:-1:-1;58932:54:0;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;:::i;57543:359::-;;;;;;;;;;-1:-1:-1;57543:359:0;;;;;:::i;:::-;;:::i;:::-;;56753:45;;;;;;;;;;;;56792:6;56753:45;;58530;;;;;;;;;;;;58569:6;58530:45;;47946:120;;;;;;;;;;-1:-1:-1;47946:120:0;;;;;:::i;:::-;48011:7;48037:12;;;;;;;;;;:22;;;;47946:120;48362:136;;;;;;;;;;-1:-1:-1;48362:136:0;;;;;:::i;:::-;;:::i;49464:245::-;;;;;;;;;;-1:-1:-1;49464:245:0;;;;;:::i;:::-;;:::i;66607:1146::-;;;;;;;;;;-1:-1:-1;66607:1146:0;;;;;:::i;:::-;;:::i;61065:2114::-;;;;;;:::i;:::-;;:::i;56915:30::-;;;;;;;;;;;;;;;;56499:66;;;;;;;;;;;;56539:26;56499:66;;68354:1153;;;;;;;;;;-1:-1:-1;68354:1153:0;;;;;:::i;:::-;;:::i;58662:56::-;;;;;;;;;;;;58708:10;58662:56;;59177:44;;;;;;;;;;-1:-1:-1;59177:44:0;;;;;:::i;:::-;;;;;;;;;;;;;;;;64973:567;;;;;;;;;;-1:-1:-1;64973:567:0;;;;;:::i;:::-;;:::i;63217:1718::-;;;;;;:::i;:::-;;:::i;55138:142::-;;;;;;;;;;-1:-1:-1;55138:142:0;;;;;:::i;:::-;;:::i;:::-;;;-1:-1:-1;;;;;7391:55:1;;;7373:74;;7361:2;7346:18;55138:142:0;7227:226:1;59051:51:0;;;;;;;;;;-1:-1:-1;59051:51:0;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;59051:51:0;;;;;;;7660:26:1;7648:39;;;7630:58;;-1:-1:-1;;;;;7724:55:1;;;7719:2;7704:18;;7697:83;7603:18;59051:51:0;7458:328:1;46990:136:0;;;;;;;;;;-1:-1:-1;46990:136:0;;;;;:::i;:::-;47067:4;47090:12;;;;;;;;;;;-1:-1:-1;;;;;47090:29:0;;;;;;;;;;;;;;;46990:136;56429:64;;;;;;;;;;;;56468:25;56429:64;;46323:49;;;;;;;;;;-1:-1:-1;46323:49:0;46368:4;46323:49;;59337:36;;;;;;;;;;;;;;;66196:373;;;;;;;;;;-1:-1:-1;66196:373:0;;;;;:::i;:::-;;:::i;60864:163::-;;;;;;;;;;-1:-1:-1;60864:163:0;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;67791:525::-;;;;;;;;;;-1:-1:-1;67791:525:0;;;;;:::i;:::-;;:::i;59260:20::-;;;;;;;;;;;;;;;;57247:290;;;;;;;;;;-1:-1:-1;57247:290:0;;;;;:::i;:::-;;:::i;57908:264::-;;;;;;;;;;-1:-1:-1;57908:264:0;;;;;:::i;:::-;;:::i;56710:37::-;;;;;;;;;;;;56744:3;56710:37;;55448:131;;;;;;;;;;-1:-1:-1;55448:131:0;;;;;:::i;:::-;;:::i;56637:66::-;;;;;;;;;;;;56677:26;56637:66;;48778:138;;;;;;;;;;-1:-1:-1;48778:138:0;;;;;:::i;:::-;;:::i;57001:47::-;;;;;;;;;;-1:-1:-1;57001:47:0;;;;;:::i;:::-;;;;;;;;;;;;;;57122:29;;;;;;;;;;;;;;;;54341:212;54426:4;54449:57;;;54464:42;54449:57;;:97;;;54510:36;54534:11;54510:23;:36::i;:::-;54442:104;54341:212;-1:-1:-1;;54341:212:0:o;57543:359::-;56677:26;46600:16;46611:4;46600:10;:16::i;:::-;-1:-1:-1;;;;;57667:19:0;::::1;57647:17;57667:19:::0;;;:12:::1;:19;::::0;;;;;;57700:14;;;57696:27:::1;;57716:7;57543:359:::0;;;:::o;57696:27::-:1;-1:-1:-1::0;;;;;57764:19:0;::::1;57786:1;57764:19:::0;;;:12:::1;:19;::::0;;;;:23;57797:45:::1;::::0;57821:9;57832;57797:23:::1;:45::i;:::-;57857:38;::::0;;-1:-1:-1;;;;;9986:15:1;;;9968:34;;10038:15;;10033:2;10018:18;;10011:43;10070:18;;;10063:34;;;57857:38:0::1;::::0;9895:2:1;9880:18;57857:38:0::1;;;;;;;57637:265;46626:1;57543:359:::0;;;:::o;48362:136::-;48011:7;48037:12;;;;;;;;;;:22;;;46600:16;46611:4;46600:10;:16::i;:::-;48466:25:::1;48477:4;48483:7;48466:10;:25::i;:::-;;48362:136:::0;;;:::o;49464:245::-;-1:-1:-1;;;;;49557:34:0;;22406:10;49557:34;49553:102;;49614:30;;;;;;;;;;;;;;49553:102;49665:37;49677:4;49683:18;49665:11;:37::i;66607:1146::-;56468:25;46600:16;46611:4;46600:10;:16::i;:::-;66722:18;;::::1;::::0;::::1;::::0;66698:21:::1;66789:29;66732:7:::0;66789:20:::1;:29::i;:::-;66750:68:::0;-1:-1:-1;66936:27:0::1;66903:29;::::0;;;:14:::1;:29;::::0;;;;;::::1;;:60;::::0;::::1;;;;;;:::i;:::-;;66899:90;;66972:17;;;;;;;;;;;;;;66899:90;67000:24;67027:27:::0;;;:12:::1;:27;::::0;;;;;;;;67000:54;;;;::::1;::::0;;;;::::1;::::0;::::1;::::0;;;;::::1;-1:-1:-1::0;;;;;67000:54:0::1;::::0;;::::1;::::0;;;67085:10:::1;67068:27;67064:57;;67104:17;;;;;;;;;;;;;;67064:57;66126:15:::0;;58424:10:::1;::::0;66107:15;66100:41;66092:49;;67135:35:::1;67131:72;;67179:24;;;;;;;;;;;;;;67131:72;67214:29;::::0;;;:14:::1;:29;::::0;;;;:60;;-1:-1:-1;;67214:60:0::1;67246:28;67214:60;::::0;;67349:27:::1;::::0;::::1;::::0;:31;67345:105:::1;;67423:27;::::0;::::1;::::0;67395:23:::1;::::0;::::1;::::0;-1:-1:-1;;;;;67382:37:0::1;;::::0;;;:12:::1;:37;::::0;;;;:68;;:37;;;:68:::1;::::0;67423:27;;67382:68:::1;:::i;:::-;::::0;;;-1:-1:-1;;67345:105:0::1;67545:23;::::0;::::1;::::0;67595:24:::1;::::0;::::1;::::0;67629:35:::1;-1:-1:-1::0;;;;;67629:23:0;::::1;67653:2:::0;67595:24;67629:23:::1;:35::i;:::-;67680:66;::::0;;-1:-1:-1;;;;;10619:55:1;;;10601:74;;10706:2;10691:18;;10684:34;;;67680:66:0;::::1;::::0;67716:10:::1;::::0;67701:13;;67680:66:::1;::::0;10574:18:1;67680:66:0::1;;;;;;;;66688:1065;;;;;66607:1146:::0;;;:::o;61065:2114::-;61192:13;61171:6;:17;;;:34;;;61167:63;;61214:16;;;;;;;;;;;;;;61167:63;61244:19;;;;:24;;:50;;-1:-1:-1;61272:17:0;;;;:22;61244:50;61240:80;;;61303:17;;;;;;;;;;;;;;61240:80;61334:18;;;;-1:-1:-1;;;;;61334:32:0;;;:66;;-1:-1:-1;61370:16:0;;;;-1:-1:-1;;;;;61370:30:0;;61334:66;61330:92;;;61409:13;;;;;;;;;;;;;;61330:92;61454:37;58708:10;61454:15;:37;:::i;:::-;61436:6;:15;;;:55;61432:86;;;61500:18;;;;;;;;;;;;;;61432:86;61653:20;61676:66;61695:4;61702:6;:18;;;61722:6;:19;;;61676:10;:66::i;:::-;61653:89;;61810:23;61865:1;61847:15;;:19;61843:85;;;56744:3;61902:15;;61887:12;:30;;;;:::i;:::-;61886:42;;;;:::i;:::-;61868:60;;61843:85;61938:31;61954:15;61938:31;;:::i;:::-;;;62082:20;62129:618;;;;;;;;62187:13;62129:618;;;;;;62232:6;:17;;;62129:618;;;;;;62281:6;:13;;;-1:-1:-1;;;;;62129:618:0;;;;;62327:6;:9;;;-1:-1:-1;;;;;62129:618:0;;;;;62367:6;:18;;;-1:-1:-1;;;;;62129:618:0;;;;;62414:6;:16;;;-1:-1:-1;;;;;62129:618:0;;;;;62462:12;62129:618;;;;62504:6;:17;;;62129:618;;;;62556:15;62129:618;;;;62603:6;:19;;;62129:618;;;;;;62650:6;:15;;;62129:618;;;;62690:5;;:7;;;;;;;;;:::i;:::-;;;;-1:-1:-1;62129:618:0;;62105:652;;;;;;;;:::i;:::-;;;;;;;;;;;;;;62791:18;;62105:652;62791:18;;;;;;;62767:21;62819:29;;;:14;:29;;;;;;:54;;-1:-1:-1;;62819:54:0;62851:22;62819:54;;;62945:13;;;62993:17;;63024:18;;;;63056:16;;;;63112:17;;;;63143:19;;;;62105:652;;-1:-1:-1;62791:18:0;;-1:-1:-1;;;;;62889:283:0;;;;62791:18;;62889:283;;;;62105:652;;62993:17;;63024:18;;63056:16;;63086:12;;62889:283;:::i;:::-;;;;;;;;61126:2053;;;;61065:2114;:::o;68354:1153::-;68435:18;;;;;;68411:21;68502:29;68445:7;68502:20;:29::i;:::-;68569:10;47067:4;47090:29;;;:12;;:29;:12;:29;;;68463:68;;-1:-1:-1;47090:29:0;;68542:382;;;68677:11;:20;;;68658:15;:39;68654:73;;68706:21;;;;;;;;;;;;;;68654:73;68542:382;;;58569:6;68848:11;:20;;;:35;;;;:::i;:::-;68829:15;:54;68825:88;;68892:21;;;;;;;;;;;;;;68825:88;69033:22;69000:29;;;;:14;:29;;;;;;;;:55;;;;;;;;:::i;:::-;;68996:85;;69064:17;;;;;;;;;;;;;;68996:85;69091:29;;;;:14;:29;;;;;;:53;;-1:-1:-1;;69091:53:0;69123:21;69091:53;;;69230:24;;;69280:23;;;;69357:27;;;;69330:24;;;;69230;;69280:23;;69330:54;;69357:27;69330:54;:::i;:::-;69313:71;-1:-1:-1;69394:35:0;-1:-1:-1;;;;;69394:23:0;;69418:2;69313:71;69394:23;:35::i;:::-;69445:55;;;-1:-1:-1;;;;;10619:55:1;;;10601:74;;10706:2;10691:18;;10684:34;;;69445:55:0;;;69467:13;;69445:55;;10574:18:1;69445:55:0;;;;;;;68401:1106;;;;;68354:1153;:::o;64973:567::-;56468:25;46600:16;46611:4;46600:10;:16::i;:::-;65096:18;;::::1;::::0;::::1;::::0;65217:22:::1;65184:29;::::0;;;:14:::1;:29;::::0;;;;;::::1;;:55;::::0;::::1;;;;;;:::i;:::-;;65180:85;;65248:17;;;;;;;;;;;;;;65180:85;65275:29;::::0;;;:14:::1;:29;::::0;;;;;;;:59;;65307:27:::1;-1:-1:-1::0;;65275:59:0;;::::1;;::::0;;65374:70;;;;::::1;::::0;;::::1;65405:15;65374:70:::0;::::1;::::0;;65432:10:::1;65374:70:::0;;::::1;::::0;;;65344:27;;;:12:::1;:27:::0;;;;;;:100;;;;-1:-1:-1;;;;;65344:100:0::1;::::0;::::1;::::0;;;::::1;::::0;;;::::1;::::0;;65475:58;785:25:1;;;65275:29:0;;65475:58:::1;::::0;758:18:1;65475:58:0::1;;;;;;;65062:478;64973:567:::0;;;:::o;63217:1718::-;56468:25;46600:16;46611:4;46600:10;:16::i;:::-;63328:18;;::::1;::::0;::::1;::::0;63304:21:::1;63395:29;63338:7:::0;63395:20:::1;:29::i;:::-;63356:68;;63472:13;63438:48;;:11;:23;;;:48;;;63434:77;;63495:16;;;;;;;;;;;;;;63434:77;63607:11;:20;;;63589:15;:38;63585:69;;;63636:18;;;;;;;;;;;;;;63585:69;63715:27;::::0;;;:12:::1;:27;::::0;;;;;::::1;;63711:60;;;63751:20;;;;;;;;;;;;;;63711:60;63781:27;::::0;;;:12:::1;:27;::::0;;;;:34;;-1:-1:-1;;63781:34:0::1;63811:4;63781:34;::::0;;63928:25:::1;::::0;::::1;::::0;63979:21:::1;::::0;::::1;::::0;64027:22:::1;::::0;::::1;::::0;64077:14:::1;::::0;64106:24:::1;::::0;::::1;::::0;64101:517:::1;;-1:-1:-1::0;64184:1:0::1;64199:29;64210:2:::0;64214:5;64221:6;64199:10:::1;:29::i;:::-;;64101:517;;;64249:38:::0;-1:-1:-1;;;;;64249:38:0;::::1;::::0;64245:373:::1;;64369:38;64380:2:::0;64384:5;64391:15:::1;64400:6:::0;64391;:15:::1;:::i;:::-;64369:10;:38::i;64245:373::-;64511:29;64522:2;64526:5;64533:6;64511:10;:29::i;:::-;;64554:53;64565:2;51330:42;64600:6;64554:10;:53::i;:::-;;64245:373;64727:25:::0;;64766:23:::1;::::0;;::::1;::::0;64803:21:::1;::::0;;::::1;::::0;64838:24:::1;::::0;;::::1;::::0;64876:22:::1;::::0;::::1;::::0;64633:295:::1;::::0;;13103:10:1;13091:23;;;13073:42;;-1:-1:-1;;;;;13212:15:1;;;13207:2;13192:18;;13185:43;13264:15;;;13244:18;;;13237:43;;;;13311:2;13296:18;;13289:34;13339:19;;;13332:35;13383:19;;13376:35;;;64633:295:0;::::1;::::0;64687:10:::1;::::0;64660:13;;64633:295:::1;::::0;13045:19:1;64633:295:0::1;12788:629:1::0;55138:142:0;55219:7;55245:18;;;:12;:18;;;;;:28;;55267:5;55245:21;:28::i;:::-;55238:35;55138:142;-1:-1:-1;;;55138:142:0:o;66196:373::-;66277:4;66330:27;66297:29;;;;:14;:29;;;;;;;;:60;;;;;;;;:::i;:::-;;66293:90;;66366:17;;;;;;;;;;;;;;66293:90;66393:24;66420:27;;;:12;:27;;;;;;;;;66393:54;;;;;;;;;;;;;;-1:-1:-1;;;;;66393:54:0;;;;;;;;;;;;66461:24;;;66457:54;;66494:17;;;;;;;;;;;;;;66457:54;66126:15;;58424:10;;66107:15;66100:41;66092:49;;66528:34;;66196:373;-1:-1:-1;;;;66196:373:0:o;60864:163::-;-1:-1:-1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;60980:40:0;;-1:-1:-1;;60980:40:0;;;;;;;;;;:::i;67791:525::-;56608:23;46600:16;46611:4;46600:10;:16::i;:::-;67908:27:::1;67875:29;::::0;;;:14:::1;:29;::::0;;;;;::::1;;:60;::::0;::::1;;;;;;:::i;:::-;;67871:90;;67944:17;;;;;;;;;;;;;;67871:90;67986:27;::::0;;;:12:::1;:27;::::0;;;;;;;;67975:39;;;;::::1;::::0;;;;::::1;::::0;;::::1;::::0;;;;;;::::1;-1:-1:-1::0;;;;;67975:39:0::1;::::0;;;::::1;::::0;;;;58424:10:::1;::::0;66107:15;66100:41;66092:49;67975:56:::1;67971:90;;;68040:21;;;;;;;;;;;;;;67971:90;68149:29;::::0;;;:14:::1;:29;::::0;;;;;;;:54;;-1:-1:-1;;68149:54:0::1;68181:22;68149:54;::::0;;68220:12:::1;:27:::0;;;;;;68213:34;;;68263:46;68298:10:::1;::::0;68149:29;;68263:46:::1;::::0;68149:29;68263:46:::1;67791:525:::0;;:::o;57247:290::-;56677:26;46600:16;46611:4;46600:10;:16::i;:::-;56792:6:::1;57346:10;:26;;57338:55;;;::::0;::::1;::::0;;15233:2:1;57338:55:0::1;::::0;::::1;15215:21:1::0;15272:2;15252:18;;;15245:30;15311:18;15291;;;15284:46;15347:18;;57338:55:0::1;;;;;;;;;57424:15;::::0;;57449:28;;;;57492:38:::1;::::0;;15550:25:1;;;15606:2;15591:18;;15584:34;;;57492:38:0::1;::::0;15523:18:1;57492:38:0::1;;;;;;;;57328:209;57247:290:::0;;:::o;57908:264::-;56677:26;46600:16;46611:4;46600:10;:16::i;:::-;58033:14:::1;::::0;;58057:34;;;;58106:59:::1;::::0;;15550:25:1;;;15606:2;15591:18;;15584:34;;;58106:59:0::1;::::0;15523:18:1;58106:59:0::1;15376:248:1::0;55448:131:0;55519:7;55545:18;;;:12;:18;;;;;:27;;:25;:27::i;48778:138::-;48011:7;48037:12;;;;;;;;;;:22;;;46600:16;46611:4;46600:10;:16::i;:::-;48883:26:::1;48895:4;48901:7;48883:11;:26::i;46701:202::-:0;46786:4;46809:47;;;46824:32;46809:47;;:87;;-1:-1:-1;38614:25:0;38599:40;;;;46860:36;38500:146;47335:103;47401:30;47412:4;22406:10;47401;:30::i;:::-;47335:103;:::o;51613:653::-;51788:4;-1:-1:-1;;;;;51774:19:0;;;51770:32;;51613:653;;;:::o;51770:32::-;51874:5;51883:1;51874:10;51870:23;;51613:653;;;:::o;51870:23::-;51906:20;-1:-1:-1;;;;;51906:20:0;;;51902:358;;52086:12;52103:2;-1:-1:-1;;;;;52103:7:0;52118:5;52103:25;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;52085:43;;;52150:7;52142:39;;;;;;;16041:2:1;52142:39:0;;;16023:21:1;16080:2;16060:18;;;16053:30;16119:21;16099:18;;;16092:49;16158:18;;52142:39:0;15839:343:1;51902:358:0;52212:37;-1:-1:-1;;;;;52212:26:0;;52239:2;52243:5;52212:26;:37::i;55681:257::-;55767:4;55783:12;55798:31;55815:4;55821:7;55798:16;:31::i;:::-;55783:46;;55843:7;55839:69;;;55866:18;;;;:12;:18;;;;;:31;;55889:7;55866:22;:31::i;:::-;;55924:7;55681:257;-1:-1:-1;;;55681:257:0:o;56041:262::-;56128:4;56144:12;56159:32;56177:4;56183:7;56159:17;:32::i;:::-;56144:47;;56205:7;56201:72;;;56228:18;;;;:12;:18;;;;;:34;;56254:7;56228:25;:34::i;59649:1177::-;59737:20;-1:-1:-1;;;;;59773:38:0;;51330:42;59773:38;59769:1051;;59827:24;:5;-1:-1:-1;;;;;59827:22:0;;:24::i;:::-;59932:34;;;;;-1:-1:-1;;;;;7391:55:1;;;59932:34:0;;;7373:74:1;59932:23:0;;;;;7346:18:1;;59932:34:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;59917:49;-1:-1:-1;60112:61:0;-1:-1:-1;;;;;60112:30:0;;60143:10;60155:9;60166:6;60112:30;:61::i;:::-;60309:34;;;;;-1:-1:-1;;;;;7391:55:1;;;60309:34:0;;;7373:74:1;60346:12:0;;60309:23;;;;;;7346:18:1;;60309:34:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;:49;;;;:::i;:::-;60294:64;;59769:1051;;;60480:9;60470:6;:19;60466:51;;60498:19;;;;;;;;;;;;;;60466:51;-1:-1:-1;;;;;60598:26:0;;60619:4;60598:26;60594:74;;60626:42;-1:-1:-1;;;;;60626:23:0;;60650:9;60661:6;60626:23;:42::i;:::-;-1:-1:-1;60800:9:0;59649:1177;;;;;:::o;33110:156::-;33184:7;33234:22;33238:3;33250:5;33234:3;:22::i;32653:115::-;32716:7;32742:19;32750:3;28092:18;;28010:107;47568:197;47067:4;47090:12;;;;;;;;;;;-1:-1:-1;;;;;47090:29:0;;;;;;;;;;;;47651:108;;47701:47;;;;;-1:-1:-1;;;;;10619:55:1;;47701:47:0;;;10601:74:1;10691:18;;;10684:34;;;10574:18;;47701:47:0;10427:297:1;47651:108:0;47568:197;;:::o;39818:160::-;39927:43;;-1:-1:-1;;;;;10619:55:1;;;39927:43:0;;;10601:74:1;10691:18;;;10684:34;;;39900:71:0;;39920:5;;39942:14;;;;;10574:18:1;;39927:43:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;39900:19;:71::i;50315:316::-;50392:4;47090:12;;;;;;;;;;;-1:-1:-1;;;;;47090:29:0;;;;;;;;;;;;50408:217;;50451:6;:12;;;;;;;;;;;-1:-1:-1;;;;;50451:29:0;;;;;;;;;:36;;-1:-1:-1;;50451:36:0;50483:4;50451:36;;;50533:12;22406:10;;22327:96;50533:12;-1:-1:-1;;;;;50506:40:0;50524:7;-1:-1:-1;;;;;50506:40:0;50518:4;50506:40;;;;;;;;;;-1:-1:-1;50567:4:0;50560:11;;50408:217;-1:-1:-1;50609:5:0;50602:12;;31852:150;31922:4;31945:50;31950:3;-1:-1:-1;;;;;31970:23:0;;31945:4;:50::i;50866:317::-;50944:4;47090:12;;;;;;;;;;;-1:-1:-1;;;;;47090:29:0;;;;;;;;;;;;50960:217;;;51034:5;51002:12;;;;;;;;;;;-1:-1:-1;;;;;51002:29:0;;;;;;;;;;:37;;-1:-1:-1;;51002:37:0;;;51058:40;22406:10;;51002:12;;51058:40;;51034:5;51058:40;-1:-1:-1;51119:4:0;51112:11;;32170:156;32243:4;32266:53;32274:3;-1:-1:-1;;;;;32294:23:0;;32266:7;:53::i;53430:344::-;53597:38;-1:-1:-1;;;;;53597:38:0;;;53593:69;;53644:18;;;;;;;;;;;;;;53593:69;53718:5;-1:-1:-1;;;;;53718:17:0;;53739:1;53718:22;53714:53;;53749:18;;;;;;;;;;;;;;40217:188;40344:53;;-1:-1:-1;;;;;9986:15:1;;;40344:53:0;;;9968:34:1;10038:15;;;10018:18;;;10011:43;10070:18;;;10063:34;;;40317:81:0;;40337:5;;40359:18;;;;;9880::1;;40344:53:0;9705:398:1;28459:118:0;28526:7;28552:3;:11;;28564:5;28552:18;;;;;;;;:::i;:::-;;;;;;;;;28545:25;;28459:118;;;;:::o;42574:629::-;42993:23;43019:33;-1:-1:-1;;;;;43019:27:0;;43047:4;43019:27;:33::i;:::-;42993:59;;43066:10;:17;43087:1;43066:22;;:57;;;;;43104:10;43093:30;;;;;;;;;;;;:::i;:::-;43092:31;43066:57;43062:135;;;43146:40;;;;;-1:-1:-1;;;;;7391:55:1;;43146:40:0;;;7373:74:1;7346:18;;43146:40:0;7227:226:1;25777:406:0;25840:4;27896:21;;;:14;;;:21;;;;;;25856:321;;-1:-1:-1;25898:23:0;;;;;;;;:11;:23;;;;;;;;;;;;;26080:18;;26056:21;;;:14;;;:21;;;;;;:42;;;;26112:11;;26351:1368;26417:4;26546:21;;;:14;;;:21;;;;;;26582:13;;26578:1135;;26949:18;26970:12;26981:1;26970:8;:12;:::i;:::-;27016:18;;26949:33;;-1:-1:-1;26996:17:0;;27016:22;;27037:1;;27016:22;:::i;:::-;26996:42;;27071:9;27057:10;:23;27053:378;;27100:17;27120:3;:11;;27132:9;27120:22;;;;;;;;:::i;:::-;;;;;;;;;27100:42;;27267:9;27241:3;:11;;27253:10;27241:23;;;;;;;;:::i;:::-;;;;;;;;;;;;:35;;;;27380:25;;;:14;;;:25;;;;;:36;;;27053:378;27509:17;;:3;;:17;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;27612:3;:14;;:21;27627:5;27612:21;;;;;;;;;;;27605:28;;;27655:4;27648:11;;;;;;;26578:1135;27697:5;27690:12;;;;;18112:151;18187:12;18218:38;18240:6;18248:4;18254:1;18187:12;18828;18842:23;18869:6;-1:-1:-1;;;;;18869:11:0;18888:5;18895:4;18869:31;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;18827:73;;;;18917:55;18944:6;18952:7;18961:10;18917:26;:55::i;:::-;18910:62;18587:392;-1:-1:-1;;;;;;18587:392:0:o;20032:582::-;20176:12;20205:7;20200:408;;20228:19;20236:10;20228:7;:19::i;:::-;20200:408;;;20452:17;;:22;:49;;;;-1:-1:-1;;;;;;20478:18:0;;;:23;20452:49;20448:119;;;20528:24;;;;;-1:-1:-1;;;;;7391:55:1;;20528:24:0;;;7373:74:1;7346:18;;20528:24:0;7227:226:1;20448:119:0;-1:-1:-1;20587:10:0;20580:17;;21150:516;21281:17;;:21;21277:383;;21509:10;21503:17;21565:15;21552:10;21548:2;21544:19;21537:44;21277:383;21632: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:402;1344:2;1329:18;;1377:1;1366:13;;1356:201;;1413:77;1410:1;1403:88;1514:4;1511:1;1504:15;1542:4;1539:1;1532:15;1356:201;1566:25;;;1195:402;:::o;1602:154::-;-1:-1:-1;;;;;1681:5:1;1677:54;1670:5;1667:65;1657:93;;1746:1;1743;1736:12;1761:134;1829:20;;1858:31;1829:20;1858:31;:::i;:::-;1761:134;;;:::o;1900:388::-;1968:6;1976;2029:2;2017:9;2008:7;2004:23;2000:32;1997:52;;;2045:1;2042;2035:12;1997:52;2084:9;2071:23;2103:31;2128:5;2103:31;:::i;:::-;2153:5;-1:-1:-1;2210:2:1;2195:18;;2182:32;2223:33;2182:32;2223:33;:::i;:::-;2275:7;2265:17;;;1900:388;;;;;:::o;2475:315::-;2543:6;2551;2604:2;2592:9;2583:7;2579:23;2575:32;2572:52;;;2620:1;2617;2610:12;2572:52;2656:9;2643:23;2633:33;;2716:2;2705:9;2701:18;2688:32;2729:31;2754:5;2729:31;:::i;2795:184::-;2847:77;2844:1;2837:88;2944:4;2941:1;2934:15;2968:4;2965:1;2958:15;2984:252;3056:2;3050:9;3098:3;3086:16;;3132:18;3117:34;;3153:22;;;3114:62;3111:88;;;3179:18;;:::i;:::-;3215:2;3208:22;2984:252;:::o;3241:247::-;3308:2;3302:9;3350:3;3338:16;;3384:18;3369:34;;3405:22;;;3366:62;3363:88;;;3431:18;;:::i;3493:777::-;3535:5;3588:3;3581:4;3573:6;3569:17;3565:27;3555:55;;3606:1;3603;3596:12;3555:55;3642:6;3629:20;3668:18;3705:2;3701;3698:10;3695:36;;;3711:18;;:::i;:::-;3845:2;3839:9;3907:4;3899:13;;3750:66;3895:22;;;3919:2;3891:31;3887:40;3875:53;;;3943:18;;;3963:22;;;3940:46;3937:72;;;3989:18;;:::i;:::-;4029:10;4025:2;4018:22;4064:2;4056:6;4049:18;4110:3;4103:4;4098:2;4090:6;4086:15;4082:26;4079:35;4076:55;;;4127:1;4124;4117:12;4076:55;4191:2;4184:4;4176:6;4172:17;4165:4;4157:6;4153:17;4140:54;4238:1;4231:4;4226:2;4218:6;4214:15;4210:26;4203:37;4258:6;4249:15;;;;;;3493:777;;;;:::o;4275:455::-;4352:6;4360;4413:2;4401:9;4392:7;4388:23;4384:32;4381:52;;;4429:1;4426;4419:12;4381:52;4469:9;4456:23;4502:18;4494:6;4491:30;4488:50;;;4534:1;4531;4524:12;4488:50;4557:49;4598:7;4589:6;4578:9;4574:22;4557:49;:::i;:::-;4547:59;;;4656:2;4645:9;4641:18;4628:32;4669:31;4694:5;4669:31;:::i;4735:121::-;4820:10;4813:5;4809:22;4802:5;4799:33;4789:61;;4846:1;4843;4836:12;4861:132;4928:20;;4957:30;4928:20;4957:30;:::i;4998:118::-;5084:5;5077:13;5070:21;5063:5;5060:32;5050:60;;5106:1;5103;5096:12;5121:128;5186:20;;5215:28;5186:20;5215:28;:::i;5254:865::-;5342:6;5395:3;5383:9;5374:7;5370:23;5366:33;5363:53;;;5412:1;5409;5402:12;5363:53;5438:22;;:::i;:::-;5483:28;5501:9;5483:28;:::i;:::-;5476:5;5469:43;5544:38;5578:2;5567:9;5563:18;5544:38;:::i;:::-;5539:2;5532:5;5528:14;5521:62;5615:38;5649:2;5638:9;5634:18;5615:38;:::i;:::-;5610:2;5603:5;5599:14;5592:62;5686:38;5720:2;5709:9;5705:18;5686:38;:::i;:::-;5681:2;5674:5;5670:14;5663:62;5758:39;5792:3;5781:9;5777:19;5758:39;:::i;:::-;5752:3;5745:5;5741:15;5734:64;5859:3;5848:9;5844:19;5831:33;5825:3;5818:5;5814:15;5807:58;5926:3;5915:9;5911:19;5898:33;5892:3;5885:5;5881:15;5874:58;5965:36;5996:3;5985:9;5981:19;5965:36;:::i;:::-;5959:3;5948:15;;5941:61;6021:3;6069:18;;;6056:32;6040:14;;;6033:56;;;;-1:-1:-1;5952:5:1;5254:865;-1:-1:-1;5254:865:1:o;6124:320::-;6192:6;6245:2;6233:9;6224:7;6220:23;6216:32;6213:52;;;6261:1;6258;6251:12;6213:52;6301:9;6288:23;6334:18;6326:6;6323:30;6320:50;;;6366:1;6363;6356:12;6320:50;6389:49;6430:7;6421:6;6410:9;6406:22;6389:49;:::i;:::-;6379:59;6124:320;-1:-1:-1;;;;6124:320:1:o;6449:388::-;6526:6;6534;6587:2;6575:9;6566:7;6562:23;6558:32;6555:52;;;6603:1;6600;6593:12;6555:52;6643:9;6630:23;6676:18;6668:6;6665:30;6662:50;;;6708:1;6705;6698:12;6662:50;6731:49;6772:7;6763:6;6752:9;6748:22;6731:49;:::i;:::-;6721:59;6827:2;6812:18;;;;6799:32;;-1:-1:-1;;;;6449:388:1:o;6842:248::-;6910:6;6918;6971:2;6959:9;6950:7;6946:23;6942:32;6939:52;;;6987:1;6984;6977:12;6939:52;-1:-1:-1;;7010:23:1;;;7080:2;7065:18;;;7052:32;;-1:-1:-1;6842:248:1:o;7890:1373::-;8121:13;;7867:10;7856:22;7844:35;;8090:3;8075:19;;8193:4;8185:6;8181:17;8175:24;8208:53;8255:4;8244:9;8240:20;8226:12;7867:10;7856:22;7844:35;;7791:94;8208:53;;8310:4;8302:6;8298:17;8292:24;8325:56;8375:4;8364:9;8360:20;8344:14;-1:-1:-1;;;;;7161:54:1;7149:67;;7095:127;8325:56;;8430:4;8422:6;8418:17;8412:24;8445:56;8495:4;8484:9;8480:20;8464:14;-1:-1:-1;;;;;7161:54:1;7149:67;;7095:127;8445:56;;8550:4;8542:6;8538:17;8532:24;8565:56;8615:4;8604:9;8600:20;8584:14;-1:-1:-1;;;;;7161:54:1;7149:67;;7095:127;8565:56;;8670:4;8662:6;8658:17;8652:24;8685:56;8735:4;8724:9;8720:20;8704:14;-1:-1:-1;;;;;7161:54:1;7149:67;;7095:127;8685:56;;8797:4;8789:6;8785:17;8779:24;8772:4;8761:9;8757:20;8750:54;8860:4;8852:6;8848:17;8842:24;8835:4;8824:9;8820:20;8813:54;8886:6;8946:2;8938:6;8934:15;8928:22;8923:2;8912:9;8908:18;8901:50;;8970:6;9025:2;9017:6;9013:15;9007:22;9038:51;9085:2;9074:9;9070:18;9054:14;421:13;414:21;402:34;;351:91;9038:51;-1:-1:-1;;9108:6:1;9156:15;;;9150:22;9130:18;;;9123:50;9192:6;9240:15;;;9234:22;9214:18;;;;9207:50;;;;7890:1373;:::o;9453:247::-;9512:6;9565:2;9553:9;9544:7;9540:23;9536:32;9533:52;;;9581:1;9578;9571:12;9533:52;9620:9;9607:23;9639:31;9664:5;9639:31;:::i;10108:184::-;10160:77;10157:1;10150:88;10257:4;10254:1;10247:15;10281:4;10278:1;10271:15;10297:125;10362:9;;;10383:10;;;10380:36;;;10396:18;;:::i;10729:168::-;10802:9;;;10833;;10850:15;;;10844:22;;10830:37;10820:71;;10871:18;;:::i;10902:274::-;10942:1;10968;10958:189;;11003:77;11000:1;10993:88;11104:4;11101:1;11094:15;11132:4;11129:1;11122:15;10958:189;-1:-1:-1;11161:9:1;;10902:274::o;11181:128::-;11248:9;;;11269:11;;;11266:37;;;11283:18;;:::i;11314:195::-;11353:3;11384:66;11377:5;11374:77;11371:103;;11454:18;;:::i;:::-;-1:-1:-1;11501:1:1;11490:13;;11314:195::o;11514:250::-;11599:1;11609:113;11623:6;11620:1;11617:13;11609:113;;;11699:11;;;11693:18;11680:11;;;11673:39;11645:2;11638:10;11609:113;;;-1:-1:-1;;11756:1:1;11738:16;;11731:27;11514:250::o;11769:1014::-;12076:3;12065:9;12058:22;12039:4;12109:6;12103:13;12153:6;12147:3;12136:9;12132:19;12125:35;12179:3;12191:81;12265:6;12260:2;12249:9;12245:18;12238:4;12230:6;12226:17;12191:81;:::i;:::-;12452:10;12440:23;;;;12433:4;12418:20;;12411:53;-1:-1:-1;;;;;12561:15:1;;;12556:2;12541:18;;12534:43;12613:15;;;;12608:2;12593:18;;12586:43;12660:3;12645:19;;12638:35;;;;12704:3;12689:19;;12682:35;;;;12761:14;12754:22;12748:3;12733:19;;12726:51;12324:2;12312:15;;;-1:-1:-1;12308:88:1;12293:104;12289:113;;;;;-1:-1:-1;;11769:1014:1:o;13422:136::-;13500:13;;13522:30;13500:13;13522:30;:::i;13563:138::-;13642:13;;13664:31;13642:13;13664:31;:::i;13706:132::-;13782:13;;13804:28;13782:13;13804:28;:::i;13843:1183::-;13946:6;13999:3;13987:9;13978:7;13974:23;13970:33;13967:53;;;14016:1;14013;14006:12;13967:53;14042:17;;:::i;:::-;14082:39;14111:9;14082:39;:::i;:::-;14075:5;14068:54;14154:48;14198:2;14187:9;14183:18;14154:48;:::i;:::-;14149:2;14142:5;14138:14;14131:72;14235:49;14280:2;14269:9;14265:18;14235:49;:::i;:::-;14230:2;14223:5;14219:14;14212:73;14317:49;14362:2;14351:9;14347:18;14317:49;:::i;:::-;14312:2;14305:5;14301:14;14294:73;14400:50;14445:3;14434:9;14430:19;14400:50;:::i;:::-;14394:3;14387:5;14383:15;14376:75;14484:50;14529:3;14518:9;14514:19;14484:50;:::i;:::-;14478:3;14471:5;14467:15;14460:75;14589:3;14578:9;14574:19;14568:26;14562:3;14555:5;14551:15;14544:51;14649:3;14638:9;14634:19;14628:26;14622:3;14615:5;14611:15;14604:51;14674:3;14730:2;14719:9;14715:18;14709:25;14704:2;14697:5;14693:14;14686:49;;14754:3;14789:46;14831:2;14820:9;14816:18;14789:46;:::i;:::-;14773:14;;;14766:70;14855:3;14896:18;;;14890:25;14874:14;;;14867:49;14935:3;14976:18;;;14970:25;14954:14;;;14947:49;;;;-1:-1:-1;14777:5:1;13843:1183;-1:-1:-1;13843:1183:1:o;16187:184::-;16257:6;16310:2;16298:9;16289:7;16285:23;16281:32;16278:52;;;16326:1;16323;16316:12;16278:52;-1:-1:-1;16349:16:1;;16187:184;-1:-1:-1;16187:184:1:o;16678:::-;16730:77;16727:1;16720:88;16827:4;16824:1;16817:15;16851:4;16848:1;16841:15;16867:245;16934:6;16987:2;16975:9;16966:7;16962:23;16958:32;16955:52;;;17003:1;17000;16993:12;16955:52;17035:9;17029:16;17054:28;17076:5;17054:28;:::i;17117:184::-;17169:77;17166:1;17159:88;17266:4;17263:1;17256:15;17290:4;17287:1;17280:15;17306:287;17435:3;17473:6;17467:13;17489:66;17548:6;17543:3;17536:4;17528:6;17524:17;17489:66;:::i;:::-;17571:16;;;;;17306:287;-1:-1:-1;;17306:287: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":"AmountIncorrect","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":"FailedInnerCall","type":"error"},{"inputs":[],"name":"MsgValueIncorrect","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":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":"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":[{"internalType":"bytes32","name":"","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":"bridgeRelays","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"bridgeStatuses","outputs":[{"internalType":"enum FastBridge.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":[],"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":[],"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":"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":"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":"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":{"DISPUTE_PERIOD()":{"notice":"Dispute period for relayed transactions"},"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"},"bridgeProofs(bytes32)":{"notice":"Proof of relayed bridge tx on origin chain"},"bridgeRelays(bytes32)":{"notice":"Whether bridge has been relayed on destination chain"},"bridgeStatuses(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,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"},"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"},"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":{"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 ERC-20 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"}},"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"}},"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"}},"refund(bytes)":{"params":{"request":"The encoded bridge transaction to refund"}},"relay(bytes)":{"params":{"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":"to prevent replays"}},"version":1},"metadata":"{\"compiler\":{\"version\":\"0.8.20+commit.a1b79de6\"},\"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\":\"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\":\"FailedInnerCall\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MsgValueIncorrect\",\"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\":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\":\"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\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"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\":\"bridgeRelays\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"bridgeStatuses\",\"outputs\":[{\"internalType\":\"enum FastBridge.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\":[],\"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\":[],\"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\":\"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\":\"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\":\"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 ERC-20 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\"}},\"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\"}},\"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\"}},\"refund(bytes)\":{\"params\":{\"request\":\"The encoded bridge transaction to refund\"}},\"relay(bytes)\":{\"params\":{\"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\":\"to prevent replays\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"DISPUTE_PERIOD()\":{\"notice\":\"Dispute period for relayed transactions\"},\"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\"},\"bridgeProofs(bytes32)\":{\"notice\":\"Proof of relayed bridge tx on origin chain\"},\"bridgeRelays(bytes32)\":{\"notice\":\"Whether bridge has been relayed on destination chain\"},\"bridgeStatuses(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,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\"},\"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\"},\"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/FastBridge.sol\":\"FastBridge\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridge.sol\":{\"keccak256\":\"0x7da00701c906b2b78d838eb9c510ab5903b6dd7f8e5fb12d4c4710c350e3c919\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://faff50fb8d1f3cf10122c1b611d0987ca58f4099d90c17163816c90d3077bce7\",\"dweb:/ipfs/QmWKF2L9D18J9QXiMbm6ucj3x8ebjQtTrycnkNmB4q3JRo\"]}},\"version\":1}"},"hashes":{"DEFAULT_ADMIN_ROLE()":"a217fddf","DISPUTE_PERIOD()":"a5bbe22b","FEE_BPS()":"bf333f2c","FEE_RATE_MAX()":"0f5f6ed7","GOVERNOR_ROLE()":"ccc57490","GUARD_ROLE()":"03ed0ee5","MIN_DEADLINE_PERIOD()":"820688d5","REFUNDER_ROLE()":"5960ccf2","REFUND_DELAY()":"190da595","RELAYER_ROLE()":"926d7d7f","bridge((uint32,address,address,address,address,uint256,uint256,bool,uint256))":"45851694","bridgeProofs(bytes32)":"91ad5039","bridgeRelays(bytes32)":"8379a24f","bridgeStatuses(bytes32)":"051287bc","canClaim(bytes32,address)":"aa9641ab","chainGasAmount()":"e00a83e0","claim(bytes,address)":"41fcb612","deployBlock()":"a3ec191a","dispute(bytes32)":"add98c70","getBridgeTransaction(bytes)":"ac11fb1a","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","refund(bytes)":"5eb7d946","relay(bytes)":"8f0d6f17","renounceRole(bytes32,address)":"36568abe","revokeRole(bytes32,address)":"d547741f","setChainGasAmount(uint256)":"b250fe6b","setProtocolFeeRate(uint256)":"b13aa2d6","supportsInterface(bytes4)":"01ffc9a7","sweepProtocolFees(address,address)":"06f333f2"}},"solidity/FastBridge.sol:IAccessControl":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.20 ^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 pure 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/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// lib/openzeppelin-contracts/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 ERC-165 detection.\n */\ninterface IAccessControl {\n /**\n * @dev The `account` is missing a role.\n */\n error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);\n\n /**\n * @dev The caller of a function is not the expected one.\n *\n * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.\n */\n error AccessControlBadConfirmation();\n\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted 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// lib/openzeppelin-contracts/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 ERC-20 standard as defined in the ERC.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the value of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the value of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 value) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n * caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 value) external returns (bool);\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\n * allowance mechanism. `value` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n\n// lib/openzeppelin-contracts/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 ERC-20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[ERC-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC-20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n *\n * ==== Security Considerations\n *\n * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\n * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\n * considered as an intention to spend the allowance in any specific way. The second is that because permits have\n * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\n * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\n * generally recommended is:\n *\n * ```solidity\n * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\n * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\n * doThing(..., value);\n * }\n *\n * function doThing(..., uint256 value) public {\n * token.safeTransferFrom(msg.sender, address(this), value);\n * ...\n * }\n * ```\n *\n * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\n * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\n * {SafeERC20-safeTransferFrom}).\n *\n * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\n * contracts should have entry points that don't rely on permit.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also 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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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 ERC-165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[ERC].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n\n// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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 ERC-165 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// lib/openzeppelin-contracts/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 ERC-165 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// lib/openzeppelin-contracts/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 ERC-20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n /**\n * @dev An operation with an ERC-20 token failed.\n */\n error SafeERC20FailedOperation(address token);\n\n /**\n * @dev Indicates a failed `decreaseAllowance` request.\n */\n error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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/FastBridge.sol\n\ncontract FastBridge is IFastBridge, Admin {\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 enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeStatus) public bridgeStatuses;\n /// @notice Proof of relayed bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeProof) public bridgeProofs;\n /// @notice Whether bridge has been relayed on destination chain\n mapping(bytes32 =\u003e bool) public bridgeRelays;\n\n /// @dev to prevent replays\n uint256 public nonce;\n // @dev 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 /// @notice Pulls a requested token from the user to the requested recipient.\n /// @dev Be careful of re-entrancy issues when msg.value \u003e 0 and recipient != address(this)\n function _pullToken(address recipient, address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token != UniversalTokenLib.ETH_ADDRESS) {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(recipient);\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, recipient, amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(recipient) - amountPulled;\n } else {\n // Otherwise, we need to check that ETH amount matches msg.value\n if (amount != msg.value) revert MsgValueIncorrect();\n // Transfer value to recipient if not this address\n if (recipient != address(this)) token.universalTransfer(recipient, amount);\n // We will forward msg.value in the external call later, if recipient is not this contract\n amountPulled = msg.value;\n }\n }\n\n /// @inheritdoc IFastBridge\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n // check bridge params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\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\n // transfer tokens to bridge contract\n // @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(address(this), 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 BridgeTransaction({\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 sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n\n // check haven't exceeded deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n\n // mark bridge transaction as relayed\n if (bridgeRelays[transactionId]) revert TransactionRelayed();\n bridgeRelays[transactionId] = true;\n\n // transfer tokens to recipient on destination chain and gas rebate if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n uint256 rebate = chainGasAmount;\n if (!transaction.sendChainGas) {\n // forward erc20\n rebate = 0;\n _pullToken(to, token, amount);\n } else if (token == UniversalTokenLib.ETH_ADDRESS) {\n // lump in gas rebate into amount in native gas token\n _pullToken(to, token, amount + rebate);\n } else {\n // forward erc20 then forward gas rebate in native gas token\n _pullToken(to, token, amount);\n _pullToken(to, UniversalTokenLib.ETH_ADDRESS, rebate);\n }\n\n emit BridgeRelayed(\n transactionId,\n msg.sender,\n to,\n transaction.originChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n rebate\n );\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n // update bridge tx status given proof provided\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = BridgeStatus.RELAYER_PROVED;\n bridgeProofs[transactionId] = BridgeProof({timestamp: uint96(block.timestamp), relayer: msg.sender}); // overflow ok\n\n emit BridgeProofProvided(transactionId, msg.sender, destTxHash);\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint96(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint96).max but\n /// proof.timestamp \u003c type(uint96).max via unchecked statement\n /// @param proof The bridge proof\n /// @return delta Time delta since proof submitted\n function _timeSince(BridgeProof memory proof) internal view returns (uint256 delta) {\n unchecked {\n delta = uint96(block.timestamp) - proof.timestamp;\n }\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != relayer) revert SenderIncorrect();\n return _timeSince(proof) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != msg.sender) revert SenderIncorrect();\n if (_timeSince(proof) \u003c= DISPUTE_PERIOD) revert DisputePeriodNotPassed();\n\n bridgeStatuses[transactionId] = 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, msg.sender, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeProofs[transactionId]) \u003e DISPUTE_PERIOD) revert DisputePeriodPassed();\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n delete bridgeProofs[transactionId];\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 BridgeTransaction memory transaction = getBridgeTransaction(request);\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 // set status to refunded if still in requested state\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = 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","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","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 ERC-165 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.20+commit.a1b79de6\"},\"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 ERC-165 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/FastBridge.sol\":\"IAccessControl\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridge.sol\":{\"keccak256\":\"0x7da00701c906b2b78d838eb9c510ab5903b6dd7f8e5fb12d4c4710c350e3c919\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://faff50fb8d1f3cf10122c1b611d0987ca58f4099d90c17163816c90d3077bce7\",\"dweb:/ipfs/QmWKF2L9D18J9QXiMbm6ucj3x8ebjQtTrycnkNmB4q3JRo\"]}},\"version\":1}"},"hashes":{"getRoleAdmin(bytes32)":"248a9ca3","grantRole(bytes32,address)":"2f2ff15d","hasRole(bytes32,address)":"91d14854","renounceRole(bytes32,address)":"36568abe","revokeRole(bytes32,address)":"d547741f"}},"solidity/FastBridge.sol:IAccessControlEnumerable":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.20 ^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 pure 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/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// lib/openzeppelin-contracts/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 ERC-165 detection.\n */\ninterface IAccessControl {\n /**\n * @dev The `account` is missing a role.\n */\n error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);\n\n /**\n * @dev The caller of a function is not the expected one.\n *\n * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.\n */\n error AccessControlBadConfirmation();\n\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted 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// lib/openzeppelin-contracts/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 ERC-20 standard as defined in the ERC.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the value of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the value of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 value) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n * caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 value) external returns (bool);\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\n * allowance mechanism. `value` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n\n// lib/openzeppelin-contracts/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 ERC-20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[ERC-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC-20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n *\n * ==== Security Considerations\n *\n * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\n * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\n * considered as an intention to spend the allowance in any specific way. The second is that because permits have\n * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\n * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\n * generally recommended is:\n *\n * ```solidity\n * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\n * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\n * doThing(..., value);\n * }\n *\n * function doThing(..., uint256 value) public {\n * token.safeTransferFrom(msg.sender, address(this), value);\n * ...\n * }\n * ```\n *\n * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\n * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\n * {SafeERC20-safeTransferFrom}).\n *\n * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\n * contracts should have entry points that don't rely on permit.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also 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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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 ERC-165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[ERC].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n\n// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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 ERC-165 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// lib/openzeppelin-contracts/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 ERC-165 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// lib/openzeppelin-contracts/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 ERC-20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n /**\n * @dev An operation with an ERC-20 token failed.\n */\n error SafeERC20FailedOperation(address token);\n\n /**\n * @dev Indicates a failed `decreaseAllowance` request.\n */\n error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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/FastBridge.sol\n\ncontract FastBridge is IFastBridge, Admin {\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 enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeStatus) public bridgeStatuses;\n /// @notice Proof of relayed bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeProof) public bridgeProofs;\n /// @notice Whether bridge has been relayed on destination chain\n mapping(bytes32 =\u003e bool) public bridgeRelays;\n\n /// @dev to prevent replays\n uint256 public nonce;\n // @dev 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 /// @notice Pulls a requested token from the user to the requested recipient.\n /// @dev Be careful of re-entrancy issues when msg.value \u003e 0 and recipient != address(this)\n function _pullToken(address recipient, address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token != UniversalTokenLib.ETH_ADDRESS) {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(recipient);\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, recipient, amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(recipient) - amountPulled;\n } else {\n // Otherwise, we need to check that ETH amount matches msg.value\n if (amount != msg.value) revert MsgValueIncorrect();\n // Transfer value to recipient if not this address\n if (recipient != address(this)) token.universalTransfer(recipient, amount);\n // We will forward msg.value in the external call later, if recipient is not this contract\n amountPulled = msg.value;\n }\n }\n\n /// @inheritdoc IFastBridge\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n // check bridge params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\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\n // transfer tokens to bridge contract\n // @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(address(this), 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 BridgeTransaction({\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 sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n\n // check haven't exceeded deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n\n // mark bridge transaction as relayed\n if (bridgeRelays[transactionId]) revert TransactionRelayed();\n bridgeRelays[transactionId] = true;\n\n // transfer tokens to recipient on destination chain and gas rebate if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n uint256 rebate = chainGasAmount;\n if (!transaction.sendChainGas) {\n // forward erc20\n rebate = 0;\n _pullToken(to, token, amount);\n } else if (token == UniversalTokenLib.ETH_ADDRESS) {\n // lump in gas rebate into amount in native gas token\n _pullToken(to, token, amount + rebate);\n } else {\n // forward erc20 then forward gas rebate in native gas token\n _pullToken(to, token, amount);\n _pullToken(to, UniversalTokenLib.ETH_ADDRESS, rebate);\n }\n\n emit BridgeRelayed(\n transactionId,\n msg.sender,\n to,\n transaction.originChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n rebate\n );\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n // update bridge tx status given proof provided\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = BridgeStatus.RELAYER_PROVED;\n bridgeProofs[transactionId] = BridgeProof({timestamp: uint96(block.timestamp), relayer: msg.sender}); // overflow ok\n\n emit BridgeProofProvided(transactionId, msg.sender, destTxHash);\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint96(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint96).max but\n /// proof.timestamp \u003c type(uint96).max via unchecked statement\n /// @param proof The bridge proof\n /// @return delta Time delta since proof submitted\n function _timeSince(BridgeProof memory proof) internal view returns (uint256 delta) {\n unchecked {\n delta = uint96(block.timestamp) - proof.timestamp;\n }\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != relayer) revert SenderIncorrect();\n return _timeSince(proof) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != msg.sender) revert SenderIncorrect();\n if (_timeSince(proof) \u003c= DISPUTE_PERIOD) revert DisputePeriodNotPassed();\n\n bridgeStatuses[transactionId] = 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, msg.sender, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeProofs[transactionId]) \u003e DISPUTE_PERIOD) revert DisputePeriodPassed();\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n delete bridgeProofs[transactionId];\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 BridgeTransaction memory transaction = getBridgeTransaction(request);\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 // set status to refunded if still in requested state\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = 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","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","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 ERC-165 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.20+commit.a1b79de6\"},\"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 ERC-165 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/FastBridge.sol\":\"IAccessControlEnumerable\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridge.sol\":{\"keccak256\":\"0x7da00701c906b2b78d838eb9c510ab5903b6dd7f8e5fb12d4c4710c350e3c919\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://faff50fb8d1f3cf10122c1b611d0987ca58f4099d90c17163816c90d3077bce7\",\"dweb:/ipfs/QmWKF2L9D18J9QXiMbm6ucj3x8ebjQtTrycnkNmB4q3JRo\"]}},\"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/FastBridge.sol:IAdmin":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.20 ^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 pure 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/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// lib/openzeppelin-contracts/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 ERC-165 detection.\n */\ninterface IAccessControl {\n /**\n * @dev The `account` is missing a role.\n */\n error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);\n\n /**\n * @dev The caller of a function is not the expected one.\n *\n * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.\n */\n error AccessControlBadConfirmation();\n\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted 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// lib/openzeppelin-contracts/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 ERC-20 standard as defined in the ERC.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the value of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the value of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 value) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n * caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 value) external returns (bool);\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\n * allowance mechanism. `value` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n\n// lib/openzeppelin-contracts/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 ERC-20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[ERC-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC-20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n *\n * ==== Security Considerations\n *\n * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\n * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\n * considered as an intention to spend the allowance in any specific way. The second is that because permits have\n * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\n * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\n * generally recommended is:\n *\n * ```solidity\n * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\n * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\n * doThing(..., value);\n * }\n *\n * function doThing(..., uint256 value) public {\n * token.safeTransferFrom(msg.sender, address(this), value);\n * ...\n * }\n * ```\n *\n * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\n * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\n * {SafeERC20-safeTransferFrom}).\n *\n * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\n * contracts should have entry points that don't rely on permit.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also 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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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 ERC-165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[ERC].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n\n// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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 ERC-165 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// lib/openzeppelin-contracts/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 ERC-165 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// lib/openzeppelin-contracts/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 ERC-20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n /**\n * @dev An operation with an ERC-20 token failed.\n */\n error SafeERC20FailedOperation(address token);\n\n /**\n * @dev Indicates a failed `decreaseAllowance` request.\n */\n error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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/FastBridge.sol\n\ncontract FastBridge is IFastBridge, Admin {\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 enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeStatus) public bridgeStatuses;\n /// @notice Proof of relayed bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeProof) public bridgeProofs;\n /// @notice Whether bridge has been relayed on destination chain\n mapping(bytes32 =\u003e bool) public bridgeRelays;\n\n /// @dev to prevent replays\n uint256 public nonce;\n // @dev 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 /// @notice Pulls a requested token from the user to the requested recipient.\n /// @dev Be careful of re-entrancy issues when msg.value \u003e 0 and recipient != address(this)\n function _pullToken(address recipient, address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token != UniversalTokenLib.ETH_ADDRESS) {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(recipient);\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, recipient, amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(recipient) - amountPulled;\n } else {\n // Otherwise, we need to check that ETH amount matches msg.value\n if (amount != msg.value) revert MsgValueIncorrect();\n // Transfer value to recipient if not this address\n if (recipient != address(this)) token.universalTransfer(recipient, amount);\n // We will forward msg.value in the external call later, if recipient is not this contract\n amountPulled = msg.value;\n }\n }\n\n /// @inheritdoc IFastBridge\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n // check bridge params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\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\n // transfer tokens to bridge contract\n // @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(address(this), 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 BridgeTransaction({\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 sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n\n // check haven't exceeded deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n\n // mark bridge transaction as relayed\n if (bridgeRelays[transactionId]) revert TransactionRelayed();\n bridgeRelays[transactionId] = true;\n\n // transfer tokens to recipient on destination chain and gas rebate if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n uint256 rebate = chainGasAmount;\n if (!transaction.sendChainGas) {\n // forward erc20\n rebate = 0;\n _pullToken(to, token, amount);\n } else if (token == UniversalTokenLib.ETH_ADDRESS) {\n // lump in gas rebate into amount in native gas token\n _pullToken(to, token, amount + rebate);\n } else {\n // forward erc20 then forward gas rebate in native gas token\n _pullToken(to, token, amount);\n _pullToken(to, UniversalTokenLib.ETH_ADDRESS, rebate);\n }\n\n emit BridgeRelayed(\n transactionId,\n msg.sender,\n to,\n transaction.originChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n rebate\n );\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n // update bridge tx status given proof provided\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = BridgeStatus.RELAYER_PROVED;\n bridgeProofs[transactionId] = BridgeProof({timestamp: uint96(block.timestamp), relayer: msg.sender}); // overflow ok\n\n emit BridgeProofProvided(transactionId, msg.sender, destTxHash);\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint96(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint96).max but\n /// proof.timestamp \u003c type(uint96).max via unchecked statement\n /// @param proof The bridge proof\n /// @return delta Time delta since proof submitted\n function _timeSince(BridgeProof memory proof) internal view returns (uint256 delta) {\n unchecked {\n delta = uint96(block.timestamp) - proof.timestamp;\n }\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != relayer) revert SenderIncorrect();\n return _timeSince(proof) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != msg.sender) revert SenderIncorrect();\n if (_timeSince(proof) \u003c= DISPUTE_PERIOD) revert DisputePeriodNotPassed();\n\n bridgeStatuses[transactionId] = 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, msg.sender, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeProofs[transactionId]) \u003e DISPUTE_PERIOD) revert DisputePeriodPassed();\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n delete bridgeProofs[transactionId];\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 BridgeTransaction memory transaction = getBridgeTransaction(request);\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 // set status to refunded if still in requested state\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = 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","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","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.20+commit.a1b79de6\"},\"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/FastBridge.sol\":\"IAdmin\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridge.sol\":{\"keccak256\":\"0x7da00701c906b2b78d838eb9c510ab5903b6dd7f8e5fb12d4c4710c350e3c919\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://faff50fb8d1f3cf10122c1b611d0987ca58f4099d90c17163816c90d3077bce7\",\"dweb:/ipfs/QmWKF2L9D18J9QXiMbm6ucj3x8ebjQtTrycnkNmB4q3JRo\"]}},\"version\":1}"},"hashes":{"setChainGasAmount(uint256)":"b250fe6b","setProtocolFeeRate(uint256)":"b13aa2d6","sweepProtocolFees(address,address)":"06f333f2"}},"solidity/FastBridge.sol:IERC165":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.20 ^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 pure 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/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// lib/openzeppelin-contracts/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 ERC-165 detection.\n */\ninterface IAccessControl {\n /**\n * @dev The `account` is missing a role.\n */\n error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);\n\n /**\n * @dev The caller of a function is not the expected one.\n *\n * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.\n */\n error AccessControlBadConfirmation();\n\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted 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// lib/openzeppelin-contracts/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 ERC-20 standard as defined in the ERC.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the value of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the value of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 value) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n * caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 value) external returns (bool);\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\n * allowance mechanism. `value` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n\n// lib/openzeppelin-contracts/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 ERC-20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[ERC-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC-20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n *\n * ==== Security Considerations\n *\n * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\n * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\n * considered as an intention to spend the allowance in any specific way. The second is that because permits have\n * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\n * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\n * generally recommended is:\n *\n * ```solidity\n * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\n * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\n * doThing(..., value);\n * }\n *\n * function doThing(..., uint256 value) public {\n * token.safeTransferFrom(msg.sender, address(this), value);\n * ...\n * }\n * ```\n *\n * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\n * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\n * {SafeERC20-safeTransferFrom}).\n *\n * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\n * contracts should have entry points that don't rely on permit.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also 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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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 ERC-165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[ERC].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n\n// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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 ERC-165 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// lib/openzeppelin-contracts/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 ERC-165 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// lib/openzeppelin-contracts/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 ERC-20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n /**\n * @dev An operation with an ERC-20 token failed.\n */\n error SafeERC20FailedOperation(address token);\n\n /**\n * @dev Indicates a failed `decreaseAllowance` request.\n */\n error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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/FastBridge.sol\n\ncontract FastBridge is IFastBridge, Admin {\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 enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeStatus) public bridgeStatuses;\n /// @notice Proof of relayed bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeProof) public bridgeProofs;\n /// @notice Whether bridge has been relayed on destination chain\n mapping(bytes32 =\u003e bool) public bridgeRelays;\n\n /// @dev to prevent replays\n uint256 public nonce;\n // @dev 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 /// @notice Pulls a requested token from the user to the requested recipient.\n /// @dev Be careful of re-entrancy issues when msg.value \u003e 0 and recipient != address(this)\n function _pullToken(address recipient, address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token != UniversalTokenLib.ETH_ADDRESS) {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(recipient);\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, recipient, amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(recipient) - amountPulled;\n } else {\n // Otherwise, we need to check that ETH amount matches msg.value\n if (amount != msg.value) revert MsgValueIncorrect();\n // Transfer value to recipient if not this address\n if (recipient != address(this)) token.universalTransfer(recipient, amount);\n // We will forward msg.value in the external call later, if recipient is not this contract\n amountPulled = msg.value;\n }\n }\n\n /// @inheritdoc IFastBridge\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n // check bridge params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\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\n // transfer tokens to bridge contract\n // @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(address(this), 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 BridgeTransaction({\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 sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n\n // check haven't exceeded deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n\n // mark bridge transaction as relayed\n if (bridgeRelays[transactionId]) revert TransactionRelayed();\n bridgeRelays[transactionId] = true;\n\n // transfer tokens to recipient on destination chain and gas rebate if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n uint256 rebate = chainGasAmount;\n if (!transaction.sendChainGas) {\n // forward erc20\n rebate = 0;\n _pullToken(to, token, amount);\n } else if (token == UniversalTokenLib.ETH_ADDRESS) {\n // lump in gas rebate into amount in native gas token\n _pullToken(to, token, amount + rebate);\n } else {\n // forward erc20 then forward gas rebate in native gas token\n _pullToken(to, token, amount);\n _pullToken(to, UniversalTokenLib.ETH_ADDRESS, rebate);\n }\n\n emit BridgeRelayed(\n transactionId,\n msg.sender,\n to,\n transaction.originChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n rebate\n );\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n // update bridge tx status given proof provided\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = BridgeStatus.RELAYER_PROVED;\n bridgeProofs[transactionId] = BridgeProof({timestamp: uint96(block.timestamp), relayer: msg.sender}); // overflow ok\n\n emit BridgeProofProvided(transactionId, msg.sender, destTxHash);\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint96(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint96).max but\n /// proof.timestamp \u003c type(uint96).max via unchecked statement\n /// @param proof The bridge proof\n /// @return delta Time delta since proof submitted\n function _timeSince(BridgeProof memory proof) internal view returns (uint256 delta) {\n unchecked {\n delta = uint96(block.timestamp) - proof.timestamp;\n }\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != relayer) revert SenderIncorrect();\n return _timeSince(proof) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != msg.sender) revert SenderIncorrect();\n if (_timeSince(proof) \u003c= DISPUTE_PERIOD) revert DisputePeriodNotPassed();\n\n bridgeStatuses[transactionId] = 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, msg.sender, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeProofs[transactionId]) \u003e DISPUTE_PERIOD) revert DisputePeriodPassed();\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n delete bridgeProofs[transactionId];\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 BridgeTransaction memory transaction = getBridgeTransaction(request);\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 // set status to refunded if still in requested state\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = 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","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","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 ERC-165 standard, as defined in the https://eips.ethereum.org/EIPS/eip-165[ERC]. 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[ERC 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.20+commit.a1b79de6\"},\"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 ERC-165 standard, as defined in the https://eips.ethereum.org/EIPS/eip-165[ERC]. 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[ERC 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/FastBridge.sol\":\"IERC165\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridge.sol\":{\"keccak256\":\"0x7da00701c906b2b78d838eb9c510ab5903b6dd7f8e5fb12d4c4710c350e3c919\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://faff50fb8d1f3cf10122c1b611d0987ca58f4099d90c17163816c90d3077bce7\",\"dweb:/ipfs/QmWKF2L9D18J9QXiMbm6ucj3x8ebjQtTrycnkNmB4q3JRo\"]}},\"version\":1}"},"hashes":{"supportsInterface(bytes4)":"01ffc9a7"}},"solidity/FastBridge.sol:IERC20":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.20 ^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 pure 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/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// lib/openzeppelin-contracts/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 ERC-165 detection.\n */\ninterface IAccessControl {\n /**\n * @dev The `account` is missing a role.\n */\n error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);\n\n /**\n * @dev The caller of a function is not the expected one.\n *\n * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.\n */\n error AccessControlBadConfirmation();\n\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted 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// lib/openzeppelin-contracts/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 ERC-20 standard as defined in the ERC.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the value of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the value of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 value) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n * caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 value) external returns (bool);\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\n * allowance mechanism. `value` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n\n// lib/openzeppelin-contracts/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 ERC-20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[ERC-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC-20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n *\n * ==== Security Considerations\n *\n * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\n * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\n * considered as an intention to spend the allowance in any specific way. The second is that because permits have\n * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\n * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\n * generally recommended is:\n *\n * ```solidity\n * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\n * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\n * doThing(..., value);\n * }\n *\n * function doThing(..., uint256 value) public {\n * token.safeTransferFrom(msg.sender, address(this), value);\n * ...\n * }\n * ```\n *\n * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\n * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\n * {SafeERC20-safeTransferFrom}).\n *\n * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\n * contracts should have entry points that don't rely on permit.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also 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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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 ERC-165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[ERC].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n\n// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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 ERC-165 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// lib/openzeppelin-contracts/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 ERC-165 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// lib/openzeppelin-contracts/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 ERC-20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n /**\n * @dev An operation with an ERC-20 token failed.\n */\n error SafeERC20FailedOperation(address token);\n\n /**\n * @dev Indicates a failed `decreaseAllowance` request.\n */\n error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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/FastBridge.sol\n\ncontract FastBridge is IFastBridge, Admin {\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 enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeStatus) public bridgeStatuses;\n /// @notice Proof of relayed bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeProof) public bridgeProofs;\n /// @notice Whether bridge has been relayed on destination chain\n mapping(bytes32 =\u003e bool) public bridgeRelays;\n\n /// @dev to prevent replays\n uint256 public nonce;\n // @dev 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 /// @notice Pulls a requested token from the user to the requested recipient.\n /// @dev Be careful of re-entrancy issues when msg.value \u003e 0 and recipient != address(this)\n function _pullToken(address recipient, address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token != UniversalTokenLib.ETH_ADDRESS) {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(recipient);\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, recipient, amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(recipient) - amountPulled;\n } else {\n // Otherwise, we need to check that ETH amount matches msg.value\n if (amount != msg.value) revert MsgValueIncorrect();\n // Transfer value to recipient if not this address\n if (recipient != address(this)) token.universalTransfer(recipient, amount);\n // We will forward msg.value in the external call later, if recipient is not this contract\n amountPulled = msg.value;\n }\n }\n\n /// @inheritdoc IFastBridge\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n // check bridge params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\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\n // transfer tokens to bridge contract\n // @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(address(this), 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 BridgeTransaction({\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 sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n\n // check haven't exceeded deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n\n // mark bridge transaction as relayed\n if (bridgeRelays[transactionId]) revert TransactionRelayed();\n bridgeRelays[transactionId] = true;\n\n // transfer tokens to recipient on destination chain and gas rebate if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n uint256 rebate = chainGasAmount;\n if (!transaction.sendChainGas) {\n // forward erc20\n rebate = 0;\n _pullToken(to, token, amount);\n } else if (token == UniversalTokenLib.ETH_ADDRESS) {\n // lump in gas rebate into amount in native gas token\n _pullToken(to, token, amount + rebate);\n } else {\n // forward erc20 then forward gas rebate in native gas token\n _pullToken(to, token, amount);\n _pullToken(to, UniversalTokenLib.ETH_ADDRESS, rebate);\n }\n\n emit BridgeRelayed(\n transactionId,\n msg.sender,\n to,\n transaction.originChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n rebate\n );\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n // update bridge tx status given proof provided\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = BridgeStatus.RELAYER_PROVED;\n bridgeProofs[transactionId] = BridgeProof({timestamp: uint96(block.timestamp), relayer: msg.sender}); // overflow ok\n\n emit BridgeProofProvided(transactionId, msg.sender, destTxHash);\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint96(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint96).max but\n /// proof.timestamp \u003c type(uint96).max via unchecked statement\n /// @param proof The bridge proof\n /// @return delta Time delta since proof submitted\n function _timeSince(BridgeProof memory proof) internal view returns (uint256 delta) {\n unchecked {\n delta = uint96(block.timestamp) - proof.timestamp;\n }\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != relayer) revert SenderIncorrect();\n return _timeSince(proof) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != msg.sender) revert SenderIncorrect();\n if (_timeSince(proof) \u003c= DISPUTE_PERIOD) revert DisputePeriodNotPassed();\n\n bridgeStatuses[transactionId] = 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, msg.sender, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeProofs[transactionId]) \u003e DISPUTE_PERIOD) revert DisputePeriodPassed();\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n delete bridgeProofs[transactionId];\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 BridgeTransaction memory transaction = getBridgeTransaction(request);\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 // set status to refunded if still in requested state\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = 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","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","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 ERC-20 standard as defined in the ERC.","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.20+commit.a1b79de6\"},\"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 ERC-20 standard as defined in the ERC.\",\"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/FastBridge.sol\":\"IERC20\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridge.sol\":{\"keccak256\":\"0x7da00701c906b2b78d838eb9c510ab5903b6dd7f8e5fb12d4c4710c350e3c919\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://faff50fb8d1f3cf10122c1b611d0987ca58f4099d90c17163816c90d3077bce7\",\"dweb:/ipfs/QmWKF2L9D18J9QXiMbm6ucj3x8ebjQtTrycnkNmB4q3JRo\"]}},\"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/FastBridge.sol:IERC20Permit":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.20 ^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 pure 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/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// lib/openzeppelin-contracts/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 ERC-165 detection.\n */\ninterface IAccessControl {\n /**\n * @dev The `account` is missing a role.\n */\n error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);\n\n /**\n * @dev The caller of a function is not the expected one.\n *\n * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.\n */\n error AccessControlBadConfirmation();\n\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted 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// lib/openzeppelin-contracts/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 ERC-20 standard as defined in the ERC.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the value of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the value of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 value) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n * caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 value) external returns (bool);\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\n * allowance mechanism. `value` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n\n// lib/openzeppelin-contracts/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 ERC-20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[ERC-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC-20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n *\n * ==== Security Considerations\n *\n * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\n * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\n * considered as an intention to spend the allowance in any specific way. The second is that because permits have\n * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\n * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\n * generally recommended is:\n *\n * ```solidity\n * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\n * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\n * doThing(..., value);\n * }\n *\n * function doThing(..., uint256 value) public {\n * token.safeTransferFrom(msg.sender, address(this), value);\n * ...\n * }\n * ```\n *\n * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\n * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\n * {SafeERC20-safeTransferFrom}).\n *\n * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\n * contracts should have entry points that don't rely on permit.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also 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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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 ERC-165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[ERC].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n\n// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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 ERC-165 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// lib/openzeppelin-contracts/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 ERC-165 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// lib/openzeppelin-contracts/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 ERC-20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n /**\n * @dev An operation with an ERC-20 token failed.\n */\n error SafeERC20FailedOperation(address token);\n\n /**\n * @dev Indicates a failed `decreaseAllowance` request.\n */\n error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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/FastBridge.sol\n\ncontract FastBridge is IFastBridge, Admin {\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 enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeStatus) public bridgeStatuses;\n /// @notice Proof of relayed bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeProof) public bridgeProofs;\n /// @notice Whether bridge has been relayed on destination chain\n mapping(bytes32 =\u003e bool) public bridgeRelays;\n\n /// @dev to prevent replays\n uint256 public nonce;\n // @dev 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 /// @notice Pulls a requested token from the user to the requested recipient.\n /// @dev Be careful of re-entrancy issues when msg.value \u003e 0 and recipient != address(this)\n function _pullToken(address recipient, address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token != UniversalTokenLib.ETH_ADDRESS) {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(recipient);\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, recipient, amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(recipient) - amountPulled;\n } else {\n // Otherwise, we need to check that ETH amount matches msg.value\n if (amount != msg.value) revert MsgValueIncorrect();\n // Transfer value to recipient if not this address\n if (recipient != address(this)) token.universalTransfer(recipient, amount);\n // We will forward msg.value in the external call later, if recipient is not this contract\n amountPulled = msg.value;\n }\n }\n\n /// @inheritdoc IFastBridge\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n // check bridge params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\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\n // transfer tokens to bridge contract\n // @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(address(this), 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 BridgeTransaction({\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 sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n\n // check haven't exceeded deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n\n // mark bridge transaction as relayed\n if (bridgeRelays[transactionId]) revert TransactionRelayed();\n bridgeRelays[transactionId] = true;\n\n // transfer tokens to recipient on destination chain and gas rebate if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n uint256 rebate = chainGasAmount;\n if (!transaction.sendChainGas) {\n // forward erc20\n rebate = 0;\n _pullToken(to, token, amount);\n } else if (token == UniversalTokenLib.ETH_ADDRESS) {\n // lump in gas rebate into amount in native gas token\n _pullToken(to, token, amount + rebate);\n } else {\n // forward erc20 then forward gas rebate in native gas token\n _pullToken(to, token, amount);\n _pullToken(to, UniversalTokenLib.ETH_ADDRESS, rebate);\n }\n\n emit BridgeRelayed(\n transactionId,\n msg.sender,\n to,\n transaction.originChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n rebate\n );\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n // update bridge tx status given proof provided\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = BridgeStatus.RELAYER_PROVED;\n bridgeProofs[transactionId] = BridgeProof({timestamp: uint96(block.timestamp), relayer: msg.sender}); // overflow ok\n\n emit BridgeProofProvided(transactionId, msg.sender, destTxHash);\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint96(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint96).max but\n /// proof.timestamp \u003c type(uint96).max via unchecked statement\n /// @param proof The bridge proof\n /// @return delta Time delta since proof submitted\n function _timeSince(BridgeProof memory proof) internal view returns (uint256 delta) {\n unchecked {\n delta = uint96(block.timestamp) - proof.timestamp;\n }\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != relayer) revert SenderIncorrect();\n return _timeSince(proof) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != msg.sender) revert SenderIncorrect();\n if (_timeSince(proof) \u003c= DISPUTE_PERIOD) revert DisputePeriodNotPassed();\n\n bridgeStatuses[transactionId] = 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, msg.sender, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeProofs[transactionId]) \u003e DISPUTE_PERIOD) revert DisputePeriodPassed();\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n delete bridgeProofs[transactionId];\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 BridgeTransaction memory transaction = getBridgeTransaction(request);\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 // set status to refunded if still in requested state\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = 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","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","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 ERC-20 Permit extension allowing approvals to be made via signatures, as defined in https://eips.ethereum.org/EIPS/eip-2612[ERC-2612]. Adds the {permit} method, which can be used to change an account's ERC-20 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.20+commit.a1b79de6\"},\"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 ERC-20 Permit extension allowing approvals to be made via signatures, as defined in https://eips.ethereum.org/EIPS/eip-2612[ERC-2612]. Adds the {permit} method, which can be used to change an account's ERC-20 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/FastBridge.sol\":\"IERC20Permit\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridge.sol\":{\"keccak256\":\"0x7da00701c906b2b78d838eb9c510ab5903b6dd7f8e5fb12d4c4710c350e3c919\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://faff50fb8d1f3cf10122c1b611d0987ca58f4099d90c17163816c90d3077bce7\",\"dweb:/ipfs/QmWKF2L9D18J9QXiMbm6ucj3x8ebjQtTrycnkNmB4q3JRo\"]}},\"version\":1}"},"hashes":{"DOMAIN_SEPARATOR()":"3644e515","nonces(address)":"7ecebe00","permit(address,address,uint256,uint256,uint8,bytes32,bytes32)":"d505accf"}},"solidity/FastBridge.sol:IFastBridge":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.20 ^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 pure 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/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// lib/openzeppelin-contracts/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 ERC-165 detection.\n */\ninterface IAccessControl {\n /**\n * @dev The `account` is missing a role.\n */\n error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);\n\n /**\n * @dev The caller of a function is not the expected one.\n *\n * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.\n */\n error AccessControlBadConfirmation();\n\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted 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// lib/openzeppelin-contracts/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 ERC-20 standard as defined in the ERC.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the value of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the value of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 value) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n * caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 value) external returns (bool);\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\n * allowance mechanism. `value` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n\n// lib/openzeppelin-contracts/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 ERC-20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[ERC-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC-20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n *\n * ==== Security Considerations\n *\n * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\n * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\n * considered as an intention to spend the allowance in any specific way. The second is that because permits have\n * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\n * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\n * generally recommended is:\n *\n * ```solidity\n * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\n * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\n * doThing(..., value);\n * }\n *\n * function doThing(..., uint256 value) public {\n * token.safeTransferFrom(msg.sender, address(this), value);\n * ...\n * }\n * ```\n *\n * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\n * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\n * {SafeERC20-safeTransferFrom}).\n *\n * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\n * contracts should have entry points that don't rely on permit.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also 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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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 ERC-165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[ERC].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n\n// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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 ERC-165 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// lib/openzeppelin-contracts/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 ERC-165 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// lib/openzeppelin-contracts/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 ERC-20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n /**\n * @dev An operation with an ERC-20 token failed.\n */\n error SafeERC20FailedOperation(address token);\n\n /**\n * @dev Indicates a failed `decreaseAllowance` request.\n */\n error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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/FastBridge.sol\n\ncontract FastBridge is IFastBridge, Admin {\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 enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeStatus) public bridgeStatuses;\n /// @notice Proof of relayed bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeProof) public bridgeProofs;\n /// @notice Whether bridge has been relayed on destination chain\n mapping(bytes32 =\u003e bool) public bridgeRelays;\n\n /// @dev to prevent replays\n uint256 public nonce;\n // @dev 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 /// @notice Pulls a requested token from the user to the requested recipient.\n /// @dev Be careful of re-entrancy issues when msg.value \u003e 0 and recipient != address(this)\n function _pullToken(address recipient, address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token != UniversalTokenLib.ETH_ADDRESS) {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(recipient);\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, recipient, amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(recipient) - amountPulled;\n } else {\n // Otherwise, we need to check that ETH amount matches msg.value\n if (amount != msg.value) revert MsgValueIncorrect();\n // Transfer value to recipient if not this address\n if (recipient != address(this)) token.universalTransfer(recipient, amount);\n // We will forward msg.value in the external call later, if recipient is not this contract\n amountPulled = msg.value;\n }\n }\n\n /// @inheritdoc IFastBridge\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n // check bridge params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\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\n // transfer tokens to bridge contract\n // @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(address(this), 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 BridgeTransaction({\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 sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n\n // check haven't exceeded deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n\n // mark bridge transaction as relayed\n if (bridgeRelays[transactionId]) revert TransactionRelayed();\n bridgeRelays[transactionId] = true;\n\n // transfer tokens to recipient on destination chain and gas rebate if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n uint256 rebate = chainGasAmount;\n if (!transaction.sendChainGas) {\n // forward erc20\n rebate = 0;\n _pullToken(to, token, amount);\n } else if (token == UniversalTokenLib.ETH_ADDRESS) {\n // lump in gas rebate into amount in native gas token\n _pullToken(to, token, amount + rebate);\n } else {\n // forward erc20 then forward gas rebate in native gas token\n _pullToken(to, token, amount);\n _pullToken(to, UniversalTokenLib.ETH_ADDRESS, rebate);\n }\n\n emit BridgeRelayed(\n transactionId,\n msg.sender,\n to,\n transaction.originChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n rebate\n );\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n // update bridge tx status given proof provided\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = BridgeStatus.RELAYER_PROVED;\n bridgeProofs[transactionId] = BridgeProof({timestamp: uint96(block.timestamp), relayer: msg.sender}); // overflow ok\n\n emit BridgeProofProvided(transactionId, msg.sender, destTxHash);\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint96(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint96).max but\n /// proof.timestamp \u003c type(uint96).max via unchecked statement\n /// @param proof The bridge proof\n /// @return delta Time delta since proof submitted\n function _timeSince(BridgeProof memory proof) internal view returns (uint256 delta) {\n unchecked {\n delta = uint96(block.timestamp) - proof.timestamp;\n }\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != relayer) revert SenderIncorrect();\n return _timeSince(proof) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != msg.sender) revert SenderIncorrect();\n if (_timeSince(proof) \u003c= DISPUTE_PERIOD) revert DisputePeriodNotPassed();\n\n bridgeStatuses[transactionId] = 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, msg.sender, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeProofs[transactionId]) \u003e DISPUTE_PERIOD) revert DisputePeriodPassed();\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n delete bridgeProofs[transactionId];\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 BridgeTransaction memory transaction = getBridgeTransaction(request);\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 // set status to refunded if still in requested state\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = 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","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","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":"pure","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.20+commit.a1b79de6\"},\"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\":\"pure\",\"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/FastBridge.sol\":\"IFastBridge\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridge.sol\":{\"keccak256\":\"0x7da00701c906b2b78d838eb9c510ab5903b6dd7f8e5fb12d4c4710c350e3c919\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://faff50fb8d1f3cf10122c1b611d0987ca58f4099d90c17163816c90d3077bce7\",\"dweb:/ipfs/QmWKF2L9D18J9QXiMbm6ucj3x8ebjQtTrycnkNmB4q3JRo\"]}},\"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/FastBridge.sol:SafeERC20":{"code":"0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220c6ed48084fea72d6c821edce7a5b7849414ac26c2e14da8d9184448698b54a2964736f6c63430008140033","runtime-code":"0x73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220c6ed48084fea72d6c821edce7a5b7849414ac26c2e14da8d9184448698b54a2964736f6c63430008140033","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.20 ^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 pure 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/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// lib/openzeppelin-contracts/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 ERC-165 detection.\n */\ninterface IAccessControl {\n /**\n * @dev The `account` is missing a role.\n */\n error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);\n\n /**\n * @dev The caller of a function is not the expected one.\n *\n * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.\n */\n error AccessControlBadConfirmation();\n\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted 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// lib/openzeppelin-contracts/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 ERC-20 standard as defined in the ERC.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the value of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the value of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 value) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n * caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 value) external returns (bool);\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\n * allowance mechanism. `value` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n\n// lib/openzeppelin-contracts/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 ERC-20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[ERC-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC-20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n *\n * ==== Security Considerations\n *\n * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\n * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\n * considered as an intention to spend the allowance in any specific way. The second is that because permits have\n * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\n * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\n * generally recommended is:\n *\n * ```solidity\n * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\n * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\n * doThing(..., value);\n * }\n *\n * function doThing(..., uint256 value) public {\n * token.safeTransferFrom(msg.sender, address(this), value);\n * ...\n * }\n * ```\n *\n * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\n * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\n * {SafeERC20-safeTransferFrom}).\n *\n * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\n * contracts should have entry points that don't rely on permit.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also 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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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 ERC-165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[ERC].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n\n// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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 ERC-165 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// lib/openzeppelin-contracts/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 ERC-165 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// lib/openzeppelin-contracts/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 ERC-20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n /**\n * @dev An operation with an ERC-20 token failed.\n */\n error SafeERC20FailedOperation(address token);\n\n /**\n * @dev Indicates a failed `decreaseAllowance` request.\n */\n error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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/FastBridge.sol\n\ncontract FastBridge is IFastBridge, Admin {\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 enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeStatus) public bridgeStatuses;\n /// @notice Proof of relayed bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeProof) public bridgeProofs;\n /// @notice Whether bridge has been relayed on destination chain\n mapping(bytes32 =\u003e bool) public bridgeRelays;\n\n /// @dev to prevent replays\n uint256 public nonce;\n // @dev 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 /// @notice Pulls a requested token from the user to the requested recipient.\n /// @dev Be careful of re-entrancy issues when msg.value \u003e 0 and recipient != address(this)\n function _pullToken(address recipient, address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token != UniversalTokenLib.ETH_ADDRESS) {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(recipient);\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, recipient, amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(recipient) - amountPulled;\n } else {\n // Otherwise, we need to check that ETH amount matches msg.value\n if (amount != msg.value) revert MsgValueIncorrect();\n // Transfer value to recipient if not this address\n if (recipient != address(this)) token.universalTransfer(recipient, amount);\n // We will forward msg.value in the external call later, if recipient is not this contract\n amountPulled = msg.value;\n }\n }\n\n /// @inheritdoc IFastBridge\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n // check bridge params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\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\n // transfer tokens to bridge contract\n // @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(address(this), 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 BridgeTransaction({\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 sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n\n // check haven't exceeded deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n\n // mark bridge transaction as relayed\n if (bridgeRelays[transactionId]) revert TransactionRelayed();\n bridgeRelays[transactionId] = true;\n\n // transfer tokens to recipient on destination chain and gas rebate if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n uint256 rebate = chainGasAmount;\n if (!transaction.sendChainGas) {\n // forward erc20\n rebate = 0;\n _pullToken(to, token, amount);\n } else if (token == UniversalTokenLib.ETH_ADDRESS) {\n // lump in gas rebate into amount in native gas token\n _pullToken(to, token, amount + rebate);\n } else {\n // forward erc20 then forward gas rebate in native gas token\n _pullToken(to, token, amount);\n _pullToken(to, UniversalTokenLib.ETH_ADDRESS, rebate);\n }\n\n emit BridgeRelayed(\n transactionId,\n msg.sender,\n to,\n transaction.originChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n rebate\n );\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n // update bridge tx status given proof provided\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = BridgeStatus.RELAYER_PROVED;\n bridgeProofs[transactionId] = BridgeProof({timestamp: uint96(block.timestamp), relayer: msg.sender}); // overflow ok\n\n emit BridgeProofProvided(transactionId, msg.sender, destTxHash);\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint96(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint96).max but\n /// proof.timestamp \u003c type(uint96).max via unchecked statement\n /// @param proof The bridge proof\n /// @return delta Time delta since proof submitted\n function _timeSince(BridgeProof memory proof) internal view returns (uint256 delta) {\n unchecked {\n delta = uint96(block.timestamp) - proof.timestamp;\n }\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != relayer) revert SenderIncorrect();\n return _timeSince(proof) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != msg.sender) revert SenderIncorrect();\n if (_timeSince(proof) \u003c= DISPUTE_PERIOD) revert DisputePeriodNotPassed();\n\n bridgeStatuses[transactionId] = 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, msg.sender, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeProofs[transactionId]) \u003e DISPUTE_PERIOD) revert DisputePeriodPassed();\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n delete bridgeProofs[transactionId];\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 BridgeTransaction memory transaction = getBridgeTransaction(request);\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 // set status to refunded if still in requested state\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = 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","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","compilerOptions":"--combined-json bin,bin-runtime,srcmap,srcmap-runtime,abi,userdoc,devdoc,metadata,hashes --optimize --optimize-runs 10000 --allow-paths ., ./, ../ --evm-version=istanbul","srcMap":"39265:5019:0:-:0;;;;;;;;;;;;;;;-1:-1:-1;;;39265:5019:0;;;;;;;;;;;;;;;;;","srcMapRuntime":"39265:5019: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 ERC-20 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 ERC-20 token failed."}]},"kind":"dev","methods":{},"title":"SafeERC20","version":1},"metadata":"{\"compiler\":{\"version\":\"0.8.20+commit.a1b79de6\"},\"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 ERC-20 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 ERC-20 token failed.\"}]},\"kind\":\"dev\",\"methods\":{},\"title\":\"SafeERC20\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/FastBridge.sol\":\"SafeERC20\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridge.sol\":{\"keccak256\":\"0x7da00701c906b2b78d838eb9c510ab5903b6dd7f8e5fb12d4c4710c350e3c919\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://faff50fb8d1f3cf10122c1b611d0987ca58f4099d90c17163816c90d3077bce7\",\"dweb:/ipfs/QmWKF2L9D18J9QXiMbm6ucj3x8ebjQtTrycnkNmB4q3JRo\"]}},\"version\":1}"},"hashes":{}},"solidity/FastBridge.sol:UniversalTokenLib":{"code":"0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea264697066735822122054dc3657c8fde761d2c05cf2a9b92991c4c740565f4124cc2177c16ea935345764736f6c63430008140033","runtime-code":"0x73000000000000000000000000000000000000000030146080604052600080fdfea264697066735822122054dc3657c8fde761d2c05cf2a9b92991c4c740565f4124cc2177c16ea935345764736f6c63430008140033","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.20 ^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 pure 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/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// lib/openzeppelin-contracts/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 ERC-165 detection.\n */\ninterface IAccessControl {\n /**\n * @dev The `account` is missing a role.\n */\n error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);\n\n /**\n * @dev The caller of a function is not the expected one.\n *\n * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.\n */\n error AccessControlBadConfirmation();\n\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted 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// lib/openzeppelin-contracts/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 ERC-20 standard as defined in the ERC.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the value of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the value of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 value) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n * caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 value) external returns (bool);\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\n * allowance mechanism. `value` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n\n// lib/openzeppelin-contracts/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 ERC-20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[ERC-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC-20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n *\n * ==== Security Considerations\n *\n * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\n * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\n * considered as an intention to spend the allowance in any specific way. The second is that because permits have\n * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\n * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\n * generally recommended is:\n *\n * ```solidity\n * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\n * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\n * doThing(..., value);\n * }\n *\n * function doThing(..., uint256 value) public {\n * token.safeTransferFrom(msg.sender, address(this), value);\n * ...\n * }\n * ```\n *\n * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\n * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\n * {SafeERC20-safeTransferFrom}).\n *\n * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\n * contracts should have entry points that don't rely on permit.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also 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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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 ERC-165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[ERC].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n\n// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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 ERC-165 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// lib/openzeppelin-contracts/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 ERC-165 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// lib/openzeppelin-contracts/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 ERC-20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n /**\n * @dev An operation with an ERC-20 token failed.\n */\n error SafeERC20FailedOperation(address token);\n\n /**\n * @dev Indicates a failed `decreaseAllowance` request.\n */\n error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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/FastBridge.sol\n\ncontract FastBridge is IFastBridge, Admin {\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 enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeStatus) public bridgeStatuses;\n /// @notice Proof of relayed bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeProof) public bridgeProofs;\n /// @notice Whether bridge has been relayed on destination chain\n mapping(bytes32 =\u003e bool) public bridgeRelays;\n\n /// @dev to prevent replays\n uint256 public nonce;\n // @dev 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 /// @notice Pulls a requested token from the user to the requested recipient.\n /// @dev Be careful of re-entrancy issues when msg.value \u003e 0 and recipient != address(this)\n function _pullToken(address recipient, address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token != UniversalTokenLib.ETH_ADDRESS) {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(recipient);\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, recipient, amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(recipient) - amountPulled;\n } else {\n // Otherwise, we need to check that ETH amount matches msg.value\n if (amount != msg.value) revert MsgValueIncorrect();\n // Transfer value to recipient if not this address\n if (recipient != address(this)) token.universalTransfer(recipient, amount);\n // We will forward msg.value in the external call later, if recipient is not this contract\n amountPulled = msg.value;\n }\n }\n\n /// @inheritdoc IFastBridge\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n // check bridge params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\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\n // transfer tokens to bridge contract\n // @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(address(this), 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 BridgeTransaction({\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 sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n\n // check haven't exceeded deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n\n // mark bridge transaction as relayed\n if (bridgeRelays[transactionId]) revert TransactionRelayed();\n bridgeRelays[transactionId] = true;\n\n // transfer tokens to recipient on destination chain and gas rebate if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n uint256 rebate = chainGasAmount;\n if (!transaction.sendChainGas) {\n // forward erc20\n rebate = 0;\n _pullToken(to, token, amount);\n } else if (token == UniversalTokenLib.ETH_ADDRESS) {\n // lump in gas rebate into amount in native gas token\n _pullToken(to, token, amount + rebate);\n } else {\n // forward erc20 then forward gas rebate in native gas token\n _pullToken(to, token, amount);\n _pullToken(to, UniversalTokenLib.ETH_ADDRESS, rebate);\n }\n\n emit BridgeRelayed(\n transactionId,\n msg.sender,\n to,\n transaction.originChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n rebate\n );\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n // update bridge tx status given proof provided\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = BridgeStatus.RELAYER_PROVED;\n bridgeProofs[transactionId] = BridgeProof({timestamp: uint96(block.timestamp), relayer: msg.sender}); // overflow ok\n\n emit BridgeProofProvided(transactionId, msg.sender, destTxHash);\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint96(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint96).max but\n /// proof.timestamp \u003c type(uint96).max via unchecked statement\n /// @param proof The bridge proof\n /// @return delta Time delta since proof submitted\n function _timeSince(BridgeProof memory proof) internal view returns (uint256 delta) {\n unchecked {\n delta = uint96(block.timestamp) - proof.timestamp;\n }\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != relayer) revert SenderIncorrect();\n return _timeSince(proof) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != msg.sender) revert SenderIncorrect();\n if (_timeSince(proof) \u003c= DISPUTE_PERIOD) revert DisputePeriodNotPassed();\n\n bridgeStatuses[transactionId] = 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, msg.sender, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeProofs[transactionId]) \u003e DISPUTE_PERIOD) revert DisputePeriodPassed();\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n delete bridgeProofs[transactionId];\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 BridgeTransaction memory transaction = getBridgeTransaction(request);\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 // set status to refunded if still in requested state\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = 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","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","compilerOptions":"--combined-json bin,bin-runtime,srcmap,srcmap-runtime,abi,userdoc,devdoc,metadata,hashes --optimize --optimize-runs 10000 --allow-paths ., ./, ../ --evm-version=istanbul","srcMap":"51225:2551:0:-:0;;;;;;;;;;;;;;;-1:-1:-1;;;51225:2551:0;;;;;;;;;;;;;;;;;","srcMapRuntime":"51225:2551:0:-:0;;;;;;;;","abiDefinition":[],"userDoc":{"kind":"user","methods":{},"version":1},"developerDoc":{"kind":"dev","methods":{},"version":1},"metadata":"{\"compiler\":{\"version\":\"0.8.20+commit.a1b79de6\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/FastBridge.sol\":\"UniversalTokenLib\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridge.sol\":{\"keccak256\":\"0x7da00701c906b2b78d838eb9c510ab5903b6dd7f8e5fb12d4c4710c350e3c919\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://faff50fb8d1f3cf10122c1b611d0987ca58f4099d90c17163816c90d3077bce7\",\"dweb:/ipfs/QmWKF2L9D18J9QXiMbm6ucj3x8ebjQtTrycnkNmB4q3JRo\"]}},\"version\":1}"},"hashes":{}}} \ No newline at end of file +{"solidity/FastBridge.sol:AccessControl":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.20 ^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 pure 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/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// 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/FastBridge.sol\n\ncontract FastBridge is IFastBridge, Admin {\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 enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeStatus) public bridgeStatuses;\n /// @notice Proof of relayed bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeProof) public bridgeProofs;\n /// @notice Whether bridge has been relayed on destination chain\n mapping(bytes32 =\u003e bool) public bridgeRelays;\n\n /// @dev to prevent replays\n uint256 public nonce;\n // @dev 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 /// @notice Pulls a requested token from the user to the requested recipient.\n /// @dev Be careful of re-entrancy issues when msg.value \u003e 0 and recipient != address(this)\n function _pullToken(address recipient, address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token != UniversalTokenLib.ETH_ADDRESS) {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(recipient);\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, recipient, amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(recipient) - amountPulled;\n } else {\n // Otherwise, we need to check that ETH amount matches msg.value\n if (amount != msg.value) revert MsgValueIncorrect();\n // Transfer value to recipient if not this address\n if (recipient != address(this)) token.universalTransfer(recipient, amount);\n // We will forward msg.value in the external call later, if recipient is not this contract\n amountPulled = msg.value;\n }\n }\n\n /// @inheritdoc IFastBridge\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n // check bridge params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\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\n // transfer tokens to bridge contract\n // @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(address(this), 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 BridgeTransaction({\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 sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n\n // check haven't exceeded deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n\n // mark bridge transaction as relayed\n if (bridgeRelays[transactionId]) revert TransactionRelayed();\n bridgeRelays[transactionId] = true;\n\n // transfer tokens to recipient on destination chain and gas rebate if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n uint256 rebate = chainGasAmount;\n if (!transaction.sendChainGas) {\n // forward erc20\n rebate = 0;\n _pullToken(to, token, amount);\n } else if (token == UniversalTokenLib.ETH_ADDRESS) {\n // lump in gas rebate into amount in native gas token\n _pullToken(to, token, amount + rebate);\n } else {\n // forward erc20 then forward gas rebate in native gas token\n _pullToken(to, token, amount);\n _pullToken(to, UniversalTokenLib.ETH_ADDRESS, rebate);\n }\n\n emit BridgeRelayed(\n transactionId,\n msg.sender,\n to,\n transaction.originChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n rebate\n );\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n // update bridge tx status given proof provided\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = BridgeStatus.RELAYER_PROVED;\n bridgeProofs[transactionId] = BridgeProof({timestamp: uint96(block.timestamp), relayer: msg.sender}); // overflow ok\n\n emit BridgeProofProvided(transactionId, msg.sender, destTxHash);\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint96(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint96).max but\n /// proof.timestamp \u003c type(uint96).max via unchecked statement\n /// @param proof The bridge proof\n /// @return delta Time delta since proof submitted\n function _timeSince(BridgeProof memory proof) internal view returns (uint256 delta) {\n unchecked {\n delta = uint96(block.timestamp) - proof.timestamp;\n }\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != relayer) revert SenderIncorrect();\n return _timeSince(proof) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != msg.sender) revert SenderIncorrect();\n if (_timeSince(proof) \u003c= DISPUTE_PERIOD) revert DisputePeriodNotPassed();\n\n bridgeStatuses[transactionId] = 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, msg.sender, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeProofs[transactionId]) \u003e DISPUTE_PERIOD) revert DisputePeriodPassed();\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n delete bridgeProofs[transactionId];\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 BridgeTransaction memory transaction = getBridgeTransaction(request);\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 // set status to refunded if still in requested state\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = 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","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","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.20+commit.a1b79de6\"},\"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/FastBridge.sol\":\"AccessControl\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridge.sol\":{\"keccak256\":\"0xae743277f3eb2d2ec8189b107f86be1274c339a5e25efd78e2513a1adfb904cf\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://2adf46956fa5eb58f2073d4a611632ccc208ba24ea99e0a0e224cdce7b79b135\",\"dweb:/ipfs/QmU3RGCG6sstiJ4HUPg5RP7gNds74eBn7YMSCqQfRG8Cpb\"]}},\"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/FastBridge.sol:AccessControlEnumerable":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.20 ^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 pure 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/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// 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/FastBridge.sol\n\ncontract FastBridge is IFastBridge, Admin {\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 enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeStatus) public bridgeStatuses;\n /// @notice Proof of relayed bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeProof) public bridgeProofs;\n /// @notice Whether bridge has been relayed on destination chain\n mapping(bytes32 =\u003e bool) public bridgeRelays;\n\n /// @dev to prevent replays\n uint256 public nonce;\n // @dev 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 /// @notice Pulls a requested token from the user to the requested recipient.\n /// @dev Be careful of re-entrancy issues when msg.value \u003e 0 and recipient != address(this)\n function _pullToken(address recipient, address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token != UniversalTokenLib.ETH_ADDRESS) {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(recipient);\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, recipient, amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(recipient) - amountPulled;\n } else {\n // Otherwise, we need to check that ETH amount matches msg.value\n if (amount != msg.value) revert MsgValueIncorrect();\n // Transfer value to recipient if not this address\n if (recipient != address(this)) token.universalTransfer(recipient, amount);\n // We will forward msg.value in the external call later, if recipient is not this contract\n amountPulled = msg.value;\n }\n }\n\n /// @inheritdoc IFastBridge\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n // check bridge params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\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\n // transfer tokens to bridge contract\n // @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(address(this), 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 BridgeTransaction({\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 sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n\n // check haven't exceeded deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n\n // mark bridge transaction as relayed\n if (bridgeRelays[transactionId]) revert TransactionRelayed();\n bridgeRelays[transactionId] = true;\n\n // transfer tokens to recipient on destination chain and gas rebate if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n uint256 rebate = chainGasAmount;\n if (!transaction.sendChainGas) {\n // forward erc20\n rebate = 0;\n _pullToken(to, token, amount);\n } else if (token == UniversalTokenLib.ETH_ADDRESS) {\n // lump in gas rebate into amount in native gas token\n _pullToken(to, token, amount + rebate);\n } else {\n // forward erc20 then forward gas rebate in native gas token\n _pullToken(to, token, amount);\n _pullToken(to, UniversalTokenLib.ETH_ADDRESS, rebate);\n }\n\n emit BridgeRelayed(\n transactionId,\n msg.sender,\n to,\n transaction.originChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n rebate\n );\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n // update bridge tx status given proof provided\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = BridgeStatus.RELAYER_PROVED;\n bridgeProofs[transactionId] = BridgeProof({timestamp: uint96(block.timestamp), relayer: msg.sender}); // overflow ok\n\n emit BridgeProofProvided(transactionId, msg.sender, destTxHash);\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint96(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint96).max but\n /// proof.timestamp \u003c type(uint96).max via unchecked statement\n /// @param proof The bridge proof\n /// @return delta Time delta since proof submitted\n function _timeSince(BridgeProof memory proof) internal view returns (uint256 delta) {\n unchecked {\n delta = uint96(block.timestamp) - proof.timestamp;\n }\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != relayer) revert SenderIncorrect();\n return _timeSince(proof) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != msg.sender) revert SenderIncorrect();\n if (_timeSince(proof) \u003c= DISPUTE_PERIOD) revert DisputePeriodNotPassed();\n\n bridgeStatuses[transactionId] = 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, msg.sender, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeProofs[transactionId]) \u003e DISPUTE_PERIOD) revert DisputePeriodPassed();\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n delete bridgeProofs[transactionId];\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 BridgeTransaction memory transaction = getBridgeTransaction(request);\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 // set status to refunded if still in requested state\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = 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","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","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.20+commit.a1b79de6\"},\"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/FastBridge.sol\":\"AccessControlEnumerable\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridge.sol\":{\"keccak256\":\"0xae743277f3eb2d2ec8189b107f86be1274c339a5e25efd78e2513a1adfb904cf\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://2adf46956fa5eb58f2073d4a611632ccc208ba24ea99e0a0e224cdce7b79b135\",\"dweb:/ipfs/QmU3RGCG6sstiJ4HUPg5RP7gNds74eBn7YMSCqQfRG8Cpb\"]}},\"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/FastBridge.sol:Address":{"code":"0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220c02bf2e5594888dce767567f7c2924eb180fd6f6904899db27dad663ca8f547864736f6c63430008140033","runtime-code":"0x73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220c02bf2e5594888dce767567f7c2924eb180fd6f6904899db27dad663ca8f547864736f6c63430008140033","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.20 ^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 pure 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/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// 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/FastBridge.sol\n\ncontract FastBridge is IFastBridge, Admin {\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 enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeStatus) public bridgeStatuses;\n /// @notice Proof of relayed bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeProof) public bridgeProofs;\n /// @notice Whether bridge has been relayed on destination chain\n mapping(bytes32 =\u003e bool) public bridgeRelays;\n\n /// @dev to prevent replays\n uint256 public nonce;\n // @dev 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 /// @notice Pulls a requested token from the user to the requested recipient.\n /// @dev Be careful of re-entrancy issues when msg.value \u003e 0 and recipient != address(this)\n function _pullToken(address recipient, address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token != UniversalTokenLib.ETH_ADDRESS) {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(recipient);\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, recipient, amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(recipient) - amountPulled;\n } else {\n // Otherwise, we need to check that ETH amount matches msg.value\n if (amount != msg.value) revert MsgValueIncorrect();\n // Transfer value to recipient if not this address\n if (recipient != address(this)) token.universalTransfer(recipient, amount);\n // We will forward msg.value in the external call later, if recipient is not this contract\n amountPulled = msg.value;\n }\n }\n\n /// @inheritdoc IFastBridge\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n // check bridge params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\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\n // transfer tokens to bridge contract\n // @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(address(this), 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 BridgeTransaction({\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 sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n\n // check haven't exceeded deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n\n // mark bridge transaction as relayed\n if (bridgeRelays[transactionId]) revert TransactionRelayed();\n bridgeRelays[transactionId] = true;\n\n // transfer tokens to recipient on destination chain and gas rebate if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n uint256 rebate = chainGasAmount;\n if (!transaction.sendChainGas) {\n // forward erc20\n rebate = 0;\n _pullToken(to, token, amount);\n } else if (token == UniversalTokenLib.ETH_ADDRESS) {\n // lump in gas rebate into amount in native gas token\n _pullToken(to, token, amount + rebate);\n } else {\n // forward erc20 then forward gas rebate in native gas token\n _pullToken(to, token, amount);\n _pullToken(to, UniversalTokenLib.ETH_ADDRESS, rebate);\n }\n\n emit BridgeRelayed(\n transactionId,\n msg.sender,\n to,\n transaction.originChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n rebate\n );\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n // update bridge tx status given proof provided\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = BridgeStatus.RELAYER_PROVED;\n bridgeProofs[transactionId] = BridgeProof({timestamp: uint96(block.timestamp), relayer: msg.sender}); // overflow ok\n\n emit BridgeProofProvided(transactionId, msg.sender, destTxHash);\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint96(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint96).max but\n /// proof.timestamp \u003c type(uint96).max via unchecked statement\n /// @param proof The bridge proof\n /// @return delta Time delta since proof submitted\n function _timeSince(BridgeProof memory proof) internal view returns (uint256 delta) {\n unchecked {\n delta = uint96(block.timestamp) - proof.timestamp;\n }\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != relayer) revert SenderIncorrect();\n return _timeSince(proof) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != msg.sender) revert SenderIncorrect();\n if (_timeSince(proof) \u003c= DISPUTE_PERIOD) revert DisputePeriodNotPassed();\n\n bridgeStatuses[transactionId] = 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, msg.sender, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeProofs[transactionId]) \u003e DISPUTE_PERIOD) revert DisputePeriodPassed();\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n delete bridgeProofs[transactionId];\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 BridgeTransaction memory transaction = getBridgeTransaction(request);\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 // set status to refunded if still in requested state\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = 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","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","compilerOptions":"--combined-json bin,bin-runtime,srcmap,srcmap-runtime,abi,userdoc,devdoc,metadata,hashes --optimize --optimize-runs 10000 --allow-paths ., ./, ../ --evm-version=istanbul","srcMap":"15598:6066:0:-:0;;;;;;;;;;;;;;;-1:-1:-1;;;15598:6066:0;;;;;;;;;;;;;;;;;","srcMapRuntime":"15598: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.20+commit.a1b79de6\"},\"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/FastBridge.sol\":\"Address\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridge.sol\":{\"keccak256\":\"0xae743277f3eb2d2ec8189b107f86be1274c339a5e25efd78e2513a1adfb904cf\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://2adf46956fa5eb58f2073d4a611632ccc208ba24ea99e0a0e224cdce7b79b135\",\"dweb:/ipfs/QmU3RGCG6sstiJ4HUPg5RP7gNds74eBn7YMSCqQfRG8Cpb\"]}},\"version\":1}"},"hashes":{}},"solidity/FastBridge.sol:Admin":{"code":"0x60806040523480156200001157600080fd5b50604051620014123803806200141283398101604081905262000034916200018e565b6200004160008262000049565b5050620001b9565b60008062000058848462000086565b905080156200007d5760008481526001602052604090206200007b908462000134565b505b90505b92915050565b6000828152602081815260408083206001600160a01b038516845290915281205460ff166200012b576000838152602081815260408083206001600160a01b03861684529091529020805460ff19166001179055620000e23390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a450600162000080565b50600062000080565b60006200007d836001600160a01b03841660008181526001830160205260408120546200012b5750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915562000080565b600060208284031215620001a157600080fd5b81516001600160a01b03811681146200007d57600080fd5b61124980620001c96000396000f3fe608060405234801561001057600080fd5b50600436106101775760003560e01c806391d14854116100d8578063bf333f2c1161008c578063d547741f11610066578063d547741f14610385578063dcf844a714610398578063e00a83e0146103b857600080fd5b8063bf333f2c14610341578063ca15c8731461034b578063ccc574901461035e57600080fd5b8063a217fddf116100bd578063a217fddf14610313578063b13aa2d61461031b578063b250fe6b1461032e57600080fd5b806391d14854146102a8578063926d7d7f146102ec57600080fd5b80632f2ff15d1161012f57806358f858801161011457806358f85880146102405780635960ccf2146102495780639010d07c1461027057600080fd5b80632f2ff15d1461021a57806336568abe1461022d57600080fd5b806306f333f21161016057806306f333f2146101d95780630f5f6ed7146101ee578063248a9ca3146101f757600080fd5b806301ffc9a71461017c57806303ed0ee5146101a4575b600080fd5b61018f61018a366004611013565b6103c1565b60405190151581526020015b60405180910390f35b6101cb7f043c983c49d46f0e102151eaf8085d4a2e6571d5df2d47b013f39bddfd4a639d81565b60405190815260200161019b565b6101ec6101e736600461107e565b61041d565b005b6101cb61271081565b6101cb6102053660046110b1565b60009081526020819052604090206001015490565b6101ec6102283660046110ca565b61050b565b6101ec61023b3660046110ca565b610536565b6101cb60025481565b6101cb7fdb9556138406326f00296e13ea2ad7db24ba82381212d816b1a40c23b466b32781565b61028361027e3660046110ed565b61058f565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161019b565b61018f6102b63660046110ca565b60009182526020828152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b6101cb7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc481565b6101cb600081565b6101ec6103293660046110b1565b6105ae565b6101ec61033c3660046110b1565b610690565b6101cb620f424081565b6101cb6103593660046110b1565b6106f8565b6101cb7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5581565b6101ec6103933660046110ca565b61070f565b6101cb6103a636600461110f565b60036020526000908152604090205481565b6101cb60045481565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f5a05180f000000000000000000000000000000000000000000000000000000001480610417575061041782610734565b92915050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f55610447816107cb565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600360205260408120549081900361047b5750505050565b73ffffffffffffffffffffffffffffffffffffffff84166000818152600360205260408120556104ac9084836107d8565b6040805173ffffffffffffffffffffffffffffffffffffffff8087168252851660208201529081018290527f244e51bc38c1452fa8aaf487bcb4bca36c2baa3a5fbdb776b1eabd8dc6d277cd9060600160405180910390a1505b505050565b600082815260208190526040902060010154610526816107cb565b610530838361092f565b50505050565b73ffffffffffffffffffffffffffffffffffffffff81163314610585576040517f6697b23200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6105068282610964565b60008281526001602052604081206105a79083610991565b9392505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f556105d8816107cb565b612710821115610649576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f6e657746656552617465203e206d61780000000000000000000000000000000060448201526064015b60405180910390fd5b600280549083905560408051828152602081018590527f14914da2bf76024616fbe1859783fcd4dbddcb179b1f3a854949fbf920dcb95791015b60405180910390a1505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f556106ba816107cb565b600480549083905560408051828152602081018590527f5cf09b12f3f56b4c564d51b25b40360af6d795198adb61ae0806a36c294323fa9101610683565b60008181526001602052604081206104179061099d565b60008281526020819052604090206001015461072a816107cb565b6105308383610964565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061041757507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614610417565b6107d581336109a7565b50565b3073ffffffffffffffffffffffffffffffffffffffff8316036107fa57505050565b8060000361080757505050565b7fffffffffffffffffffffffff111111111111111111111111111111111111111273ffffffffffffffffffffffffffffffffffffffff84160161090e5760008273ffffffffffffffffffffffffffffffffffffffff168260405160006040518083038185875af1925050503d806000811461089e576040519150601f19603f3d011682016040523d82523d6000602084013e6108a3565b606091505b5050905080610530576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f455448207472616e73666572206661696c6564000000000000000000000000006044820152606401610640565b61050673ffffffffffffffffffffffffffffffffffffffff84168383610a31565b60008061093c8484610abe565b905080156105a757600084815260016020526040902061095c9084610bba565b509392505050565b6000806109718484610bdc565b905080156105a757600084815260016020526040902061095c9084610c97565b60006105a78383610cb9565b6000610417825490565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16610a2d576040517fe2517d3f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8216600482015260248101839052604401610640565b5050565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000179052610506908490610ce3565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915281205460ff16610bb25760008381526020818152604080832073ffffffffffffffffffffffffffffffffffffffff86168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055610b503390565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a4506001610417565b506000610417565b60006105a78373ffffffffffffffffffffffffffffffffffffffff8416610d79565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915281205460ff1615610bb25760008381526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8616808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a4506001610417565b60006105a78373ffffffffffffffffffffffffffffffffffffffff8416610dc0565b6000826000018281548110610cd057610cd061112a565b9060005260206000200154905092915050565b6000610d0573ffffffffffffffffffffffffffffffffffffffff841683610eb3565b90508051600014158015610d2a575080806020019051810190610d289190611159565b155b15610506576040517f5274afe700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84166004820152602401610640565b6000818152600183016020526040812054610bb257508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610417565b60008181526001830160205260408120548015610ea9576000610de460018361117b565b8554909150600090610df89060019061117b565b9050808214610e5d576000866000018281548110610e1857610e1861112a565b9060005260206000200154905080876000018481548110610e3b57610e3b61112a565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080610e6e57610e6e6111b5565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610417565b6000915050610417565b60606105a783836000846000808573ffffffffffffffffffffffffffffffffffffffff168486604051610ee691906111e4565b60006040518083038185875af1925050503d8060008114610f23576040519150601f19603f3d011682016040523d82523d6000602084013e610f28565b606091505b5091509150610f38868383610f42565b9695505050505050565b606082610f5757610f5282610fd1565b6105a7565b8151158015610f7b575073ffffffffffffffffffffffffffffffffffffffff84163b155b15610fca576040517f9996b31500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85166004820152602401610640565b50806105a7565b805115610fe15780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006020828403121561102557600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146105a757600080fd5b803573ffffffffffffffffffffffffffffffffffffffff8116811461107957600080fd5b919050565b6000806040838503121561109157600080fd5b61109a83611055565b91506110a860208401611055565b90509250929050565b6000602082840312156110c357600080fd5b5035919050565b600080604083850312156110dd57600080fd5b823591506110a860208401611055565b6000806040838503121561110057600080fd5b50508035926020909101359150565b60006020828403121561112157600080fd5b6105a782611055565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006020828403121561116b57600080fd5b815180151581146105a757600080fd5b81810381811115610417577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b6000825160005b8181101561120557602081860181015185830152016111eb565b50600092019182525091905056fea26469706673582212207051827fc52cd8db023eca7a58610870ecfcd93ea76d5ed3296b385ea81ce18e64736f6c63430008140033","runtime-code":"0x608060405234801561001057600080fd5b50600436106101775760003560e01c806391d14854116100d8578063bf333f2c1161008c578063d547741f11610066578063d547741f14610385578063dcf844a714610398578063e00a83e0146103b857600080fd5b8063bf333f2c14610341578063ca15c8731461034b578063ccc574901461035e57600080fd5b8063a217fddf116100bd578063a217fddf14610313578063b13aa2d61461031b578063b250fe6b1461032e57600080fd5b806391d14854146102a8578063926d7d7f146102ec57600080fd5b80632f2ff15d1161012f57806358f858801161011457806358f85880146102405780635960ccf2146102495780639010d07c1461027057600080fd5b80632f2ff15d1461021a57806336568abe1461022d57600080fd5b806306f333f21161016057806306f333f2146101d95780630f5f6ed7146101ee578063248a9ca3146101f757600080fd5b806301ffc9a71461017c57806303ed0ee5146101a4575b600080fd5b61018f61018a366004611013565b6103c1565b60405190151581526020015b60405180910390f35b6101cb7f043c983c49d46f0e102151eaf8085d4a2e6571d5df2d47b013f39bddfd4a639d81565b60405190815260200161019b565b6101ec6101e736600461107e565b61041d565b005b6101cb61271081565b6101cb6102053660046110b1565b60009081526020819052604090206001015490565b6101ec6102283660046110ca565b61050b565b6101ec61023b3660046110ca565b610536565b6101cb60025481565b6101cb7fdb9556138406326f00296e13ea2ad7db24ba82381212d816b1a40c23b466b32781565b61028361027e3660046110ed565b61058f565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161019b565b61018f6102b63660046110ca565b60009182526020828152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b6101cb7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc481565b6101cb600081565b6101ec6103293660046110b1565b6105ae565b6101ec61033c3660046110b1565b610690565b6101cb620f424081565b6101cb6103593660046110b1565b6106f8565b6101cb7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5581565b6101ec6103933660046110ca565b61070f565b6101cb6103a636600461110f565b60036020526000908152604090205481565b6101cb60045481565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f5a05180f000000000000000000000000000000000000000000000000000000001480610417575061041782610734565b92915050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f55610447816107cb565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600360205260408120549081900361047b5750505050565b73ffffffffffffffffffffffffffffffffffffffff84166000818152600360205260408120556104ac9084836107d8565b6040805173ffffffffffffffffffffffffffffffffffffffff8087168252851660208201529081018290527f244e51bc38c1452fa8aaf487bcb4bca36c2baa3a5fbdb776b1eabd8dc6d277cd9060600160405180910390a1505b505050565b600082815260208190526040902060010154610526816107cb565b610530838361092f565b50505050565b73ffffffffffffffffffffffffffffffffffffffff81163314610585576040517f6697b23200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6105068282610964565b60008281526001602052604081206105a79083610991565b9392505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f556105d8816107cb565b612710821115610649576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f6e657746656552617465203e206d61780000000000000000000000000000000060448201526064015b60405180910390fd5b600280549083905560408051828152602081018590527f14914da2bf76024616fbe1859783fcd4dbddcb179b1f3a854949fbf920dcb95791015b60405180910390a1505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f556106ba816107cb565b600480549083905560408051828152602081018590527f5cf09b12f3f56b4c564d51b25b40360af6d795198adb61ae0806a36c294323fa9101610683565b60008181526001602052604081206104179061099d565b60008281526020819052604090206001015461072a816107cb565b6105308383610964565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061041757507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614610417565b6107d581336109a7565b50565b3073ffffffffffffffffffffffffffffffffffffffff8316036107fa57505050565b8060000361080757505050565b7fffffffffffffffffffffffff111111111111111111111111111111111111111273ffffffffffffffffffffffffffffffffffffffff84160161090e5760008273ffffffffffffffffffffffffffffffffffffffff168260405160006040518083038185875af1925050503d806000811461089e576040519150601f19603f3d011682016040523d82523d6000602084013e6108a3565b606091505b5050905080610530576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f455448207472616e73666572206661696c6564000000000000000000000000006044820152606401610640565b61050673ffffffffffffffffffffffffffffffffffffffff84168383610a31565b60008061093c8484610abe565b905080156105a757600084815260016020526040902061095c9084610bba565b509392505050565b6000806109718484610bdc565b905080156105a757600084815260016020526040902061095c9084610c97565b60006105a78383610cb9565b6000610417825490565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16610a2d576040517fe2517d3f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8216600482015260248101839052604401610640565b5050565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000179052610506908490610ce3565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915281205460ff16610bb25760008381526020818152604080832073ffffffffffffffffffffffffffffffffffffffff86168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055610b503390565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a4506001610417565b506000610417565b60006105a78373ffffffffffffffffffffffffffffffffffffffff8416610d79565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915281205460ff1615610bb25760008381526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8616808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a4506001610417565b60006105a78373ffffffffffffffffffffffffffffffffffffffff8416610dc0565b6000826000018281548110610cd057610cd061112a565b9060005260206000200154905092915050565b6000610d0573ffffffffffffffffffffffffffffffffffffffff841683610eb3565b90508051600014158015610d2a575080806020019051810190610d289190611159565b155b15610506576040517f5274afe700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84166004820152602401610640565b6000818152600183016020526040812054610bb257508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610417565b60008181526001830160205260408120548015610ea9576000610de460018361117b565b8554909150600090610df89060019061117b565b9050808214610e5d576000866000018281548110610e1857610e1861112a565b9060005260206000200154905080876000018481548110610e3b57610e3b61112a565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080610e6e57610e6e6111b5565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610417565b6000915050610417565b60606105a783836000846000808573ffffffffffffffffffffffffffffffffffffffff168486604051610ee691906111e4565b60006040518083038185875af1925050503d8060008114610f23576040519150601f19603f3d011682016040523d82523d6000602084013e610f28565b606091505b5091509150610f38868383610f42565b9695505050505050565b606082610f5757610f5282610fd1565b6105a7565b8151158015610f7b575073ffffffffffffffffffffffffffffffffffffffff84163b155b15610fca576040517f9996b31500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85166004820152602401610640565b50806105a7565b805115610fe15780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006020828403121561102557600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146105a757600080fd5b803573ffffffffffffffffffffffffffffffffffffffff8116811461107957600080fd5b919050565b6000806040838503121561109157600080fd5b61109a83611055565b91506110a860208401611055565b90509250929050565b6000602082840312156110c357600080fd5b5035919050565b600080604083850312156110dd57600080fd5b823591506110a860208401611055565b6000806040838503121561110057600080fd5b50508035926020909101359150565b60006020828403121561112157600080fd5b6105a782611055565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006020828403121561116b57600080fd5b815180151581146105a757600080fd5b81810381811115610417577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b6000825160005b8181101561120557602081860181015185830152016111eb565b50600092019182525091905056fea26469706673582212207051827fc52cd8db023eca7a58610870ecfcd93ea76d5ed3296b385ea81ce18e64736f6c63430008140033","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.20 ^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 pure 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/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// 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/FastBridge.sol\n\ncontract FastBridge is IFastBridge, Admin {\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 enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeStatus) public bridgeStatuses;\n /// @notice Proof of relayed bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeProof) public bridgeProofs;\n /// @notice Whether bridge has been relayed on destination chain\n mapping(bytes32 =\u003e bool) public bridgeRelays;\n\n /// @dev to prevent replays\n uint256 public nonce;\n // @dev 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 /// @notice Pulls a requested token from the user to the requested recipient.\n /// @dev Be careful of re-entrancy issues when msg.value \u003e 0 and recipient != address(this)\n function _pullToken(address recipient, address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token != UniversalTokenLib.ETH_ADDRESS) {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(recipient);\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, recipient, amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(recipient) - amountPulled;\n } else {\n // Otherwise, we need to check that ETH amount matches msg.value\n if (amount != msg.value) revert MsgValueIncorrect();\n // Transfer value to recipient if not this address\n if (recipient != address(this)) token.universalTransfer(recipient, amount);\n // We will forward msg.value in the external call later, if recipient is not this contract\n amountPulled = msg.value;\n }\n }\n\n /// @inheritdoc IFastBridge\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n // check bridge params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\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\n // transfer tokens to bridge contract\n // @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(address(this), 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 BridgeTransaction({\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 sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n\n // check haven't exceeded deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n\n // mark bridge transaction as relayed\n if (bridgeRelays[transactionId]) revert TransactionRelayed();\n bridgeRelays[transactionId] = true;\n\n // transfer tokens to recipient on destination chain and gas rebate if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n uint256 rebate = chainGasAmount;\n if (!transaction.sendChainGas) {\n // forward erc20\n rebate = 0;\n _pullToken(to, token, amount);\n } else if (token == UniversalTokenLib.ETH_ADDRESS) {\n // lump in gas rebate into amount in native gas token\n _pullToken(to, token, amount + rebate);\n } else {\n // forward erc20 then forward gas rebate in native gas token\n _pullToken(to, token, amount);\n _pullToken(to, UniversalTokenLib.ETH_ADDRESS, rebate);\n }\n\n emit BridgeRelayed(\n transactionId,\n msg.sender,\n to,\n transaction.originChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n rebate\n );\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n // update bridge tx status given proof provided\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = BridgeStatus.RELAYER_PROVED;\n bridgeProofs[transactionId] = BridgeProof({timestamp: uint96(block.timestamp), relayer: msg.sender}); // overflow ok\n\n emit BridgeProofProvided(transactionId, msg.sender, destTxHash);\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint96(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint96).max but\n /// proof.timestamp \u003c type(uint96).max via unchecked statement\n /// @param proof The bridge proof\n /// @return delta Time delta since proof submitted\n function _timeSince(BridgeProof memory proof) internal view returns (uint256 delta) {\n unchecked {\n delta = uint96(block.timestamp) - proof.timestamp;\n }\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != relayer) revert SenderIncorrect();\n return _timeSince(proof) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != msg.sender) revert SenderIncorrect();\n if (_timeSince(proof) \u003c= DISPUTE_PERIOD) revert DisputePeriodNotPassed();\n\n bridgeStatuses[transactionId] = 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, msg.sender, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeProofs[transactionId]) \u003e DISPUTE_PERIOD) revert DisputePeriodPassed();\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n delete bridgeProofs[transactionId];\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 BridgeTransaction memory transaction = getBridgeTransaction(request);\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 // set status to refunded if still in requested state\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = 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","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","compilerOptions":"--combined-json bin,bin-runtime,srcmap,srcmap-runtime,abi,userdoc,devdoc,metadata,hashes --optimize --optimize-runs 10000 --allow-paths ., ./, ../ --evm-version=istanbul","srcMap":"56322:1843:0:-:0;;;57149:83;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;57187:38;46359:4;57218:6;57187:10;:38::i;:::-;;57149:83;56322:1843;;55672:257;55758:4;;55789:31;55806:4;55812:7;55789:16;:31::i;:::-;55774:46;;55834:7;55830:69;;;55857:18;;;;:12;:18;;;;;:31;;55880:7;55857:22;:31::i;:::-;;55830:69;55915:7;-1:-1:-1;55672:257:0;;;;;:::o;50306:316::-;50383:4;47081:12;;;;;;;;;;;-1:-1:-1;;;;;47081:29:0;;;;;;;;;;;;50399:217;;50442:6;:12;;;;;;;;;;;-1:-1:-1;;;;;50442:29:0;;;;;;;;;:36;;-1:-1:-1;;50442:36:0;50474:4;50442:36;;;50524:12;22402:10;;22323:96;50524:12;-1:-1:-1;;;;;50497:40:0;50515:7;-1:-1:-1;;;;;50497:40:0;50509:4;50497:40;;;;;;;;;;-1:-1:-1;50558:4:0;50551:11;;50399:217;-1:-1:-1;50600:5:0;50593:12;;31847:150;31917:4;31940:50;31945:3;-1:-1:-1;;;;;31965:23:0;;25835:4;27891:21;;;:14;;;:21;;;;;;25851:321;;-1:-1:-1;25893:23:0;;;;;;;;:11;:23;;;;;;;;;;;;;26075:18;;26051:21;;;:14;;;:21;;;;;;:42;;;;26107: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;56322:1843:0;;;;;;","srcMapRuntime":"56322:1843:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;54332:212;;;;;;:::i;:::-;;:::i;:::-;;;516:14:1;;509:22;491:41;;479:2;464:18;54332:212:0;;;;;;;;56562:60;;56599:23;56562:60;;;;;689:25:1;;;677:2;662:18;56562:60:0;543:177:1;57534:359:0;;;;;;:::i;:::-;;:::i;:::-;;56744:45;;56783:6;56744:45;;47937:120;;;;;;:::i;:::-;48002:7;48028:12;;;;;;;;;;:22;;;;47937:120;48353:136;;;;;;:::i;:::-;;:::i;49455:245::-;;;;;;:::i;:::-;;:::i;56906:30::-;;;;;;56490:66;;56530:26;56490:66;;55129:142;;;;;;:::i;:::-;;:::i;:::-;;;2246:42:1;2234:55;;;2216:74;;2204:2;2189:18;55129:142:0;2070:226:1;46981:136:0;;;;;;:::i;:::-;47058:4;47081:12;;;;;;;;;;;:29;;;;;;;;;;;;;;;;46981:136;56420:64;;56459:25;56420:64;;46314:49;;46359:4;46314:49;;57238:290;;;;;;:::i;:::-;;:::i;57899:264::-;;;;;;:::i;:::-;;:::i;56701:37::-;;56735:3;56701:37;;55439:131;;;;;;:::i;:::-;;:::i;56628:66::-;;56668:26;56628:66;;48769:138;;;;;;:::i;:::-;;:::i;56992:47::-;;;;;;:::i;:::-;;;;;;;;;;;;;;57113:29;;;;;;54332:212;54417:4;54440:57;;;54455:42;54440:57;;:97;;;54501:36;54525:11;54501:23;:36::i;:::-;54433:104;54332:212;-1:-1:-1;;54332:212:0:o;57534:359::-;56668:26;46591:16;46602:4;46591:10;:16::i;:::-;57658:19:::1;::::0;::::1;57638:17;57658:19:::0;;;:12:::1;:19;::::0;;;;;;57691:14;;;57687:27:::1;;57707:7;57534:359:::0;;;:::o;57687:27::-:1;57755:19;::::0;::::1;57777:1;57755:19:::0;;;:12:::1;:19;::::0;;;;:23;57788:45:::1;::::0;57812:9;57823;57788:23:::1;:45::i;:::-;57848:38;::::0;;2889:42:1;2958:15;;;2940:34;;3010:15;;3005:2;2990:18;;2983:43;3042:18;;;3035:34;;;57848:38:0::1;::::0;2867:2:1;2852:18;57848:38:0::1;;;;;;;57628:265;46617:1;57534:359:::0;;;:::o;48353:136::-;48002:7;48028:12;;;;;;;;;;:22;;;46591:16;46602:4;46591:10;:16::i;:::-;48457:25:::1;48468:4;48474:7;48457:10;:25::i;:::-;;48353:136:::0;;;:::o;49455:245::-;49548:34;;;22402:10;49548:34;49544:102;;49605:30;;;;;;;;;;;;;;49544:102;49656:37;49668:4;49674:18;49656:11;:37::i;55129:142::-;55210:7;55236:18;;;:12;:18;;;;;:28;;55258:5;55236:21;:28::i;:::-;55229:35;55129:142;-1:-1:-1;;;55129:142:0:o;57238:290::-;56668:26;46591:16;46602:4;46591:10;:16::i;:::-;56783:6:::1;57337:10;:26;;57329:55;;;::::0;::::1;::::0;;3282:2:1;57329:55:0::1;::::0;::::1;3264:21:1::0;3321:2;3301:18;;;3294:30;3360:18;3340;;;3333:46;3396:18;;57329:55:0::1;;;;;;;;;57415:15;::::0;;57440:28;;;;57483:38:::1;::::0;;3599:25:1;;;3655:2;3640:18;;3633:34;;;57483:38:0::1;::::0;3572:18:1;57483:38:0::1;;;;;;;;57319:209;57238:290:::0;;:::o;57899:264::-;56668:26;46591:16;46602:4;46591:10;:16::i;:::-;58024:14:::1;::::0;;58048:34;;;;58097:59:::1;::::0;;3599:25:1;;;3655:2;3640:18;;3633:34;;;58097:59:0::1;::::0;3572:18:1;58097:59:0::1;3425:248:1::0;55439:131:0;55510:7;55536:18;;;:12;:18;;;;;:27;;:25;:27::i;48769:138::-;48002:7;48028:12;;;;;;;;;;:22;;;46591:16;46602:4;46591:10;:16::i;:::-;48874:26:::1;48886:4;48892:7;48874:11;:26::i;46692:202::-:0;46777:4;46800:47;;;46815:32;46800:47;;:87;;-1:-1:-1;38607:25:0;38592:40;;;;46851:36;38493:146;47326:103;47392:30;47403:4;22402:10;47392;:30::i;:::-;47326:103;:::o;51604:653::-;51779:4;51765:19;;;;51761:32;;51604:653;;;:::o;51761:32::-;51865:5;51874:1;51865:10;51861:23;;51604:653;;;:::o;51861:23::-;51897:20;;;;;51893:358;;52077:12;52094:2;:7;;52109:5;52094:25;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;52076:43;;;52141:7;52133:39;;;;;;;4090:2:1;52133:39:0;;;4072:21:1;4129:2;4109:18;;;4102:30;4168:21;4148:18;;;4141:49;4207:18;;52133:39:0;3888:343:1;51893:358:0;52203:37;:26;;;52230:2;52234:5;52203:26;:37::i;55672:257::-;55758:4;55774:12;55789:31;55806:4;55812:7;55789:16;:31::i;:::-;55774:46;;55834:7;55830:69;;;55857:18;;;;:12;:18;;;;;:31;;55880:7;55857:22;:31::i;:::-;;55915:7;55672:257;-1:-1:-1;;;55672:257:0:o;56032:262::-;56119:4;56135:12;56150:32;56168:4;56174:7;56150:17;:32::i;:::-;56135:47;;56196:7;56192:72;;;56219:18;;;;:12;:18;;;;;:34;;56245:7;56219:25;:34::i;33105:156::-;33179:7;33229:22;33233:3;33245:5;33229:3;:22::i;32648:115::-;32711:7;32737:19;32745:3;28087:18;;28005:107;47559:197;47058:4;47081:12;;;;;;;;;;;:29;;;;;;;;;;;;;47642:108;;47692:47;;;;;4440:42:1;4428:55;;47692:47:0;;;4410:74:1;4500:18;;;4493:34;;;4383:18;;47692:47:0;4236:297:1;47642:108:0;47559:197;;:::o;39809:160::-;39918:43;;;39933:14;4428:55:1;;39918:43:0;;;4410:74:1;4500:18;;;;4493:34;;;39918:43:0;;;;;;;;;;4383:18:1;;;;39918:43:0;;;;;;;;;;;;;;39891:71;;39911:5;;39891:19;:71::i;50306:316::-;50383:4;47081:12;;;;;;;;;;;:29;;;;;;;;;;;;;50399:217;;50442:6;:12;;;;;;;;;;;:29;;;;;;;;;;:36;;;;50474:4;50442:36;;;50524:12;22402:10;;22323:96;50524:12;50497:40;;50515:7;50497:40;;50509:4;50497:40;;;;;;;;;;-1:-1:-1;50558:4:0;50551:11;;50399:217;-1:-1:-1;50600:5:0;50593:12;;31847:150;31917:4;31940:50;31945:3;31965:23;;;31940:4;:50::i;50857:317::-;50935:4;47081:12;;;;;;;;;;;:29;;;;;;;;;;;;;50951:217;;;51025:5;50993:12;;;;;;;;;;;:29;;;;;;;;;;;:37;;;;;;51049:40;22402:10;;50993:12;;51049:40;;51025:5;51049:40;-1:-1:-1;51110:4:0;51103:11;;32165:156;32238:4;32261:53;32269:3;32289:23;;;32261:7;:53::i;28454:118::-;28521:7;28547:3;:11;;28559:5;28547:18;;;;;;;;:::i;:::-;;;;;;;;;28540:25;;28454:118;;;;:::o;42565:629::-;42984:23;43010:33;:27;;;43038:4;43010:27;:33::i;:::-;42984:59;;43057:10;:17;43078:1;43057:22;;:57;;;;;43095:10;43084:30;;;;;;;;;;;;:::i;:::-;43083:31;43057:57;43053:135;;;43137:40;;;;;2246:42:1;2234:55;;43137:40:0;;;2216:74:1;2189:18;;43137:40:0;2070:226:1;25772:406:0;25835:4;27891:21;;;:14;;;:21;;;;;;25851:321;;-1:-1:-1;25893:23:0;;;;;;;;:11;:23;;;;;;;;;;;;;26075:18;;26051:21;;;:14;;;:21;;;;;;:42;;;;26107:11;;26346:1368;26412:4;26541:21;;;:14;;;:21;;;;;;26577:13;;26573:1135;;26944:18;26965:12;26976:1;26965:8;:12;:::i;:::-;27011:18;;26944:33;;-1:-1:-1;26991:17:0;;27011:22;;27032:1;;27011:22;:::i;:::-;26991:42;;27066:9;27052:10;:23;27048:378;;27095:17;27115:3;:11;;27127:9;27115:22;;;;;;;;:::i;:::-;;;;;;;;;27095:42;;27262:9;27236:3;:11;;27248:10;27236:23;;;;;;;;:::i;:::-;;;;;;;;;;;;:35;;;;27375:25;;;:14;;;:25;;;;;:36;;;27048:378;27504:17;;:3;;:17;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;27607:3;:14;;:21;27622:5;27607:21;;;;;;;;;;;27600:28;;;27650:4;27643:11;;;;;;;26573:1135;27692:5;27685:12;;;;;18108:151;18183:12;18214:38;18236:6;18244:4;18250:1;18183:12;18824;18838:23;18865:6;:11;;18884:5;18891:4;18865:31;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;18823:73;;;;18913:55;18940:6;18948:7;18957:10;18913:26;:55::i;:::-;18906:62;18583:392;-1:-1:-1;;;;;;18583:392:0:o;20028:582::-;20172:12;20201:7;20196:408;;20224:19;20232:10;20224:7;:19::i;:::-;20196:408;;;20448:17;;:22;:49;;;;-1:-1:-1;20474:18:0;;;;:23;20448:49;20444:119;;;20524:24;;;;;2246:42:1;2234:55;;20524:24:0;;;2216:74:1;2189:18;;20524:24:0;2070:226:1;20444:119:0;-1:-1:-1;20583:10:0;20576:17;;21146:516;21277:17;;:21;21273:383;;21505:10;21499:17;21561:15;21548:10;21544:2;21540:19;21533:44;21273:383;21628: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.20+commit.a1b79de6\"},\"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/FastBridge.sol\":\"Admin\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridge.sol\":{\"keccak256\":\"0xae743277f3eb2d2ec8189b107f86be1274c339a5e25efd78e2513a1adfb904cf\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://2adf46956fa5eb58f2073d4a611632ccc208ba24ea99e0a0e224cdce7b79b135\",\"dweb:/ipfs/QmU3RGCG6sstiJ4HUPg5RP7gNds74eBn7YMSCqQfRG8Cpb\"]}},\"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/FastBridge.sol:Context":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.20 ^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 pure 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/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// 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/FastBridge.sol\n\ncontract FastBridge is IFastBridge, Admin {\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 enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeStatus) public bridgeStatuses;\n /// @notice Proof of relayed bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeProof) public bridgeProofs;\n /// @notice Whether bridge has been relayed on destination chain\n mapping(bytes32 =\u003e bool) public bridgeRelays;\n\n /// @dev to prevent replays\n uint256 public nonce;\n // @dev 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 /// @notice Pulls a requested token from the user to the requested recipient.\n /// @dev Be careful of re-entrancy issues when msg.value \u003e 0 and recipient != address(this)\n function _pullToken(address recipient, address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token != UniversalTokenLib.ETH_ADDRESS) {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(recipient);\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, recipient, amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(recipient) - amountPulled;\n } else {\n // Otherwise, we need to check that ETH amount matches msg.value\n if (amount != msg.value) revert MsgValueIncorrect();\n // Transfer value to recipient if not this address\n if (recipient != address(this)) token.universalTransfer(recipient, amount);\n // We will forward msg.value in the external call later, if recipient is not this contract\n amountPulled = msg.value;\n }\n }\n\n /// @inheritdoc IFastBridge\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n // check bridge params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\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\n // transfer tokens to bridge contract\n // @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(address(this), 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 BridgeTransaction({\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 sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n\n // check haven't exceeded deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n\n // mark bridge transaction as relayed\n if (bridgeRelays[transactionId]) revert TransactionRelayed();\n bridgeRelays[transactionId] = true;\n\n // transfer tokens to recipient on destination chain and gas rebate if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n uint256 rebate = chainGasAmount;\n if (!transaction.sendChainGas) {\n // forward erc20\n rebate = 0;\n _pullToken(to, token, amount);\n } else if (token == UniversalTokenLib.ETH_ADDRESS) {\n // lump in gas rebate into amount in native gas token\n _pullToken(to, token, amount + rebate);\n } else {\n // forward erc20 then forward gas rebate in native gas token\n _pullToken(to, token, amount);\n _pullToken(to, UniversalTokenLib.ETH_ADDRESS, rebate);\n }\n\n emit BridgeRelayed(\n transactionId,\n msg.sender,\n to,\n transaction.originChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n rebate\n );\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n // update bridge tx status given proof provided\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = BridgeStatus.RELAYER_PROVED;\n bridgeProofs[transactionId] = BridgeProof({timestamp: uint96(block.timestamp), relayer: msg.sender}); // overflow ok\n\n emit BridgeProofProvided(transactionId, msg.sender, destTxHash);\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint96(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint96).max but\n /// proof.timestamp \u003c type(uint96).max via unchecked statement\n /// @param proof The bridge proof\n /// @return delta Time delta since proof submitted\n function _timeSince(BridgeProof memory proof) internal view returns (uint256 delta) {\n unchecked {\n delta = uint96(block.timestamp) - proof.timestamp;\n }\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != relayer) revert SenderIncorrect();\n return _timeSince(proof) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != msg.sender) revert SenderIncorrect();\n if (_timeSince(proof) \u003c= DISPUTE_PERIOD) revert DisputePeriodNotPassed();\n\n bridgeStatuses[transactionId] = 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, msg.sender, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeProofs[transactionId]) \u003e DISPUTE_PERIOD) revert DisputePeriodPassed();\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n delete bridgeProofs[transactionId];\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 BridgeTransaction memory transaction = getBridgeTransaction(request);\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 // set status to refunded if still in requested state\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = 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","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","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.20+commit.a1b79de6\"},\"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/FastBridge.sol\":\"Context\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridge.sol\":{\"keccak256\":\"0xae743277f3eb2d2ec8189b107f86be1274c339a5e25efd78e2513a1adfb904cf\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://2adf46956fa5eb58f2073d4a611632ccc208ba24ea99e0a0e224cdce7b79b135\",\"dweb:/ipfs/QmU3RGCG6sstiJ4HUPg5RP7gNds74eBn7YMSCqQfRG8Cpb\"]}},\"version\":1}"},"hashes":{}},"solidity/FastBridge.sol:ERC165":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.20 ^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 pure 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/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// 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/FastBridge.sol\n\ncontract FastBridge is IFastBridge, Admin {\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 enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeStatus) public bridgeStatuses;\n /// @notice Proof of relayed bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeProof) public bridgeProofs;\n /// @notice Whether bridge has been relayed on destination chain\n mapping(bytes32 =\u003e bool) public bridgeRelays;\n\n /// @dev to prevent replays\n uint256 public nonce;\n // @dev 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 /// @notice Pulls a requested token from the user to the requested recipient.\n /// @dev Be careful of re-entrancy issues when msg.value \u003e 0 and recipient != address(this)\n function _pullToken(address recipient, address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token != UniversalTokenLib.ETH_ADDRESS) {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(recipient);\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, recipient, amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(recipient) - amountPulled;\n } else {\n // Otherwise, we need to check that ETH amount matches msg.value\n if (amount != msg.value) revert MsgValueIncorrect();\n // Transfer value to recipient if not this address\n if (recipient != address(this)) token.universalTransfer(recipient, amount);\n // We will forward msg.value in the external call later, if recipient is not this contract\n amountPulled = msg.value;\n }\n }\n\n /// @inheritdoc IFastBridge\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n // check bridge params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\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\n // transfer tokens to bridge contract\n // @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(address(this), 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 BridgeTransaction({\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 sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n\n // check haven't exceeded deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n\n // mark bridge transaction as relayed\n if (bridgeRelays[transactionId]) revert TransactionRelayed();\n bridgeRelays[transactionId] = true;\n\n // transfer tokens to recipient on destination chain and gas rebate if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n uint256 rebate = chainGasAmount;\n if (!transaction.sendChainGas) {\n // forward erc20\n rebate = 0;\n _pullToken(to, token, amount);\n } else if (token == UniversalTokenLib.ETH_ADDRESS) {\n // lump in gas rebate into amount in native gas token\n _pullToken(to, token, amount + rebate);\n } else {\n // forward erc20 then forward gas rebate in native gas token\n _pullToken(to, token, amount);\n _pullToken(to, UniversalTokenLib.ETH_ADDRESS, rebate);\n }\n\n emit BridgeRelayed(\n transactionId,\n msg.sender,\n to,\n transaction.originChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n rebate\n );\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n // update bridge tx status given proof provided\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = BridgeStatus.RELAYER_PROVED;\n bridgeProofs[transactionId] = BridgeProof({timestamp: uint96(block.timestamp), relayer: msg.sender}); // overflow ok\n\n emit BridgeProofProvided(transactionId, msg.sender, destTxHash);\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint96(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint96).max but\n /// proof.timestamp \u003c type(uint96).max via unchecked statement\n /// @param proof The bridge proof\n /// @return delta Time delta since proof submitted\n function _timeSince(BridgeProof memory proof) internal view returns (uint256 delta) {\n unchecked {\n delta = uint96(block.timestamp) - proof.timestamp;\n }\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != relayer) revert SenderIncorrect();\n return _timeSince(proof) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != msg.sender) revert SenderIncorrect();\n if (_timeSince(proof) \u003c= DISPUTE_PERIOD) revert DisputePeriodNotPassed();\n\n bridgeStatuses[transactionId] = 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, msg.sender, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeProofs[transactionId]) \u003e DISPUTE_PERIOD) revert DisputePeriodPassed();\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n delete bridgeProofs[transactionId];\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 BridgeTransaction memory transaction = getBridgeTransaction(request);\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 // set status to refunded if still in requested state\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = 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","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","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.20+commit.a1b79de6\"},\"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/FastBridge.sol\":\"ERC165\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridge.sol\":{\"keccak256\":\"0xae743277f3eb2d2ec8189b107f86be1274c339a5e25efd78e2513a1adfb904cf\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://2adf46956fa5eb58f2073d4a611632ccc208ba24ea99e0a0e224cdce7b79b135\",\"dweb:/ipfs/QmU3RGCG6sstiJ4HUPg5RP7gNds74eBn7YMSCqQfRG8Cpb\"]}},\"version\":1}"},"hashes":{"supportsInterface(bytes4)":"01ffc9a7"}},"solidity/FastBridge.sol:EnumerableSet":{"code":"0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212203a6e3f60ed51bcb9fc27641637557f1f938845d6b833150d5c8467b60921792564736f6c63430008140033","runtime-code":"0x73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212203a6e3f60ed51bcb9fc27641637557f1f938845d6b833150d5c8467b60921792564736f6c63430008140033","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.20 ^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 pure 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/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// 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/FastBridge.sol\n\ncontract FastBridge is IFastBridge, Admin {\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 enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeStatus) public bridgeStatuses;\n /// @notice Proof of relayed bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeProof) public bridgeProofs;\n /// @notice Whether bridge has been relayed on destination chain\n mapping(bytes32 =\u003e bool) public bridgeRelays;\n\n /// @dev to prevent replays\n uint256 public nonce;\n // @dev 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 /// @notice Pulls a requested token from the user to the requested recipient.\n /// @dev Be careful of re-entrancy issues when msg.value \u003e 0 and recipient != address(this)\n function _pullToken(address recipient, address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token != UniversalTokenLib.ETH_ADDRESS) {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(recipient);\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, recipient, amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(recipient) - amountPulled;\n } else {\n // Otherwise, we need to check that ETH amount matches msg.value\n if (amount != msg.value) revert MsgValueIncorrect();\n // Transfer value to recipient if not this address\n if (recipient != address(this)) token.universalTransfer(recipient, amount);\n // We will forward msg.value in the external call later, if recipient is not this contract\n amountPulled = msg.value;\n }\n }\n\n /// @inheritdoc IFastBridge\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n // check bridge params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\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\n // transfer tokens to bridge contract\n // @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(address(this), 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 BridgeTransaction({\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 sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n\n // check haven't exceeded deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n\n // mark bridge transaction as relayed\n if (bridgeRelays[transactionId]) revert TransactionRelayed();\n bridgeRelays[transactionId] = true;\n\n // transfer tokens to recipient on destination chain and gas rebate if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n uint256 rebate = chainGasAmount;\n if (!transaction.sendChainGas) {\n // forward erc20\n rebate = 0;\n _pullToken(to, token, amount);\n } else if (token == UniversalTokenLib.ETH_ADDRESS) {\n // lump in gas rebate into amount in native gas token\n _pullToken(to, token, amount + rebate);\n } else {\n // forward erc20 then forward gas rebate in native gas token\n _pullToken(to, token, amount);\n _pullToken(to, UniversalTokenLib.ETH_ADDRESS, rebate);\n }\n\n emit BridgeRelayed(\n transactionId,\n msg.sender,\n to,\n transaction.originChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n rebate\n );\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n // update bridge tx status given proof provided\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = BridgeStatus.RELAYER_PROVED;\n bridgeProofs[transactionId] = BridgeProof({timestamp: uint96(block.timestamp), relayer: msg.sender}); // overflow ok\n\n emit BridgeProofProvided(transactionId, msg.sender, destTxHash);\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint96(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint96).max but\n /// proof.timestamp \u003c type(uint96).max via unchecked statement\n /// @param proof The bridge proof\n /// @return delta Time delta since proof submitted\n function _timeSince(BridgeProof memory proof) internal view returns (uint256 delta) {\n unchecked {\n delta = uint96(block.timestamp) - proof.timestamp;\n }\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != relayer) revert SenderIncorrect();\n return _timeSince(proof) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != msg.sender) revert SenderIncorrect();\n if (_timeSince(proof) \u003c= DISPUTE_PERIOD) revert DisputePeriodNotPassed();\n\n bridgeStatuses[transactionId] = 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, msg.sender, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeProofs[transactionId]) \u003e DISPUTE_PERIOD) revert DisputePeriodPassed();\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n delete bridgeProofs[transactionId];\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 BridgeTransaction memory transaction = getBridgeTransaction(request);\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 // set status to refunded if still in requested state\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = 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","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","compilerOptions":"--combined-json bin,bin-runtime,srcmap,srcmap-runtime,abi,userdoc,devdoc,metadata,hashes --optimize --optimize-runs 10000 --allow-paths ., ./, ../ --evm-version=istanbul","srcMap":"24861:11640:0:-:0;;;;;;;;;;;;;;;-1:-1:-1;;;24861:11640:0;;;;;;;;;;;;;;;;;","srcMapRuntime":"24861: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.20+commit.a1b79de6\"},\"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/FastBridge.sol\":\"EnumerableSet\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridge.sol\":{\"keccak256\":\"0xae743277f3eb2d2ec8189b107f86be1274c339a5e25efd78e2513a1adfb904cf\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://2adf46956fa5eb58f2073d4a611632ccc208ba24ea99e0a0e224cdce7b79b135\",\"dweb:/ipfs/QmU3RGCG6sstiJ4HUPg5RP7gNds74eBn7YMSCqQfRG8Cpb\"]}},\"version\":1}"},"hashes":{}},"solidity/FastBridge.sol:FastBridge":{"code":"0x60a06040523480156200001157600080fd5b5060405162002d7a38038062002d7a833981016040819052620000349162000194565b80620000426000826200004f565b50504360805250620001bf565b6000806200005e84846200008c565b90508015620000835760008481526001602052604090206200008190846200013a565b505b90505b92915050565b6000828152602081815260408083206001600160a01b038516845290915281205460ff1662000131576000838152602081815260408083206001600160a01b03861684529091529020805460ff19166001179055620000e83390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a450600162000086565b50600062000086565b600062000083836001600160a01b0384166000818152600183016020526040812054620001315750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915562000086565b600060208284031215620001a757600080fd5b81516001600160a01b03811681146200008357600080fd5b608051612b9f620001db60003960006106510152612b9f6000f3fe60806040526004361061026a5760003560e01c80639010d07c11610153578063add98c70116100cb578063ca15c8731161007f578063d547741f11610064578063d547741f146107a1578063dcf844a7146107c1578063e00a83e0146107ee57600080fd5b8063ca15c8731461074d578063ccc574901461076d57600080fd5b8063b13aa2d6116100b0578063b13aa2d6146106f6578063b250fe6b14610716578063bf333f2c1461073657600080fd5b8063add98c70146106c0578063affed0e0146106e057600080fd5b8063a217fddf11610122578063a5bbe22b11610107578063a5bbe22b1461047f578063aa9641ab14610673578063ac11fb1a1461069357600080fd5b8063a217fddf1461062a578063a3ec191a1461063f57600080fd5b80639010d07c146104f857806391ad50391461053057806391d14854146105b2578063926d7d7f146105f657600080fd5b806341fcb612116101e65780635eb7d946116101b55780638379a24f1161019a5780638379a24f14610495578063886d36ff146104c55780638f0d6f17146104e557600080fd5b80635eb7d9461461045f578063820688d51461047f57600080fd5b806341fcb612146103e2578063458516941461040257806358f85880146104155780635960ccf21461042b57600080fd5b80630f5f6ed71161023d578063248a9ca311610222578063248a9ca3146103725780632f2ff15d146103a257806336568abe146103c257600080fd5b80630f5f6ed714610345578063190da5951461035b57600080fd5b806301ffc9a71461026f57806303ed0ee5146102a4578063051287bc146102e657806306f333f214610323575b600080fd5b34801561027b57600080fd5b5061028f61028a3660046122fc565b610804565b60405190151581526020015b60405180910390f35b3480156102b057600080fd5b506102d87f043c983c49d46f0e102151eaf8085d4a2e6571d5df2d47b013f39bddfd4a639d81565b60405190815260200161029b565b3480156102f257600080fd5b5061031661030136600461233e565b60056020526000908152604090205460ff1681565b60405161029b9190612386565b34801561032f57600080fd5b5061034361033e3660046123ec565b610860565b005b34801561035157600080fd5b506102d861271081565b34801561036757600080fd5b506102d862093a8081565b34801561037e57600080fd5b506102d861038d36600461233e565b60009081526020819052604090206001015490565b3480156103ae57600080fd5b506103436103bd366004612425565b610927565b3480156103ce57600080fd5b506103436103dd366004612425565b610952565b3480156103ee57600080fd5b506103436103fd366004612572565b61099e565b6103436104103660046125ef565b610bd7565b34801561042157600080fd5b506102d860025481565b34801561043757600080fd5b506102d87fdb9556138406326f00296e13ea2ad7db24ba82381212d816b1a40c23b466b32781565b34801561046b57600080fd5b5061034361047a366004612692565b610ee5565b34801561048b57600080fd5b506102d861070881565b3480156104a157600080fd5b5061028f6104b036600461233e565b60076020526000908152604090205460ff1681565b3480156104d157600080fd5b506103436104e03660046126cf565b6110bd565b6103436104f3366004612692565b6111f0565b34801561050457600080fd5b50610518610513366004612714565b611437565b6040516001600160a01b03909116815260200161029b565b34801561053c57600080fd5b5061058661054b36600461233e565b6006602052600090815260409020546bffffffffffffffffffffffff8116906c0100000000000000000000000090046001600160a01b031682565b604080516bffffffffffffffffffffffff90931683526001600160a01b0390911660208301520161029b565b3480156105be57600080fd5b5061028f6105cd366004612425565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b34801561060257600080fd5b506102d87fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc481565b34801561063657600080fd5b506102d8600081565b34801561064b57600080fd5b506102d87f000000000000000000000000000000000000000000000000000000000000000081565b34801561067f57600080fd5b5061028f61068e366004612425565b611456565b34801561069f57600080fd5b506106b36106ae366004612692565b611559565b60405161029b9190612736565b3480156106cc57600080fd5b506103436106db36600461233e565b6115cc565b3480156106ec57600080fd5b506102d860085481565b34801561070257600080fd5b5061034361071136600461233e565b611735565b34801561072257600080fd5b5061034361073136600461233e565b611817565b34801561074257600080fd5b506102d8620f424081565b34801561075957600080fd5b506102d861076836600461233e565b61187f565b34801561077957600080fd5b506102d87f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5581565b3480156107ad57600080fd5b506103436107bc366004612425565b611896565b3480156107cd57600080fd5b506102d86107dc36600461281c565b60036020526000908152604090205481565b3480156107fa57600080fd5b506102d860045481565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f5a05180f00000000000000000000000000000000000000000000000000000000148061085a575061085a826118bb565b92915050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5561088a81611952565b6001600160a01b038316600090815260036020526040812054908190036108b15750505050565b6001600160a01b0384166000818152600360205260408120556108d590848361195f565b604080516001600160a01b038087168252851660208201529081018290527f244e51bc38c1452fa8aaf487bcb4bca36c2baa3a5fbdb776b1eabd8dc6d277cd9060600160405180910390a1505b505050565b60008281526020819052604090206001015461094281611952565b61094c8383611a82565b50505050565b6001600160a01b0381163314610994576040517f6697b23200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6109228282611ab7565b7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc46109c881611952565b8251602084012060006109da85611559565b9050600260008381526005602052604090205460ff166004811115610a0157610a01612357565b14610a38576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000828152600660209081526040918290208251808401909352546bffffffffffffffffffffffff811683526c0100000000000000000000000090046001600160a01b03169082018190523314610abb576040517f4af43a9000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80516107089042036bffffffffffffffffffffffff1611610b08576040517f1992d0bd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000838152600560205260409020805460ff1916600317905561010082015115610b645761010082015160808301516001600160a01b031660009081526003602052604081208054909190610b5e908490612868565b90915550505b608082015160c0830151610b826001600160a01b038316888361195f565b604080516001600160a01b03848116825260208201849052891691339188917f582211c35a2139ac3bbaac74663c6a1f56c6cbb658b41fe11fd45a82074ac67891015b60405180910390a45050505050505050565b46816000015163ffffffff1603610c1a576040517f7029fdf900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60a08101511580610c2d575060c0810151155b15610c64576040517fe38820c800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60608101516001600160a01b03161580610c89575060808101516001600160a01b0316155b15610cc0576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610ccc61070842612868565b8161010001511015610d0a576040517f04b7fcc800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000610d1f3083606001518460a00151611ae4565b90506000806002541115610d4c57620f424060025483610d3f919061287b565b610d499190612892565b90505b610d5681836128cd565b915060006040518061018001604052804663ffffffff168152602001856000015163ffffffff16815260200185602001516001600160a01b0316815260200185604001516001600160a01b0316815260200185606001516001600160a01b0316815260200185608001516001600160a01b031681526020018481526020018560c0015181526020018381526020018560e0015115158152602001856101000151815260200160086000815480929190610e0e906128e0565b909155509052604051610e249190602001612736565b604080518083037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0018152828252805160208083019190912060008181526005835293909320805460ff191660011790558701518751606089015160808a015160c08b015160e08c015195985095966001600160a01b039094169587957f120ea0364f36cdac7983bcfdd55270ca09d7f9b314a2ebc425a3b01ab1d6403a95610ed6958b959094909390928e9261293c565b60405180910390a35050505050565b805160208201206000610ef783611559565b3360009081527fd2043bf65931af3dbecf60d0db8f40e4160406d7beb00522f4200cf4944a1eb8602052604090205490915060ff1615610f74578061014001514211610f6f576040517fe15ff9ea00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610fc0565b62093a80816101400151610f889190612868565b4211610fc0576040517fe15ff9ea00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600160008381526005602052604090205460ff166004811115610fe557610fe5612357565b1461101c576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600082815260056020526040808220805460ff19166004179055820151608083015161010084015160c0850151929391926110579190612868565b905061106d6001600160a01b038316848361195f565b604080516001600160a01b0384811682526020820184905285169187917fb4c55c0c9bc613519b920e88748090150b890a875d307f21bea7d4fb2e8bc958910160405180910390a3505050505050565b7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc46110e781611952565b82516020840120600160008281526005602052604090205460ff16600481111561111357611113612357565b1461114a576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008181526005602090815260408083208054600260ff19909116179055805180820182526bffffffffffffffffffffffff4281168252338285018181528787526006865295849020925195516001600160a01b03166c0100000000000000000000000002959091169490941790555185815283917f4ac8af8a2cd87193d64dfc7a3b8d9923b714ec528b18725d080aa1299be0c5e4910160405180910390a350505050565b7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc461121a81611952565b81516020830120600061122c84611559565b90504663ffffffff16816020015163ffffffff1614611277576040517f7029fdf900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8061014001514211156112b6576040517f559895a300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008281526007602052604090205460ff16156112ff576040517fbef7bb7d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000828152600760205260409020805460ff19166001179055606081015160a082015160e083015160045461012085015161134857506000611342848484611ae4565b506113b9565b7fffffffffffffffffffffffff11111111111111111111111111111111111111126001600160a01b0384160161138c5761134284846113878486612868565b611ae4565b611397848484611ae4565b506113b78473eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee83611ae4565b505b845160808087015160a08089015160c0808b015160e08c01516040805163ffffffff90991689526001600160a01b0396871660208a0152938616938801939093526060870152938501528301849052861691339189917ff8ae392d784b1ea5e8881bfa586d81abf07ef4f1e2fc75f7fe51c90f05199a5c9101610bc5565b600082815260016020526040812061144f9083611cb3565b9392505050565b6000600260008481526005602052604090205460ff16600481111561147d5761147d612357565b146114b4576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000838152600660209081526040918290208251808401909352546bffffffffffffffffffffffff811683526001600160a01b036c01000000000000000000000000909104811691830182905284161461153a576040517f4af43a9000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80516107089042036bffffffffffffffffffffffff1611949350505050565b604080516101808101825260008082526020808301829052928201819052606082018190526080820181905260a0820181905260c0820181905260e082018190526101008201819052610120820181905261014082018190526101608201528251909161085a91840181019084016129ed565b7f043c983c49d46f0e102151eaf8085d4a2e6571d5df2d47b013f39bddfd4a639d6115f681611952565b600260008381526005602052604090205460ff16600481111561161b5761161b612357565b14611652576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000828152600660209081526040918290208251808401909352546bffffffffffffffffffffffff8082168085526c010000000000000000000000009092046001600160a01b031693909201929092526107089142031611156116e1576040517f3e908aac00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000828152600560209081526040808320805460ff19166001179055600690915280822082905551339184917f0695cf1d39b3055dcd0fe02d8b47eaf0d5a13e1996de925de59d0ef9b7f7fad49190a35050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5561175f81611952565b6127108211156117d0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f6e657746656552617465203e206d61780000000000000000000000000000000060448201526064015b60405180910390fd5b600280549083905560408051828152602081018590527f14914da2bf76024616fbe1859783fcd4dbddcb179b1f3a854949fbf920dcb95791015b60405180910390a1505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5561184181611952565b600480549083905560408051828152602081018590527f5cf09b12f3f56b4c564d51b25b40360af6d795198adb61ae0806a36c294323fa910161180a565b600081815260016020526040812061085a90611cbf565b6000828152602081905260409020600101546118b181611952565b61094c8383611ab7565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061085a57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff0000000000000000000000000000000000000000000000000000000083161461085a565b61195c8133611cc9565b50565b306001600160a01b0383160361197457505050565b8060000361198157505050565b7fffffffffffffffffffffffff11111111111111111111111111111111111111126001600160a01b03841601611a6e576000826001600160a01b03168260405160006040518083038185875af1925050503d80600081146119fe576040519150601f19603f3d011682016040523d82523d6000602084013e611a03565b606091505b505090508061094c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f455448207472616e73666572206661696c65640000000000000000000000000060448201526064016117c7565b6109226001600160a01b0384168383611d39565b600080611a8f8484611dad565b9050801561144f576000848152600160205260409020611aaf9084611e57565b509392505050565b600080611ac48484611e6c565b9050801561144f576000848152600160205260409020611aaf9084611eef565b60006001600160a01b03831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14611c4d57611b1c836001600160a01b0316611f04565b6040517f70a082310000000000000000000000000000000000000000000000000000000081526001600160a01b0385811660048301528416906370a0823190602401602060405180830381865afa158015611b7b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b9f9190612ab9565b9050611bb66001600160a01b038416338685611faa565b6040517f70a082310000000000000000000000000000000000000000000000000000000081526001600160a01b0385811660048301528291908516906370a0823190602401602060405180830381865afa158015611c18573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c3c9190612ab9565b611c4691906128cd565b905061144f565b348214611c86576040517f81de0bf300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b0384163014611caa57611caa6001600160a01b038416858461195f565b50349392505050565b600061144f8383611fe3565b600061085a825490565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16611d35576040517fe2517d3f0000000000000000000000000000000000000000000000000000000081526001600160a01b0382166004820152602481018390526044016117c7565b5050565b6040516001600160a01b0383811660248301526044820183905261092291859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505061200d565b6000828152602081815260408083206001600160a01b038516845290915281205460ff16611e4f576000838152602081815260408083206001600160a01b03861684529091529020805460ff19166001179055611e073390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a450600161085a565b50600061085a565b600061144f836001600160a01b038416612089565b6000828152602081815260408083206001600160a01b038516845290915281205460ff1615611e4f576000838152602081815260408083206001600160a01b0386168085529252808320805460ff1916905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a450600161085a565b600061144f836001600160a01b0384166120d0565b7fffffffffffffffffffffffff11111111111111111111111111111111111111126001600160a01b03821601611f66576040517f7f523fe800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b806001600160a01b03163b60000361195c576040517f7f523fe800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040516001600160a01b03848116602483015283811660448301526064820183905261094c9186918216906323b872dd90608401611d66565b6000826000018281548110611ffa57611ffa612ad2565b9060005260206000200154905092915050565b60006120226001600160a01b038416836121c3565b905080516000141580156120475750808060200190518101906120459190612b01565b155b15610922576040517f5274afe70000000000000000000000000000000000000000000000000000000081526001600160a01b03841660048201526024016117c7565b6000818152600183016020526040812054611e4f5750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561085a565b600081815260018301602052604081205480156121b95760006120f46001836128cd565b8554909150600090612108906001906128cd565b905080821461216d57600086600001828154811061212857612128612ad2565b906000526020600020015490508087600001848154811061214b5761214b612ad2565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061217e5761217e612b1e565b60019003818190600052602060002001600090559055856001016000868152602001908152602001600020600090556001935050505061085a565b600091505061085a565b606061144f8383600084600080856001600160a01b031684866040516121e99190612b4d565b60006040518083038185875af1925050503d8060008114612226576040519150601f19603f3d011682016040523d82523d6000602084013e61222b565b606091505b509150915061223b868383612245565b9695505050505050565b60608261225a57612255826122ba565b61144f565b815115801561227157506001600160a01b0384163b155b156122b3576040517f9996b3150000000000000000000000000000000000000000000000000000000081526001600160a01b03851660048201526024016117c7565b508061144f565b8051156122ca5780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006020828403121561230e57600080fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811461144f57600080fd5b60006020828403121561235057600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b60208101600583106123c1577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b91905290565b6001600160a01b038116811461195c57600080fd5b80356123e7816123c7565b919050565b600080604083850312156123ff57600080fd5b823561240a816123c7565b9150602083013561241a816123c7565b809150509250929050565b6000806040838503121561243857600080fd5b82359150602083013561241a816123c7565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051610120810167ffffffffffffffff8111828210171561249d5761249d61244a565b60405290565b604051610180810167ffffffffffffffff8111828210171561249d5761249d61244a565b600082601f8301126124d857600080fd5b813567ffffffffffffffff808211156124f3576124f361244a565b604051601f83017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f011681019082821181831017156125395761253961244a565b8160405283815286602085880101111561255257600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000806040838503121561258557600080fd5b823567ffffffffffffffff81111561259c57600080fd5b6125a8858286016124c7565b925050602083013561241a816123c7565b63ffffffff8116811461195c57600080fd5b80356123e7816125b9565b801515811461195c57600080fd5b80356123e7816125d6565b6000610120828403121561260257600080fd5b61260a612479565b612613836125cb565b8152612621602084016123dc565b6020820152612632604084016123dc565b6040820152612643606084016123dc565b6060820152612654608084016123dc565b608082015260a083013560a082015260c083013560c082015261267960e084016125e4565b60e0820152610100928301359281019290925250919050565b6000602082840312156126a457600080fd5b813567ffffffffffffffff8111156126bb57600080fd5b6126c7848285016124c7565b949350505050565b600080604083850312156126e257600080fd5b823567ffffffffffffffff8111156126f957600080fd5b612705858286016124c7565b95602094909401359450505050565b6000806040838503121561272757600080fd5b50508035926020909101359150565b815163ffffffff1681526101808101602083015161275c602084018263ffffffff169052565b50604083015161277760408401826001600160a01b03169052565b50606083015161279260608401826001600160a01b03169052565b5060808301516127ad60808401826001600160a01b03169052565b5060a08301516127c860a08401826001600160a01b03169052565b5060c083015160c083015260e083015160e0830152610100808401518184015250610120808401516127fd8285018215159052565b5050610140838101519083015261016092830151929091019190915290565b60006020828403121561282e57600080fd5b813561144f816123c7565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8082018082111561085a5761085a612839565b808202811582820484141761085a5761085a612839565b6000826128c8577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b8181038181111561085a5761085a612839565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361291157612911612839565b5060010190565b60005b8381101561293357818101518382015260200161291b565b50506000910152565b60e08152600088518060e084015261010061295d8282860160208e01612918565b63ffffffff9990991660208401526001600160a01b039788166040840152959096166060820152608081019390935260a0830191909152151560c0820152601f9091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0160190910192915050565b80516123e7816125b9565b80516123e7816123c7565b80516123e7816125d6565b60006101808284031215612a0057600080fd5b612a086124a3565b612a11836129cc565b8152612a1f602084016129cc565b6020820152612a30604084016129d7565b6040820152612a41606084016129d7565b6060820152612a52608084016129d7565b6080820152612a6360a084016129d7565b60a082015260c083015160c082015260e083015160e0820152610100808401518183015250610120612a968185016129e2565b908201526101408381015190820152610160928301519281019290925250919050565b600060208284031215612acb57600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600060208284031215612b1357600080fd5b815161144f816125d6565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b60008251612b5f818460208701612918565b919091019291505056fea2646970667358221220e9dd17881b30b52cd3cbfc5932ec6ff3c3a01111638264cfdff6ef34d478bd7764736f6c63430008140033","runtime-code":"0x60806040526004361061026a5760003560e01c80639010d07c11610153578063add98c70116100cb578063ca15c8731161007f578063d547741f11610064578063d547741f146107a1578063dcf844a7146107c1578063e00a83e0146107ee57600080fd5b8063ca15c8731461074d578063ccc574901461076d57600080fd5b8063b13aa2d6116100b0578063b13aa2d6146106f6578063b250fe6b14610716578063bf333f2c1461073657600080fd5b8063add98c70146106c0578063affed0e0146106e057600080fd5b8063a217fddf11610122578063a5bbe22b11610107578063a5bbe22b1461047f578063aa9641ab14610673578063ac11fb1a1461069357600080fd5b8063a217fddf1461062a578063a3ec191a1461063f57600080fd5b80639010d07c146104f857806391ad50391461053057806391d14854146105b2578063926d7d7f146105f657600080fd5b806341fcb612116101e65780635eb7d946116101b55780638379a24f1161019a5780638379a24f14610495578063886d36ff146104c55780638f0d6f17146104e557600080fd5b80635eb7d9461461045f578063820688d51461047f57600080fd5b806341fcb612146103e2578063458516941461040257806358f85880146104155780635960ccf21461042b57600080fd5b80630f5f6ed71161023d578063248a9ca311610222578063248a9ca3146103725780632f2ff15d146103a257806336568abe146103c257600080fd5b80630f5f6ed714610345578063190da5951461035b57600080fd5b806301ffc9a71461026f57806303ed0ee5146102a4578063051287bc146102e657806306f333f214610323575b600080fd5b34801561027b57600080fd5b5061028f61028a3660046122fc565b610804565b60405190151581526020015b60405180910390f35b3480156102b057600080fd5b506102d87f043c983c49d46f0e102151eaf8085d4a2e6571d5df2d47b013f39bddfd4a639d81565b60405190815260200161029b565b3480156102f257600080fd5b5061031661030136600461233e565b60056020526000908152604090205460ff1681565b60405161029b9190612386565b34801561032f57600080fd5b5061034361033e3660046123ec565b610860565b005b34801561035157600080fd5b506102d861271081565b34801561036757600080fd5b506102d862093a8081565b34801561037e57600080fd5b506102d861038d36600461233e565b60009081526020819052604090206001015490565b3480156103ae57600080fd5b506103436103bd366004612425565b610927565b3480156103ce57600080fd5b506103436103dd366004612425565b610952565b3480156103ee57600080fd5b506103436103fd366004612572565b61099e565b6103436104103660046125ef565b610bd7565b34801561042157600080fd5b506102d860025481565b34801561043757600080fd5b506102d87fdb9556138406326f00296e13ea2ad7db24ba82381212d816b1a40c23b466b32781565b34801561046b57600080fd5b5061034361047a366004612692565b610ee5565b34801561048b57600080fd5b506102d861070881565b3480156104a157600080fd5b5061028f6104b036600461233e565b60076020526000908152604090205460ff1681565b3480156104d157600080fd5b506103436104e03660046126cf565b6110bd565b6103436104f3366004612692565b6111f0565b34801561050457600080fd5b50610518610513366004612714565b611437565b6040516001600160a01b03909116815260200161029b565b34801561053c57600080fd5b5061058661054b36600461233e565b6006602052600090815260409020546bffffffffffffffffffffffff8116906c0100000000000000000000000090046001600160a01b031682565b604080516bffffffffffffffffffffffff90931683526001600160a01b0390911660208301520161029b565b3480156105be57600080fd5b5061028f6105cd366004612425565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b34801561060257600080fd5b506102d87fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc481565b34801561063657600080fd5b506102d8600081565b34801561064b57600080fd5b506102d87f000000000000000000000000000000000000000000000000000000000000000081565b34801561067f57600080fd5b5061028f61068e366004612425565b611456565b34801561069f57600080fd5b506106b36106ae366004612692565b611559565b60405161029b9190612736565b3480156106cc57600080fd5b506103436106db36600461233e565b6115cc565b3480156106ec57600080fd5b506102d860085481565b34801561070257600080fd5b5061034361071136600461233e565b611735565b34801561072257600080fd5b5061034361073136600461233e565b611817565b34801561074257600080fd5b506102d8620f424081565b34801561075957600080fd5b506102d861076836600461233e565b61187f565b34801561077957600080fd5b506102d87f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5581565b3480156107ad57600080fd5b506103436107bc366004612425565b611896565b3480156107cd57600080fd5b506102d86107dc36600461281c565b60036020526000908152604090205481565b3480156107fa57600080fd5b506102d860045481565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f5a05180f00000000000000000000000000000000000000000000000000000000148061085a575061085a826118bb565b92915050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5561088a81611952565b6001600160a01b038316600090815260036020526040812054908190036108b15750505050565b6001600160a01b0384166000818152600360205260408120556108d590848361195f565b604080516001600160a01b038087168252851660208201529081018290527f244e51bc38c1452fa8aaf487bcb4bca36c2baa3a5fbdb776b1eabd8dc6d277cd9060600160405180910390a1505b505050565b60008281526020819052604090206001015461094281611952565b61094c8383611a82565b50505050565b6001600160a01b0381163314610994576040517f6697b23200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6109228282611ab7565b7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc46109c881611952565b8251602084012060006109da85611559565b9050600260008381526005602052604090205460ff166004811115610a0157610a01612357565b14610a38576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000828152600660209081526040918290208251808401909352546bffffffffffffffffffffffff811683526c0100000000000000000000000090046001600160a01b03169082018190523314610abb576040517f4af43a9000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80516107089042036bffffffffffffffffffffffff1611610b08576040517f1992d0bd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000838152600560205260409020805460ff1916600317905561010082015115610b645761010082015160808301516001600160a01b031660009081526003602052604081208054909190610b5e908490612868565b90915550505b608082015160c0830151610b826001600160a01b038316888361195f565b604080516001600160a01b03848116825260208201849052891691339188917f582211c35a2139ac3bbaac74663c6a1f56c6cbb658b41fe11fd45a82074ac67891015b60405180910390a45050505050505050565b46816000015163ffffffff1603610c1a576040517f7029fdf900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60a08101511580610c2d575060c0810151155b15610c64576040517fe38820c800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60608101516001600160a01b03161580610c89575060808101516001600160a01b0316155b15610cc0576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610ccc61070842612868565b8161010001511015610d0a576040517f04b7fcc800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000610d1f3083606001518460a00151611ae4565b90506000806002541115610d4c57620f424060025483610d3f919061287b565b610d499190612892565b90505b610d5681836128cd565b915060006040518061018001604052804663ffffffff168152602001856000015163ffffffff16815260200185602001516001600160a01b0316815260200185604001516001600160a01b0316815260200185606001516001600160a01b0316815260200185608001516001600160a01b031681526020018481526020018560c0015181526020018381526020018560e0015115158152602001856101000151815260200160086000815480929190610e0e906128e0565b909155509052604051610e249190602001612736565b604080518083037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0018152828252805160208083019190912060008181526005835293909320805460ff191660011790558701518751606089015160808a015160c08b015160e08c015195985095966001600160a01b039094169587957f120ea0364f36cdac7983bcfdd55270ca09d7f9b314a2ebc425a3b01ab1d6403a95610ed6958b959094909390928e9261293c565b60405180910390a35050505050565b805160208201206000610ef783611559565b3360009081527fd2043bf65931af3dbecf60d0db8f40e4160406d7beb00522f4200cf4944a1eb8602052604090205490915060ff1615610f74578061014001514211610f6f576040517fe15ff9ea00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610fc0565b62093a80816101400151610f889190612868565b4211610fc0576040517fe15ff9ea00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600160008381526005602052604090205460ff166004811115610fe557610fe5612357565b1461101c576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600082815260056020526040808220805460ff19166004179055820151608083015161010084015160c0850151929391926110579190612868565b905061106d6001600160a01b038316848361195f565b604080516001600160a01b0384811682526020820184905285169187917fb4c55c0c9bc613519b920e88748090150b890a875d307f21bea7d4fb2e8bc958910160405180910390a3505050505050565b7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc46110e781611952565b82516020840120600160008281526005602052604090205460ff16600481111561111357611113612357565b1461114a576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008181526005602090815260408083208054600260ff19909116179055805180820182526bffffffffffffffffffffffff4281168252338285018181528787526006865295849020925195516001600160a01b03166c0100000000000000000000000002959091169490941790555185815283917f4ac8af8a2cd87193d64dfc7a3b8d9923b714ec528b18725d080aa1299be0c5e4910160405180910390a350505050565b7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc461121a81611952565b81516020830120600061122c84611559565b90504663ffffffff16816020015163ffffffff1614611277576040517f7029fdf900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8061014001514211156112b6576040517f559895a300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008281526007602052604090205460ff16156112ff576040517fbef7bb7d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000828152600760205260409020805460ff19166001179055606081015160a082015160e083015160045461012085015161134857506000611342848484611ae4565b506113b9565b7fffffffffffffffffffffffff11111111111111111111111111111111111111126001600160a01b0384160161138c5761134284846113878486612868565b611ae4565b611397848484611ae4565b506113b78473eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee83611ae4565b505b845160808087015160a08089015160c0808b015160e08c01516040805163ffffffff90991689526001600160a01b0396871660208a0152938616938801939093526060870152938501528301849052861691339189917ff8ae392d784b1ea5e8881bfa586d81abf07ef4f1e2fc75f7fe51c90f05199a5c9101610bc5565b600082815260016020526040812061144f9083611cb3565b9392505050565b6000600260008481526005602052604090205460ff16600481111561147d5761147d612357565b146114b4576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000838152600660209081526040918290208251808401909352546bffffffffffffffffffffffff811683526001600160a01b036c01000000000000000000000000909104811691830182905284161461153a576040517f4af43a9000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80516107089042036bffffffffffffffffffffffff1611949350505050565b604080516101808101825260008082526020808301829052928201819052606082018190526080820181905260a0820181905260c0820181905260e082018190526101008201819052610120820181905261014082018190526101608201528251909161085a91840181019084016129ed565b7f043c983c49d46f0e102151eaf8085d4a2e6571d5df2d47b013f39bddfd4a639d6115f681611952565b600260008381526005602052604090205460ff16600481111561161b5761161b612357565b14611652576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000828152600660209081526040918290208251808401909352546bffffffffffffffffffffffff8082168085526c010000000000000000000000009092046001600160a01b031693909201929092526107089142031611156116e1576040517f3e908aac00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000828152600560209081526040808320805460ff19166001179055600690915280822082905551339184917f0695cf1d39b3055dcd0fe02d8b47eaf0d5a13e1996de925de59d0ef9b7f7fad49190a35050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5561175f81611952565b6127108211156117d0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f6e657746656552617465203e206d61780000000000000000000000000000000060448201526064015b60405180910390fd5b600280549083905560408051828152602081018590527f14914da2bf76024616fbe1859783fcd4dbddcb179b1f3a854949fbf920dcb95791015b60405180910390a1505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5561184181611952565b600480549083905560408051828152602081018590527f5cf09b12f3f56b4c564d51b25b40360af6d795198adb61ae0806a36c294323fa910161180a565b600081815260016020526040812061085a90611cbf565b6000828152602081905260409020600101546118b181611952565b61094c8383611ab7565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061085a57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff0000000000000000000000000000000000000000000000000000000083161461085a565b61195c8133611cc9565b50565b306001600160a01b0383160361197457505050565b8060000361198157505050565b7fffffffffffffffffffffffff11111111111111111111111111111111111111126001600160a01b03841601611a6e576000826001600160a01b03168260405160006040518083038185875af1925050503d80600081146119fe576040519150601f19603f3d011682016040523d82523d6000602084013e611a03565b606091505b505090508061094c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f455448207472616e73666572206661696c65640000000000000000000000000060448201526064016117c7565b6109226001600160a01b0384168383611d39565b600080611a8f8484611dad565b9050801561144f576000848152600160205260409020611aaf9084611e57565b509392505050565b600080611ac48484611e6c565b9050801561144f576000848152600160205260409020611aaf9084611eef565b60006001600160a01b03831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14611c4d57611b1c836001600160a01b0316611f04565b6040517f70a082310000000000000000000000000000000000000000000000000000000081526001600160a01b0385811660048301528416906370a0823190602401602060405180830381865afa158015611b7b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b9f9190612ab9565b9050611bb66001600160a01b038416338685611faa565b6040517f70a082310000000000000000000000000000000000000000000000000000000081526001600160a01b0385811660048301528291908516906370a0823190602401602060405180830381865afa158015611c18573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c3c9190612ab9565b611c4691906128cd565b905061144f565b348214611c86576040517f81de0bf300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b0384163014611caa57611caa6001600160a01b038416858461195f565b50349392505050565b600061144f8383611fe3565b600061085a825490565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16611d35576040517fe2517d3f0000000000000000000000000000000000000000000000000000000081526001600160a01b0382166004820152602481018390526044016117c7565b5050565b6040516001600160a01b0383811660248301526044820183905261092291859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505061200d565b6000828152602081815260408083206001600160a01b038516845290915281205460ff16611e4f576000838152602081815260408083206001600160a01b03861684529091529020805460ff19166001179055611e073390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a450600161085a565b50600061085a565b600061144f836001600160a01b038416612089565b6000828152602081815260408083206001600160a01b038516845290915281205460ff1615611e4f576000838152602081815260408083206001600160a01b0386168085529252808320805460ff1916905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a450600161085a565b600061144f836001600160a01b0384166120d0565b7fffffffffffffffffffffffff11111111111111111111111111111111111111126001600160a01b03821601611f66576040517f7f523fe800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b806001600160a01b03163b60000361195c576040517f7f523fe800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040516001600160a01b03848116602483015283811660448301526064820183905261094c9186918216906323b872dd90608401611d66565b6000826000018281548110611ffa57611ffa612ad2565b9060005260206000200154905092915050565b60006120226001600160a01b038416836121c3565b905080516000141580156120475750808060200190518101906120459190612b01565b155b15610922576040517f5274afe70000000000000000000000000000000000000000000000000000000081526001600160a01b03841660048201526024016117c7565b6000818152600183016020526040812054611e4f5750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561085a565b600081815260018301602052604081205480156121b95760006120f46001836128cd565b8554909150600090612108906001906128cd565b905080821461216d57600086600001828154811061212857612128612ad2565b906000526020600020015490508087600001848154811061214b5761214b612ad2565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061217e5761217e612b1e565b60019003818190600052602060002001600090559055856001016000868152602001908152602001600020600090556001935050505061085a565b600091505061085a565b606061144f8383600084600080856001600160a01b031684866040516121e99190612b4d565b60006040518083038185875af1925050503d8060008114612226576040519150601f19603f3d011682016040523d82523d6000602084013e61222b565b606091505b509150915061223b868383612245565b9695505050505050565b60608261225a57612255826122ba565b61144f565b815115801561227157506001600160a01b0384163b155b156122b3576040517f9996b3150000000000000000000000000000000000000000000000000000000081526001600160a01b03851660048201526024016117c7565b508061144f565b8051156122ca5780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006020828403121561230e57600080fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811461144f57600080fd5b60006020828403121561235057600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b60208101600583106123c1577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b91905290565b6001600160a01b038116811461195c57600080fd5b80356123e7816123c7565b919050565b600080604083850312156123ff57600080fd5b823561240a816123c7565b9150602083013561241a816123c7565b809150509250929050565b6000806040838503121561243857600080fd5b82359150602083013561241a816123c7565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051610120810167ffffffffffffffff8111828210171561249d5761249d61244a565b60405290565b604051610180810167ffffffffffffffff8111828210171561249d5761249d61244a565b600082601f8301126124d857600080fd5b813567ffffffffffffffff808211156124f3576124f361244a565b604051601f83017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f011681019082821181831017156125395761253961244a565b8160405283815286602085880101111561255257600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000806040838503121561258557600080fd5b823567ffffffffffffffff81111561259c57600080fd5b6125a8858286016124c7565b925050602083013561241a816123c7565b63ffffffff8116811461195c57600080fd5b80356123e7816125b9565b801515811461195c57600080fd5b80356123e7816125d6565b6000610120828403121561260257600080fd5b61260a612479565b612613836125cb565b8152612621602084016123dc565b6020820152612632604084016123dc565b6040820152612643606084016123dc565b6060820152612654608084016123dc565b608082015260a083013560a082015260c083013560c082015261267960e084016125e4565b60e0820152610100928301359281019290925250919050565b6000602082840312156126a457600080fd5b813567ffffffffffffffff8111156126bb57600080fd5b6126c7848285016124c7565b949350505050565b600080604083850312156126e257600080fd5b823567ffffffffffffffff8111156126f957600080fd5b612705858286016124c7565b95602094909401359450505050565b6000806040838503121561272757600080fd5b50508035926020909101359150565b815163ffffffff1681526101808101602083015161275c602084018263ffffffff169052565b50604083015161277760408401826001600160a01b03169052565b50606083015161279260608401826001600160a01b03169052565b5060808301516127ad60808401826001600160a01b03169052565b5060a08301516127c860a08401826001600160a01b03169052565b5060c083015160c083015260e083015160e0830152610100808401518184015250610120808401516127fd8285018215159052565b5050610140838101519083015261016092830151929091019190915290565b60006020828403121561282e57600080fd5b813561144f816123c7565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8082018082111561085a5761085a612839565b808202811582820484141761085a5761085a612839565b6000826128c8577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b8181038181111561085a5761085a612839565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361291157612911612839565b5060010190565b60005b8381101561293357818101518382015260200161291b565b50506000910152565b60e08152600088518060e084015261010061295d8282860160208e01612918565b63ffffffff9990991660208401526001600160a01b039788166040840152959096166060820152608081019390935260a0830191909152151560c0820152601f9091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0160190910192915050565b80516123e7816125b9565b80516123e7816123c7565b80516123e7816125d6565b60006101808284031215612a0057600080fd5b612a086124a3565b612a11836129cc565b8152612a1f602084016129cc565b6020820152612a30604084016129d7565b6040820152612a41606084016129d7565b6060820152612a52608084016129d7565b6080820152612a6360a084016129d7565b60a082015260c083015160c082015260e083015160e0820152610100808401518183015250610120612a968185016129e2565b908201526101408381015190820152610160928301519281019290925250919050565b600060208284031215612acb57600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600060208284031215612b1357600080fd5b815161144f816125d6565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b60008251612b5f818460208701612918565b919091019291505056fea2646970667358221220e9dd17881b30b52cd3cbfc5932ec6ff3c3a01111638264cfdff6ef34d478bd7764736f6c63430008140033","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.20 ^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 pure 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/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// 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/FastBridge.sol\n\ncontract FastBridge is IFastBridge, Admin {\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 enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeStatus) public bridgeStatuses;\n /// @notice Proof of relayed bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeProof) public bridgeProofs;\n /// @notice Whether bridge has been relayed on destination chain\n mapping(bytes32 =\u003e bool) public bridgeRelays;\n\n /// @dev to prevent replays\n uint256 public nonce;\n // @dev 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 /// @notice Pulls a requested token from the user to the requested recipient.\n /// @dev Be careful of re-entrancy issues when msg.value \u003e 0 and recipient != address(this)\n function _pullToken(address recipient, address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token != UniversalTokenLib.ETH_ADDRESS) {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(recipient);\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, recipient, amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(recipient) - amountPulled;\n } else {\n // Otherwise, we need to check that ETH amount matches msg.value\n if (amount != msg.value) revert MsgValueIncorrect();\n // Transfer value to recipient if not this address\n if (recipient != address(this)) token.universalTransfer(recipient, amount);\n // We will forward msg.value in the external call later, if recipient is not this contract\n amountPulled = msg.value;\n }\n }\n\n /// @inheritdoc IFastBridge\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n // check bridge params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\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\n // transfer tokens to bridge contract\n // @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(address(this), 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 BridgeTransaction({\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 sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n\n // check haven't exceeded deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n\n // mark bridge transaction as relayed\n if (bridgeRelays[transactionId]) revert TransactionRelayed();\n bridgeRelays[transactionId] = true;\n\n // transfer tokens to recipient on destination chain and gas rebate if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n uint256 rebate = chainGasAmount;\n if (!transaction.sendChainGas) {\n // forward erc20\n rebate = 0;\n _pullToken(to, token, amount);\n } else if (token == UniversalTokenLib.ETH_ADDRESS) {\n // lump in gas rebate into amount in native gas token\n _pullToken(to, token, amount + rebate);\n } else {\n // forward erc20 then forward gas rebate in native gas token\n _pullToken(to, token, amount);\n _pullToken(to, UniversalTokenLib.ETH_ADDRESS, rebate);\n }\n\n emit BridgeRelayed(\n transactionId,\n msg.sender,\n to,\n transaction.originChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n rebate\n );\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n // update bridge tx status given proof provided\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = BridgeStatus.RELAYER_PROVED;\n bridgeProofs[transactionId] = BridgeProof({timestamp: uint96(block.timestamp), relayer: msg.sender}); // overflow ok\n\n emit BridgeProofProvided(transactionId, msg.sender, destTxHash);\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint96(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint96).max but\n /// proof.timestamp \u003c type(uint96).max via unchecked statement\n /// @param proof The bridge proof\n /// @return delta Time delta since proof submitted\n function _timeSince(BridgeProof memory proof) internal view returns (uint256 delta) {\n unchecked {\n delta = uint96(block.timestamp) - proof.timestamp;\n }\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != relayer) revert SenderIncorrect();\n return _timeSince(proof) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != msg.sender) revert SenderIncorrect();\n if (_timeSince(proof) \u003c= DISPUTE_PERIOD) revert DisputePeriodNotPassed();\n\n bridgeStatuses[transactionId] = 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, msg.sender, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeProofs[transactionId]) \u003e DISPUTE_PERIOD) revert DisputePeriodPassed();\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n delete bridgeProofs[transactionId];\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 BridgeTransaction memory transaction = getBridgeTransaction(request);\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 // set status to refunded if still in requested state\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = 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","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","compilerOptions":"--combined-json bin,bin-runtime,srcmap,srcmap-runtime,abi,userdoc,devdoc,metadata,hashes --optimize --optimize-runs 10000 --allow-paths ., ./, ../ --evm-version=istanbul","srcMap":"58196:11304:0:-:0;;;59371:85;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;59405:6;57187:38;46359:4;59405:6;57187:10;:38::i;:::-;-1:-1:-1;;59437:12:0::1;59423:26;::::0;-1:-1:-1;58196:11304:0;;55672:257;55758:4;;55789:31;55806:4;55812:7;55789:16;:31::i;:::-;55774:46;;55834:7;55830:69;;;55857:18;;;;:12;:18;;;;;:31;;55880:7;55857:22;:31::i;:::-;;55830:69;55915:7;-1:-1:-1;55672:257:0;;;;;:::o;50306:316::-;50383:4;47081:12;;;;;;;;;;;-1:-1:-1;;;;;47081:29:0;;;;;;;;;;;;50399:217;;50442:6;:12;;;;;;;;;;;-1:-1:-1;;;;;50442:29:0;;;;;;;;;:36;;-1:-1:-1;;50442:36:0;50474:4;50442:36;;;50524:12;22402:10;;22323:96;50524:12;-1:-1:-1;;;;;50497:40:0;50515:7;-1:-1:-1;;;;;50497:40:0;50509:4;50497:40;;;;;;;;;;-1:-1:-1;50558:4:0;50551:11;;50399:217;-1:-1:-1;50600:5:0;50593:12;;31847:150;31917:4;31940:50;31945:3;-1:-1:-1;;;;;31965:23:0;;25835:4;27891:21;;;:14;;;:21;;;;;;25851:321;;-1:-1:-1;25893:23:0;;;;;;;;:11;:23;;;;;;;;;;;;;26075:18;;26051:21;;;:14;;;:21;;;;;;:42;;;;26107: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;58196:11304:0;;;;;;;;;;;;","srcMapRuntime":"58196:11304:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;54332:212;;;;;;;;;;-1:-1:-1;54332:212:0;;;;;:::i;:::-;;:::i;:::-;;;612:14:1;;605:22;587:41;;575:2;560:18;54332:212:0;;;;;;;;56562:60;;;;;;;;;;;;56599:23;56562:60;;;;;785:25:1;;;773:2;758:18;56562:60:0;639:177:1;58923:54:0;;;;;;;;;;-1:-1:-1;58923:54:0;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;:::i;57534:359::-;;;;;;;;;;-1:-1:-1;57534:359:0;;;;;:::i;:::-;;:::i;:::-;;56744:45;;;;;;;;;;;;56783:6;56744:45;;58521;;;;;;;;;;;;58560:6;58521:45;;47937:120;;;;;;;;;;-1:-1:-1;47937:120:0;;;;;:::i;:::-;48002:7;48028:12;;;;;;;;;;:22;;;;47937:120;48353:136;;;;;;;;;;-1:-1:-1;48353:136:0;;;;;:::i;:::-;;:::i;49455:245::-;;;;;;;;;;-1:-1:-1;49455:245:0;;;;;:::i;:::-;;:::i;66598:1146::-;;;;;;;;;;-1:-1:-1;66598:1146:0;;;;;:::i;:::-;;:::i;61056:2114::-;;;;;;:::i;:::-;;:::i;56906:30::-;;;;;;;;;;;;;;;;56490:66;;;;;;;;;;;;56530:26;56490:66;;68345:1153;;;;;;;;;;-1:-1:-1;68345:1153:0;;;;;:::i;:::-;;:::i;58653:56::-;;;;;;;;;;;;58699:10;58653:56;;59168:44;;;;;;;;;;-1:-1:-1;59168:44:0;;;;;:::i;:::-;;;;;;;;;;;;;;;;64964:567;;;;;;;;;;-1:-1:-1;64964:567:0;;;;;:::i;:::-;;:::i;63208:1718::-;;;;;;:::i;:::-;;:::i;55129:142::-;;;;;;;;;;-1:-1:-1;55129:142:0;;;;;:::i;:::-;;:::i;:::-;;;-1:-1:-1;;;;;7391:55:1;;;7373:74;;7361:2;7346:18;55129:142:0;7227:226:1;59042:51:0;;;;;;;;;;-1:-1:-1;59042:51:0;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;59042:51:0;;;;;;;7660:26:1;7648:39;;;7630:58;;-1:-1:-1;;;;;7724:55:1;;;7719:2;7704:18;;7697:83;7603:18;59042:51:0;7458:328:1;46981:136:0;;;;;;;;;;-1:-1:-1;46981:136:0;;;;;:::i;:::-;47058:4;47081:12;;;;;;;;;;;-1:-1:-1;;;;;47081:29:0;;;;;;;;;;;;;;;46981:136;56420:64;;;;;;;;;;;;56459:25;56420:64;;46314:49;;;;;;;;;;-1:-1:-1;46314:49:0;46359:4;46314:49;;59328:36;;;;;;;;;;;;;;;66187:373;;;;;;;;;;-1:-1:-1;66187:373:0;;;;;:::i;:::-;;:::i;60855:163::-;;;;;;;;;;-1:-1:-1;60855:163:0;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;67782:525::-;;;;;;;;;;-1:-1:-1;67782:525:0;;;;;:::i;:::-;;:::i;59251:20::-;;;;;;;;;;;;;;;;57238:290;;;;;;;;;;-1:-1:-1;57238:290:0;;;;;:::i;:::-;;:::i;57899:264::-;;;;;;;;;;-1:-1:-1;57899:264:0;;;;;:::i;:::-;;:::i;56701:37::-;;;;;;;;;;;;56735:3;56701:37;;55439:131;;;;;;;;;;-1:-1:-1;55439:131:0;;;;;:::i;:::-;;:::i;56628:66::-;;;;;;;;;;;;56668:26;56628:66;;48769:138;;;;;;;;;;-1:-1:-1;48769:138:0;;;;;:::i;:::-;;:::i;56992:47::-;;;;;;;;;;-1:-1:-1;56992:47:0;;;;;:::i;:::-;;;;;;;;;;;;;;57113:29;;;;;;;;;;;;;;;;54332:212;54417:4;54440:57;;;54455:42;54440:57;;:97;;;54501:36;54525:11;54501:23;:36::i;:::-;54433:104;54332:212;-1:-1:-1;;54332:212:0:o;57534:359::-;56668:26;46591:16;46602:4;46591:10;:16::i;:::-;-1:-1:-1;;;;;57658:19:0;::::1;57638:17;57658:19:::0;;;:12:::1;:19;::::0;;;;;;57691:14;;;57687:27:::1;;57707:7;57534:359:::0;;;:::o;57687:27::-:1;-1:-1:-1::0;;;;;57755:19:0;::::1;57777:1;57755:19:::0;;;:12:::1;:19;::::0;;;;:23;57788:45:::1;::::0;57812:9;57823;57788:23:::1;:45::i;:::-;57848:38;::::0;;-1:-1:-1;;;;;9986:15:1;;;9968:34;;10038:15;;10033:2;10018:18;;10011:43;10070:18;;;10063:34;;;57848:38:0::1;::::0;9895:2:1;9880:18;57848:38:0::1;;;;;;;57628:265;46617:1;57534:359:::0;;;:::o;48353:136::-;48002:7;48028:12;;;;;;;;;;:22;;;46591:16;46602:4;46591:10;:16::i;:::-;48457:25:::1;48468:4;48474:7;48457:10;:25::i;:::-;;48353:136:::0;;;:::o;49455:245::-;-1:-1:-1;;;;;49548:34:0;;22402:10;49548:34;49544:102;;49605:30;;;;;;;;;;;;;;49544:102;49656:37;49668:4;49674:18;49656:11;:37::i;66598:1146::-;56459:25;46591:16;46602:4;46591:10;:16::i;:::-;66713:18;;::::1;::::0;::::1;::::0;66689:21:::1;66780:29;66723:7:::0;66780:20:::1;:29::i;:::-;66741:68:::0;-1:-1:-1;66927:27:0::1;66894:29;::::0;;;:14:::1;:29;::::0;;;;;::::1;;:60;::::0;::::1;;;;;;:::i;:::-;;66890:90;;66963:17;;;;;;;;;;;;;;66890:90;66991:24;67018:27:::0;;;:12:::1;:27;::::0;;;;;;;;66991:54;;;;::::1;::::0;;;;::::1;::::0;::::1;::::0;;;;::::1;-1:-1:-1::0;;;;;66991:54:0::1;::::0;;::::1;::::0;;;67076:10:::1;67059:27;67055:57;;67095:17;;;;;;;;;;;;;;67055:57;66117:15:::0;;58415:10:::1;::::0;66098:15;66091:41;66083:49;;67126:35:::1;67122:72;;67170:24;;;;;;;;;;;;;;67122:72;67205:29;::::0;;;:14:::1;:29;::::0;;;;:60;;-1:-1:-1;;67205:60:0::1;67237:28;67205:60;::::0;;67340:27:::1;::::0;::::1;::::0;:31;67336:105:::1;;67414:27;::::0;::::1;::::0;67386:23:::1;::::0;::::1;::::0;-1:-1:-1;;;;;67373:37:0::1;;::::0;;;:12:::1;:37;::::0;;;;:68;;:37;;;:68:::1;::::0;67414:27;;67373:68:::1;:::i;:::-;::::0;;;-1:-1:-1;;67336:105:0::1;67536:23;::::0;::::1;::::0;67586:24:::1;::::0;::::1;::::0;67620:35:::1;-1:-1:-1::0;;;;;67620:23:0;::::1;67644:2:::0;67586:24;67620:23:::1;:35::i;:::-;67671:66;::::0;;-1:-1:-1;;;;;10619:55:1;;;10601:74;;10706:2;10691:18;;10684:34;;;67671:66:0;::::1;::::0;67707:10:::1;::::0;67692:13;;67671:66:::1;::::0;10574:18:1;67671:66:0::1;;;;;;;;66679:1065;;;;;66598:1146:::0;;;:::o;61056:2114::-;61183:13;61162:6;:17;;;:34;;;61158:63;;61205:16;;;;;;;;;;;;;;61158:63;61235:19;;;;:24;;:50;;-1:-1:-1;61263:17:0;;;;:22;61235:50;61231:80;;;61294:17;;;;;;;;;;;;;;61231:80;61325:18;;;;-1:-1:-1;;;;;61325:32:0;;;:66;;-1:-1:-1;61361:16:0;;;;-1:-1:-1;;;;;61361:30:0;;61325:66;61321:92;;;61400:13;;;;;;;;;;;;;;61321:92;61445:37;58699:10;61445:15;:37;:::i;:::-;61427:6;:15;;;:55;61423:86;;;61491:18;;;;;;;;;;;;;;61423:86;61644:20;61667:66;61686:4;61693:6;:18;;;61713:6;:19;;;61667:10;:66::i;:::-;61644:89;;61801:23;61856:1;61838:15;;:19;61834:85;;;56735:3;61893:15;;61878:12;:30;;;;:::i;:::-;61877:42;;;;:::i;:::-;61859:60;;61834:85;61929:31;61945:15;61929:31;;:::i;:::-;;;62073:20;62120:618;;;;;;;;62178:13;62120:618;;;;;;62223:6;:17;;;62120:618;;;;;;62272:6;:13;;;-1:-1:-1;;;;;62120:618:0;;;;;62318:6;:9;;;-1:-1:-1;;;;;62120:618:0;;;;;62358:6;:18;;;-1:-1:-1;;;;;62120:618:0;;;;;62405:6;:16;;;-1:-1:-1;;;;;62120:618:0;;;;;62453:12;62120:618;;;;62495:6;:17;;;62120:618;;;;62547:15;62120:618;;;;62594:6;:19;;;62120:618;;;;;;62641:6;:15;;;62120:618;;;;62681:5;;:7;;;;;;;;;:::i;:::-;;;;-1:-1:-1;62120:618:0;;62096:652;;;;;;;;:::i;:::-;;;;;;;;;;;;;;62782:18;;62096:652;62782:18;;;;;;;62758:21;62810:29;;;:14;:29;;;;;;:54;;-1:-1:-1;;62810:54:0;62842:22;62810:54;;;62936:13;;;62984:17;;63015:18;;;;63047:16;;;;63103:17;;;;63134:19;;;;62096:652;;-1:-1:-1;62782:18:0;;-1:-1:-1;;;;;62880:283:0;;;;62782:18;;62880:283;;;;62096:652;;62984:17;;63015:18;;63047:16;;63077:12;;62880:283;:::i;:::-;;;;;;;;61117:2053;;;;61056:2114;:::o;68345:1153::-;68426:18;;;;;;68402:21;68493:29;68436:7;68493:20;:29::i;:::-;68560:10;47058:4;47081:29;;;:12;;:29;:12;:29;;;68454:68;;-1:-1:-1;47081:29:0;;68533:382;;;68668:11;:20;;;68649:15;:39;68645:73;;68697:21;;;;;;;;;;;;;;68645:73;68533:382;;;58560:6;68839:11;:20;;;:35;;;;:::i;:::-;68820:15;:54;68816:88;;68883:21;;;;;;;;;;;;;;68816:88;69024:22;68991:29;;;;:14;:29;;;;;;;;:55;;;;;;;;:::i;:::-;;68987:85;;69055:17;;;;;;;;;;;;;;68987:85;69082:29;;;;:14;:29;;;;;;:53;;-1:-1:-1;;69082:53:0;69114:21;69082:53;;;69221:24;;;69271:23;;;;69348:27;;;;69321:24;;;;69221;;69271:23;;69321:54;;69348:27;69321:54;:::i;:::-;69304:71;-1:-1:-1;69385:35:0;-1:-1:-1;;;;;69385:23:0;;69409:2;69304:71;69385:23;:35::i;:::-;69436:55;;;-1:-1:-1;;;;;10619:55:1;;;10601:74;;10706:2;10691:18;;10684:34;;;69436:55:0;;;69458:13;;69436:55;;10574:18:1;69436:55:0;;;;;;;68392:1106;;;;;68345:1153;:::o;64964:567::-;56459:25;46591:16;46602:4;46591:10;:16::i;:::-;65087:18;;::::1;::::0;::::1;::::0;65208:22:::1;65175:29;::::0;;;:14:::1;:29;::::0;;;;;::::1;;:55;::::0;::::1;;;;;;:::i;:::-;;65171:85;;65239:17;;;;;;;;;;;;;;65171:85;65266:29;::::0;;;:14:::1;:29;::::0;;;;;;;:59;;65298:27:::1;-1:-1:-1::0;;65266:59:0;;::::1;;::::0;;65365:70;;;;::::1;::::0;;::::1;65396:15;65365:70:::0;::::1;::::0;;65423:10:::1;65365:70:::0;;::::1;::::0;;;65335:27;;;:12:::1;:27:::0;;;;;;:100;;;;-1:-1:-1;;;;;65335:100:0::1;::::0;::::1;::::0;;;::::1;::::0;;;::::1;::::0;;65466:58;785:25:1;;;65266:29:0;;65466:58:::1;::::0;758:18:1;65466:58:0::1;;;;;;;65053:478;64964:567:::0;;;:::o;63208:1718::-;56459:25;46591:16;46602:4;46591:10;:16::i;:::-;63319:18;;::::1;::::0;::::1;::::0;63295:21:::1;63386:29;63329:7:::0;63386:20:::1;:29::i;:::-;63347:68;;63463:13;63429:48;;:11;:23;;;:48;;;63425:77;;63486:16;;;;;;;;;;;;;;63425:77;63598:11;:20;;;63580:15;:38;63576:69;;;63627:18;;;;;;;;;;;;;;63576:69;63706:27;::::0;;;:12:::1;:27;::::0;;;;;::::1;;63702:60;;;63742:20;;;;;;;;;;;;;;63702:60;63772:27;::::0;;;:12:::1;:27;::::0;;;;:34;;-1:-1:-1;;63772:34:0::1;63802:4;63772:34;::::0;;63919:25:::1;::::0;::::1;::::0;63970:21:::1;::::0;::::1;::::0;64018:22:::1;::::0;::::1;::::0;64068:14:::1;::::0;64097:24:::1;::::0;::::1;::::0;64092:517:::1;;-1:-1:-1::0;64175:1:0::1;64190:29;64201:2:::0;64205:5;64212:6;64190:10:::1;:29::i;:::-;;64092:517;;;64240:38:::0;-1:-1:-1;;;;;64240:38:0;::::1;::::0;64236:373:::1;;64360:38;64371:2:::0;64375:5;64382:15:::1;64391:6:::0;64382;:15:::1;:::i;:::-;64360:10;:38::i;64236:373::-;64502:29;64513:2;64517:5;64524:6;64502:10;:29::i;:::-;;64545:53;64556:2;51321:42;64591:6;64545:10;:53::i;:::-;;64236:373;64718:25:::0;;64757:23:::1;::::0;;::::1;::::0;64794:21:::1;::::0;;::::1;::::0;64829:24:::1;::::0;;::::1;::::0;64867:22:::1;::::0;::::1;::::0;64624:295:::1;::::0;;13103:10:1;13091:23;;;13073:42;;-1:-1:-1;;;;;13212:15:1;;;13207:2;13192:18;;13185:43;13264:15;;;13244:18;;;13237:43;;;;13311:2;13296:18;;13289:34;13339:19;;;13332:35;13383:19;;13376:35;;;64624:295:0;::::1;::::0;64678:10:::1;::::0;64651:13;;64624:295:::1;::::0;13045:19:1;64624:295:0::1;12788:629:1::0;55129:142:0;55210:7;55236:18;;;:12;:18;;;;;:28;;55258:5;55236:21;:28::i;:::-;55229:35;55129:142;-1:-1:-1;;;55129:142:0:o;66187:373::-;66268:4;66321:27;66288:29;;;;:14;:29;;;;;;;;:60;;;;;;;;:::i;:::-;;66284:90;;66357:17;;;;;;;;;;;;;;66284:90;66384:24;66411:27;;;:12;:27;;;;;;;;;66384:54;;;;;;;;;;;;;;-1:-1:-1;;;;;66384:54:0;;;;;;;;;;;;66452:24;;;66448:54;;66485:17;;;;;;;;;;;;;;66448:54;66117:15;;58415:10;;66098:15;66091:41;66083:49;;66519:34;;66187:373;-1:-1:-1;;;;66187:373:0:o;60855:163::-;-1:-1:-1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;60971:40:0;;-1:-1:-1;;60971:40:0;;;;;;;;;;:::i;67782:525::-;56599:23;46591:16;46602:4;46591:10;:16::i;:::-;67899:27:::1;67866:29;::::0;;;:14:::1;:29;::::0;;;;;::::1;;:60;::::0;::::1;;;;;;:::i;:::-;;67862:90;;67935:17;;;;;;;;;;;;;;67862:90;67977:27;::::0;;;:12:::1;:27;::::0;;;;;;;;67966:39;;;;::::1;::::0;;;;::::1;::::0;;::::1;::::0;;;;;;::::1;-1:-1:-1::0;;;;;67966:39:0::1;::::0;;;::::1;::::0;;;;58415:10:::1;::::0;66098:15;66091:41;66083:49;67966:56:::1;67962:90;;;68031:21;;;;;;;;;;;;;;67962:90;68140:29;::::0;;;:14:::1;:29;::::0;;;;;;;:54;;-1:-1:-1;;68140:54:0::1;68172:22;68140:54;::::0;;68211:12:::1;:27:::0;;;;;;68204:34;;;68254:46;68289:10:::1;::::0;68140:29;;68254:46:::1;::::0;68140:29;68254:46:::1;67782:525:::0;;:::o;57238:290::-;56668:26;46591:16;46602:4;46591:10;:16::i;:::-;56783:6:::1;57337:10;:26;;57329:55;;;::::0;::::1;::::0;;15233:2:1;57329:55:0::1;::::0;::::1;15215:21:1::0;15272:2;15252:18;;;15245:30;15311:18;15291;;;15284:46;15347:18;;57329:55:0::1;;;;;;;;;57415:15;::::0;;57440:28;;;;57483:38:::1;::::0;;15550:25:1;;;15606:2;15591:18;;15584:34;;;57483:38:0::1;::::0;15523:18:1;57483:38:0::1;;;;;;;;57319:209;57238:290:::0;;:::o;57899:264::-;56668:26;46591:16;46602:4;46591:10;:16::i;:::-;58024:14:::1;::::0;;58048:34;;;;58097:59:::1;::::0;;15550:25:1;;;15606:2;15591:18;;15584:34;;;58097:59:0::1;::::0;15523:18:1;58097:59:0::1;15376:248:1::0;55439:131:0;55510:7;55536:18;;;:12;:18;;;;;:27;;:25;:27::i;48769:138::-;48002:7;48028:12;;;;;;;;;;:22;;;46591:16;46602:4;46591:10;:16::i;:::-;48874:26:::1;48886:4;48892:7;48874:11;:26::i;46692:202::-:0;46777:4;46800:47;;;46815:32;46800:47;;:87;;-1:-1:-1;38607:25:0;38592:40;;;;46851:36;38493:146;47326:103;47392:30;47403:4;22402:10;47392;:30::i;:::-;47326:103;:::o;51604:653::-;51779:4;-1:-1:-1;;;;;51765:19:0;;;51761:32;;51604:653;;;:::o;51761:32::-;51865:5;51874:1;51865:10;51861:23;;51604:653;;;:::o;51861:23::-;51897:20;-1:-1:-1;;;;;51897:20:0;;;51893:358;;52077:12;52094:2;-1:-1:-1;;;;;52094:7:0;52109:5;52094:25;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;52076:43;;;52141:7;52133:39;;;;;;;16041:2:1;52133:39:0;;;16023:21:1;16080:2;16060:18;;;16053:30;16119:21;16099:18;;;16092:49;16158:18;;52133:39:0;15839:343:1;51893:358:0;52203:37;-1:-1:-1;;;;;52203:26:0;;52230:2;52234:5;52203:26;:37::i;55672:257::-;55758:4;55774:12;55789:31;55806:4;55812:7;55789:16;:31::i;:::-;55774:46;;55834:7;55830:69;;;55857:18;;;;:12;:18;;;;;:31;;55880:7;55857:22;:31::i;:::-;;55915:7;55672:257;-1:-1:-1;;;55672:257:0:o;56032:262::-;56119:4;56135:12;56150:32;56168:4;56174:7;56150:17;:32::i;:::-;56135:47;;56196:7;56192:72;;;56219:18;;;;:12;:18;;;;;:34;;56245:7;56219:25;:34::i;59640:1177::-;59728:20;-1:-1:-1;;;;;59764:38:0;;51321:42;59764:38;59760:1051;;59818:24;:5;-1:-1:-1;;;;;59818:22:0;;:24::i;:::-;59923:34;;;;;-1:-1:-1;;;;;7391:55:1;;;59923:34:0;;;7373:74:1;59923:23:0;;;;;7346:18:1;;59923:34:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;59908:49;-1:-1:-1;60103:61:0;-1:-1:-1;;;;;60103:30:0;;60134:10;60146:9;60157:6;60103:30;:61::i;:::-;60300:34;;;;;-1:-1:-1;;;;;7391:55:1;;;60300:34:0;;;7373:74:1;60337:12:0;;60300:23;;;;;;7346:18:1;;60300:34:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;:49;;;;:::i;:::-;60285:64;;59760:1051;;;60471:9;60461:6;:19;60457:51;;60489:19;;;;;;;;;;;;;;60457:51;-1:-1:-1;;;;;60589:26:0;;60610:4;60589:26;60585:74;;60617:42;-1:-1:-1;;;;;60617:23:0;;60641:9;60652:6;60617:23;:42::i;:::-;-1:-1:-1;60791:9:0;59640:1177;;;;;:::o;33105:156::-;33179:7;33229:22;33233:3;33245:5;33229:3;:22::i;32648:115::-;32711:7;32737:19;32745:3;28087:18;;28005:107;47559:197;47058:4;47081:12;;;;;;;;;;;-1:-1:-1;;;;;47081:29:0;;;;;;;;;;;;47642:108;;47692:47;;;;;-1:-1:-1;;;;;10619:55:1;;47692:47:0;;;10601:74:1;10691:18;;;10684:34;;;10574:18;;47692:47:0;10427:297:1;47642:108:0;47559:197;;:::o;39809:160::-;39918:43;;-1:-1:-1;;;;;10619:55:1;;;39918:43:0;;;10601:74:1;10691:18;;;10684:34;;;39891:71:0;;39911:5;;39933:14;;;;;10574:18:1;;39918:43:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;39891:19;:71::i;50306:316::-;50383:4;47081:12;;;;;;;;;;;-1:-1:-1;;;;;47081:29:0;;;;;;;;;;;;50399:217;;50442:6;:12;;;;;;;;;;;-1:-1:-1;;;;;50442:29:0;;;;;;;;;:36;;-1:-1:-1;;50442:36:0;50474:4;50442:36;;;50524:12;22402:10;;22323:96;50524:12;-1:-1:-1;;;;;50497:40:0;50515:7;-1:-1:-1;;;;;50497:40:0;50509:4;50497:40;;;;;;;;;;-1:-1:-1;50558:4:0;50551:11;;50399:217;-1:-1:-1;50600:5:0;50593:12;;31847:150;31917:4;31940:50;31945:3;-1:-1:-1;;;;;31965:23:0;;31940:4;:50::i;50857:317::-;50935:4;47081:12;;;;;;;;;;;-1:-1:-1;;;;;47081:29:0;;;;;;;;;;;;50951:217;;;51025:5;50993:12;;;;;;;;;;;-1:-1:-1;;;;;50993:29:0;;;;;;;;;;:37;;-1:-1:-1;;50993:37:0;;;51049:40;22402:10;;50993:12;;51049:40;;51025:5;51049:40;-1:-1:-1;51110:4:0;51103:11;;32165:156;32238:4;32261:53;32269:3;-1:-1:-1;;;;;32289:23:0;;32261:7;:53::i;53421:344::-;53588:38;-1:-1:-1;;;;;53588:38:0;;;53584:69;;53635:18;;;;;;;;;;;;;;53584:69;53709:5;-1:-1:-1;;;;;53709:17:0;;53730:1;53709:22;53705:53;;53740:18;;;;;;;;;;;;;;40208:188;40335:53;;-1:-1:-1;;;;;9986:15:1;;;40335:53:0;;;9968:34:1;10038:15;;;10018:18;;;10011:43;10070:18;;;10063:34;;;40308:81:0;;40328:5;;40350:18;;;;;9880::1;;40335:53:0;9705:398:1;28454:118:0;28521:7;28547:3;:11;;28559:5;28547:18;;;;;;;;:::i;:::-;;;;;;;;;28540:25;;28454:118;;;;:::o;42565:629::-;42984:23;43010:33;-1:-1:-1;;;;;43010:27:0;;43038:4;43010:27;:33::i;:::-;42984:59;;43057:10;:17;43078:1;43057:22;;:57;;;;;43095:10;43084:30;;;;;;;;;;;;:::i;:::-;43083:31;43057:57;43053:135;;;43137:40;;;;;-1:-1:-1;;;;;7391:55:1;;43137:40:0;;;7373:74:1;7346:18;;43137:40:0;7227:226:1;25772:406:0;25835:4;27891:21;;;:14;;;:21;;;;;;25851:321;;-1:-1:-1;25893:23:0;;;;;;;;:11;:23;;;;;;;;;;;;;26075:18;;26051:21;;;:14;;;:21;;;;;;:42;;;;26107:11;;26346:1368;26412:4;26541:21;;;:14;;;:21;;;;;;26577:13;;26573:1135;;26944:18;26965:12;26976:1;26965:8;:12;:::i;:::-;27011:18;;26944:33;;-1:-1:-1;26991:17:0;;27011:22;;27032:1;;27011:22;:::i;:::-;26991:42;;27066:9;27052:10;:23;27048:378;;27095:17;27115:3;:11;;27127:9;27115:22;;;;;;;;:::i;:::-;;;;;;;;;27095:42;;27262:9;27236:3;:11;;27248:10;27236:23;;;;;;;;:::i;:::-;;;;;;;;;;;;:35;;;;27375:25;;;:14;;;:25;;;;;:36;;;27048:378;27504:17;;:3;;:17;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;27607:3;:14;;:21;27622:5;27607:21;;;;;;;;;;;27600:28;;;27650:4;27643:11;;;;;;;26573:1135;27692:5;27685:12;;;;;18108:151;18183:12;18214:38;18236:6;18244:4;18250:1;18183:12;18824;18838:23;18865:6;-1:-1:-1;;;;;18865:11:0;18884:5;18891:4;18865:31;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;18823:73;;;;18913:55;18940:6;18948:7;18957:10;18913:26;:55::i;:::-;18906:62;18583:392;-1:-1:-1;;;;;;18583:392:0:o;20028:582::-;20172:12;20201:7;20196:408;;20224:19;20232:10;20224:7;:19::i;:::-;20196:408;;;20448:17;;:22;:49;;;;-1:-1:-1;;;;;;20474:18:0;;;:23;20448:49;20444:119;;;20524:24;;;;;-1:-1:-1;;;;;7391:55:1;;20524:24:0;;;7373:74:1;7346:18;;20524:24:0;7227:226:1;20444:119:0;-1:-1:-1;20583:10:0;20576:17;;21146:516;21277:17;;:21;21273:383;;21505:10;21499:17;21561:15;21548:10;21544:2;21540:19;21533:44;21273:383;21628: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:402;1344:2;1329:18;;1377:1;1366:13;;1356:201;;1413:77;1410:1;1403:88;1514:4;1511:1;1504:15;1542:4;1539:1;1532:15;1356:201;1566:25;;;1195:402;:::o;1602:154::-;-1:-1:-1;;;;;1681:5:1;1677:54;1670:5;1667:65;1657:93;;1746:1;1743;1736:12;1761:134;1829:20;;1858:31;1829:20;1858:31;:::i;:::-;1761:134;;;:::o;1900:388::-;1968:6;1976;2029:2;2017:9;2008:7;2004:23;2000:32;1997:52;;;2045:1;2042;2035:12;1997:52;2084:9;2071:23;2103:31;2128:5;2103:31;:::i;:::-;2153:5;-1:-1:-1;2210:2:1;2195:18;;2182:32;2223:33;2182:32;2223:33;:::i;:::-;2275:7;2265:17;;;1900:388;;;;;:::o;2475:315::-;2543:6;2551;2604:2;2592:9;2583:7;2579:23;2575:32;2572:52;;;2620:1;2617;2610:12;2572:52;2656:9;2643:23;2633:33;;2716:2;2705:9;2701:18;2688:32;2729:31;2754:5;2729:31;:::i;2795:184::-;2847:77;2844:1;2837:88;2944:4;2941:1;2934:15;2968:4;2965:1;2958:15;2984:252;3056:2;3050:9;3098:3;3086:16;;3132:18;3117:34;;3153:22;;;3114:62;3111:88;;;3179:18;;:::i;:::-;3215:2;3208:22;2984:252;:::o;3241:247::-;3308:2;3302:9;3350:3;3338:16;;3384:18;3369:34;;3405:22;;;3366:62;3363:88;;;3431:18;;:::i;3493:777::-;3535:5;3588:3;3581:4;3573:6;3569:17;3565:27;3555:55;;3606:1;3603;3596:12;3555:55;3642:6;3629:20;3668:18;3705:2;3701;3698:10;3695:36;;;3711:18;;:::i;:::-;3845:2;3839:9;3907:4;3899:13;;3750:66;3895:22;;;3919:2;3891:31;3887:40;3875:53;;;3943:18;;;3963:22;;;3940:46;3937:72;;;3989:18;;:::i;:::-;4029:10;4025:2;4018:22;4064:2;4056:6;4049:18;4110:3;4103:4;4098:2;4090:6;4086:15;4082:26;4079:35;4076:55;;;4127:1;4124;4117:12;4076:55;4191:2;4184:4;4176:6;4172:17;4165:4;4157:6;4153:17;4140:54;4238:1;4231:4;4226:2;4218:6;4214:15;4210:26;4203:37;4258:6;4249:15;;;;;;3493:777;;;;:::o;4275:455::-;4352:6;4360;4413:2;4401:9;4392:7;4388:23;4384:32;4381:52;;;4429:1;4426;4419:12;4381:52;4469:9;4456:23;4502:18;4494:6;4491:30;4488:50;;;4534:1;4531;4524:12;4488:50;4557:49;4598:7;4589:6;4578:9;4574:22;4557:49;:::i;:::-;4547:59;;;4656:2;4645:9;4641:18;4628:32;4669:31;4694:5;4669:31;:::i;4735:121::-;4820:10;4813:5;4809:22;4802:5;4799:33;4789:61;;4846:1;4843;4836:12;4861:132;4928:20;;4957:30;4928:20;4957:30;:::i;4998:118::-;5084:5;5077:13;5070:21;5063:5;5060:32;5050:60;;5106:1;5103;5096:12;5121:128;5186:20;;5215:28;5186:20;5215:28;:::i;5254:865::-;5342:6;5395:3;5383:9;5374:7;5370:23;5366:33;5363:53;;;5412:1;5409;5402:12;5363:53;5438:22;;:::i;:::-;5483:28;5501:9;5483:28;:::i;:::-;5476:5;5469:43;5544:38;5578:2;5567:9;5563:18;5544:38;:::i;:::-;5539:2;5532:5;5528:14;5521:62;5615:38;5649:2;5638:9;5634:18;5615:38;:::i;:::-;5610:2;5603:5;5599:14;5592:62;5686:38;5720:2;5709:9;5705:18;5686:38;:::i;:::-;5681:2;5674:5;5670:14;5663:62;5758:39;5792:3;5781:9;5777:19;5758:39;:::i;:::-;5752:3;5745:5;5741:15;5734:64;5859:3;5848:9;5844:19;5831:33;5825:3;5818:5;5814:15;5807:58;5926:3;5915:9;5911:19;5898:33;5892:3;5885:5;5881:15;5874:58;5965:36;5996:3;5985:9;5981:19;5965:36;:::i;:::-;5959:3;5948:15;;5941:61;6021:3;6069:18;;;6056:32;6040:14;;;6033:56;;;;-1:-1:-1;5952:5:1;5254:865;-1:-1:-1;5254:865:1:o;6124:320::-;6192:6;6245:2;6233:9;6224:7;6220:23;6216:32;6213:52;;;6261:1;6258;6251:12;6213:52;6301:9;6288:23;6334:18;6326:6;6323:30;6320:50;;;6366:1;6363;6356:12;6320:50;6389:49;6430:7;6421:6;6410:9;6406:22;6389:49;:::i;:::-;6379:59;6124:320;-1:-1:-1;;;;6124:320:1:o;6449:388::-;6526:6;6534;6587:2;6575:9;6566:7;6562:23;6558:32;6555:52;;;6603:1;6600;6593:12;6555:52;6643:9;6630:23;6676:18;6668:6;6665:30;6662:50;;;6708:1;6705;6698:12;6662:50;6731:49;6772:7;6763:6;6752:9;6748:22;6731:49;:::i;:::-;6721:59;6827:2;6812:18;;;;6799:32;;-1:-1:-1;;;;6449:388:1:o;6842:248::-;6910:6;6918;6971:2;6959:9;6950:7;6946:23;6942:32;6939:52;;;6987:1;6984;6977:12;6939:52;-1:-1:-1;;7010:23:1;;;7080:2;7065:18;;;7052:32;;-1:-1:-1;6842:248:1:o;7890:1373::-;8121:13;;7867:10;7856:22;7844:35;;8090:3;8075:19;;8193:4;8185:6;8181:17;8175:24;8208:53;8255:4;8244:9;8240:20;8226:12;7867:10;7856:22;7844:35;;7791:94;8208:53;;8310:4;8302:6;8298:17;8292:24;8325:56;8375:4;8364:9;8360:20;8344:14;-1:-1:-1;;;;;7161:54:1;7149:67;;7095:127;8325:56;;8430:4;8422:6;8418:17;8412:24;8445:56;8495:4;8484:9;8480:20;8464:14;-1:-1:-1;;;;;7161:54:1;7149:67;;7095:127;8445:56;;8550:4;8542:6;8538:17;8532:24;8565:56;8615:4;8604:9;8600:20;8584:14;-1:-1:-1;;;;;7161:54:1;7149:67;;7095:127;8565:56;;8670:4;8662:6;8658:17;8652:24;8685:56;8735:4;8724:9;8720:20;8704:14;-1:-1:-1;;;;;7161:54:1;7149:67;;7095:127;8685:56;;8797:4;8789:6;8785:17;8779:24;8772:4;8761:9;8757:20;8750:54;8860:4;8852:6;8848:17;8842:24;8835:4;8824:9;8820:20;8813:54;8886:6;8946:2;8938:6;8934:15;8928:22;8923:2;8912:9;8908:18;8901:50;;8970:6;9025:2;9017:6;9013:15;9007:22;9038:51;9085:2;9074:9;9070:18;9054:14;421:13;414:21;402:34;;351:91;9038:51;-1:-1:-1;;9108:6:1;9156:15;;;9150:22;9130:18;;;9123:50;9192:6;9240:15;;;9234:22;9214:18;;;;9207:50;;;;7890:1373;:::o;9453:247::-;9512:6;9565:2;9553:9;9544:7;9540:23;9536:32;9533:52;;;9581:1;9578;9571:12;9533:52;9620:9;9607:23;9639:31;9664:5;9639:31;:::i;10108:184::-;10160:77;10157:1;10150:88;10257:4;10254:1;10247:15;10281:4;10278:1;10271:15;10297:125;10362:9;;;10383:10;;;10380:36;;;10396:18;;:::i;10729:168::-;10802:9;;;10833;;10850:15;;;10844:22;;10830:37;10820:71;;10871:18;;:::i;10902:274::-;10942:1;10968;10958:189;;11003:77;11000:1;10993:88;11104:4;11101:1;11094:15;11132:4;11129:1;11122:15;10958:189;-1:-1:-1;11161:9:1;;10902:274::o;11181:128::-;11248:9;;;11269:11;;;11266:37;;;11283:18;;:::i;11314:195::-;11353:3;11384:66;11377:5;11374:77;11371:103;;11454:18;;:::i;:::-;-1:-1:-1;11501:1:1;11490:13;;11314:195::o;11514:250::-;11599:1;11609:113;11623:6;11620:1;11617:13;11609:113;;;11699:11;;;11693:18;11680:11;;;11673:39;11645:2;11638:10;11609:113;;;-1:-1:-1;;11756:1:1;11738:16;;11731:27;11514:250::o;11769:1014::-;12076:3;12065:9;12058:22;12039:4;12109:6;12103:13;12153:6;12147:3;12136:9;12132:19;12125:35;12179:3;12191:81;12265:6;12260:2;12249:9;12245:18;12238:4;12230:6;12226:17;12191:81;:::i;:::-;12452:10;12440:23;;;;12433:4;12418:20;;12411:53;-1:-1:-1;;;;;12561:15:1;;;12556:2;12541:18;;12534:43;12613:15;;;;12608:2;12593:18;;12586:43;12660:3;12645:19;;12638:35;;;;12704:3;12689:19;;12682:35;;;;12761:14;12754:22;12748:3;12733:19;;12726:51;12324:2;12312:15;;;-1:-1:-1;12308:88:1;12293:104;12289:113;;;;;-1:-1:-1;;11769:1014:1:o;13422:136::-;13500:13;;13522:30;13500:13;13522:30;:::i;13563:138::-;13642:13;;13664:31;13642:13;13664:31;:::i;13706:132::-;13782:13;;13804:28;13782:13;13804:28;:::i;13843:1183::-;13946:6;13999:3;13987:9;13978:7;13974:23;13970:33;13967:53;;;14016:1;14013;14006:12;13967:53;14042:17;;:::i;:::-;14082:39;14111:9;14082:39;:::i;:::-;14075:5;14068:54;14154:48;14198:2;14187:9;14183:18;14154:48;:::i;:::-;14149:2;14142:5;14138:14;14131:72;14235:49;14280:2;14269:9;14265:18;14235:49;:::i;:::-;14230:2;14223:5;14219:14;14212:73;14317:49;14362:2;14351:9;14347:18;14317:49;:::i;:::-;14312:2;14305:5;14301:14;14294:73;14400:50;14445:3;14434:9;14430:19;14400:50;:::i;:::-;14394:3;14387:5;14383:15;14376:75;14484:50;14529:3;14518:9;14514:19;14484:50;:::i;:::-;14478:3;14471:5;14467:15;14460:75;14589:3;14578:9;14574:19;14568:26;14562:3;14555:5;14551:15;14544:51;14649:3;14638:9;14634:19;14628:26;14622:3;14615:5;14611:15;14604:51;14674:3;14730:2;14719:9;14715:18;14709:25;14704:2;14697:5;14693:14;14686:49;;14754:3;14789:46;14831:2;14820:9;14816:18;14789:46;:::i;:::-;14773:14;;;14766:70;14855:3;14896:18;;;14890:25;14874:14;;;14867:49;14935:3;14976:18;;;14970:25;14954:14;;;14947:49;;;;-1:-1:-1;14777:5:1;13843:1183;-1:-1:-1;13843:1183:1:o;16187:184::-;16257:6;16310:2;16298:9;16289:7;16285:23;16281:32;16278:52;;;16326:1;16323;16316:12;16278:52;-1:-1:-1;16349:16:1;;16187:184;-1:-1:-1;16187:184:1:o;16678:::-;16730:77;16727:1;16720:88;16827:4;16824:1;16817:15;16851:4;16848:1;16841:15;16867:245;16934:6;16987:2;16975:9;16966:7;16962:23;16958:32;16955:52;;;17003:1;17000;16993:12;16955:52;17035:9;17029:16;17054:28;17076:5;17054:28;:::i;17117:184::-;17169:77;17166:1;17159:88;17266:4;17263:1;17256:15;17290:4;17287:1;17280:15;17306:287;17435:3;17473:6;17467:13;17489:66;17548:6;17543:3;17536:4;17528:6;17524:17;17489:66;:::i;:::-;17571:16;;;;;17306:287;-1:-1:-1;;17306:287: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":"AmountIncorrect","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":"FailedInnerCall","type":"error"},{"inputs":[],"name":"MsgValueIncorrect","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":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":"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":[{"internalType":"bytes32","name":"","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":"bridgeRelays","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"bridgeStatuses","outputs":[{"internalType":"enum FastBridge.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":[],"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":[],"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":"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":"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":"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":{"DISPUTE_PERIOD()":{"notice":"Dispute period for relayed transactions"},"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"},"bridgeProofs(bytes32)":{"notice":"Proof of relayed bridge tx on origin chain"},"bridgeRelays(bytes32)":{"notice":"Whether bridge has been relayed on destination chain"},"bridgeStatuses(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,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"},"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"},"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":{"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"}},"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"}},"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"}},"refund(bytes)":{"params":{"request":"The encoded bridge transaction to refund"}},"relay(bytes)":{"params":{"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":"to prevent replays"}},"version":1},"metadata":"{\"compiler\":{\"version\":\"0.8.20+commit.a1b79de6\"},\"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\":\"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\":\"FailedInnerCall\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MsgValueIncorrect\",\"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\":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\":\"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\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"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\":\"bridgeRelays\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"bridgeStatuses\",\"outputs\":[{\"internalType\":\"enum FastBridge.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\":[],\"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\":[],\"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\":\"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\":\"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\":\"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\":{\"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\"}},\"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\"}},\"refund(bytes)\":{\"params\":{\"request\":\"The encoded bridge transaction to refund\"}},\"relay(bytes)\":{\"params\":{\"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\":\"to prevent replays\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"DISPUTE_PERIOD()\":{\"notice\":\"Dispute period for relayed transactions\"},\"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\"},\"bridgeProofs(bytes32)\":{\"notice\":\"Proof of relayed bridge tx on origin chain\"},\"bridgeRelays(bytes32)\":{\"notice\":\"Whether bridge has been relayed on destination chain\"},\"bridgeStatuses(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,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\"},\"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\"},\"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/FastBridge.sol\":\"FastBridge\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridge.sol\":{\"keccak256\":\"0xae743277f3eb2d2ec8189b107f86be1274c339a5e25efd78e2513a1adfb904cf\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://2adf46956fa5eb58f2073d4a611632ccc208ba24ea99e0a0e224cdce7b79b135\",\"dweb:/ipfs/QmU3RGCG6sstiJ4HUPg5RP7gNds74eBn7YMSCqQfRG8Cpb\"]}},\"version\":1}"},"hashes":{"DEFAULT_ADMIN_ROLE()":"a217fddf","DISPUTE_PERIOD()":"a5bbe22b","FEE_BPS()":"bf333f2c","FEE_RATE_MAX()":"0f5f6ed7","GOVERNOR_ROLE()":"ccc57490","GUARD_ROLE()":"03ed0ee5","MIN_DEADLINE_PERIOD()":"820688d5","REFUNDER_ROLE()":"5960ccf2","REFUND_DELAY()":"190da595","RELAYER_ROLE()":"926d7d7f","bridge((uint32,address,address,address,address,uint256,uint256,bool,uint256))":"45851694","bridgeProofs(bytes32)":"91ad5039","bridgeRelays(bytes32)":"8379a24f","bridgeStatuses(bytes32)":"051287bc","canClaim(bytes32,address)":"aa9641ab","chainGasAmount()":"e00a83e0","claim(bytes,address)":"41fcb612","deployBlock()":"a3ec191a","dispute(bytes32)":"add98c70","getBridgeTransaction(bytes)":"ac11fb1a","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","refund(bytes)":"5eb7d946","relay(bytes)":"8f0d6f17","renounceRole(bytes32,address)":"36568abe","revokeRole(bytes32,address)":"d547741f","setChainGasAmount(uint256)":"b250fe6b","setProtocolFeeRate(uint256)":"b13aa2d6","supportsInterface(bytes4)":"01ffc9a7","sweepProtocolFees(address,address)":"06f333f2"}},"solidity/FastBridge.sol:IAccessControl":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.20 ^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 pure 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/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// 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/FastBridge.sol\n\ncontract FastBridge is IFastBridge, Admin {\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 enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeStatus) public bridgeStatuses;\n /// @notice Proof of relayed bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeProof) public bridgeProofs;\n /// @notice Whether bridge has been relayed on destination chain\n mapping(bytes32 =\u003e bool) public bridgeRelays;\n\n /// @dev to prevent replays\n uint256 public nonce;\n // @dev 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 /// @notice Pulls a requested token from the user to the requested recipient.\n /// @dev Be careful of re-entrancy issues when msg.value \u003e 0 and recipient != address(this)\n function _pullToken(address recipient, address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token != UniversalTokenLib.ETH_ADDRESS) {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(recipient);\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, recipient, amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(recipient) - amountPulled;\n } else {\n // Otherwise, we need to check that ETH amount matches msg.value\n if (amount != msg.value) revert MsgValueIncorrect();\n // Transfer value to recipient if not this address\n if (recipient != address(this)) token.universalTransfer(recipient, amount);\n // We will forward msg.value in the external call later, if recipient is not this contract\n amountPulled = msg.value;\n }\n }\n\n /// @inheritdoc IFastBridge\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n // check bridge params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\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\n // transfer tokens to bridge contract\n // @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(address(this), 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 BridgeTransaction({\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 sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n\n // check haven't exceeded deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n\n // mark bridge transaction as relayed\n if (bridgeRelays[transactionId]) revert TransactionRelayed();\n bridgeRelays[transactionId] = true;\n\n // transfer tokens to recipient on destination chain and gas rebate if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n uint256 rebate = chainGasAmount;\n if (!transaction.sendChainGas) {\n // forward erc20\n rebate = 0;\n _pullToken(to, token, amount);\n } else if (token == UniversalTokenLib.ETH_ADDRESS) {\n // lump in gas rebate into amount in native gas token\n _pullToken(to, token, amount + rebate);\n } else {\n // forward erc20 then forward gas rebate in native gas token\n _pullToken(to, token, amount);\n _pullToken(to, UniversalTokenLib.ETH_ADDRESS, rebate);\n }\n\n emit BridgeRelayed(\n transactionId,\n msg.sender,\n to,\n transaction.originChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n rebate\n );\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n // update bridge tx status given proof provided\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = BridgeStatus.RELAYER_PROVED;\n bridgeProofs[transactionId] = BridgeProof({timestamp: uint96(block.timestamp), relayer: msg.sender}); // overflow ok\n\n emit BridgeProofProvided(transactionId, msg.sender, destTxHash);\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint96(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint96).max but\n /// proof.timestamp \u003c type(uint96).max via unchecked statement\n /// @param proof The bridge proof\n /// @return delta Time delta since proof submitted\n function _timeSince(BridgeProof memory proof) internal view returns (uint256 delta) {\n unchecked {\n delta = uint96(block.timestamp) - proof.timestamp;\n }\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != relayer) revert SenderIncorrect();\n return _timeSince(proof) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != msg.sender) revert SenderIncorrect();\n if (_timeSince(proof) \u003c= DISPUTE_PERIOD) revert DisputePeriodNotPassed();\n\n bridgeStatuses[transactionId] = 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, msg.sender, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeProofs[transactionId]) \u003e DISPUTE_PERIOD) revert DisputePeriodPassed();\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n delete bridgeProofs[transactionId];\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 BridgeTransaction memory transaction = getBridgeTransaction(request);\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 // set status to refunded if still in requested state\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = 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","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","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.20+commit.a1b79de6\"},\"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/FastBridge.sol\":\"IAccessControl\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridge.sol\":{\"keccak256\":\"0xae743277f3eb2d2ec8189b107f86be1274c339a5e25efd78e2513a1adfb904cf\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://2adf46956fa5eb58f2073d4a611632ccc208ba24ea99e0a0e224cdce7b79b135\",\"dweb:/ipfs/QmU3RGCG6sstiJ4HUPg5RP7gNds74eBn7YMSCqQfRG8Cpb\"]}},\"version\":1}"},"hashes":{"getRoleAdmin(bytes32)":"248a9ca3","grantRole(bytes32,address)":"2f2ff15d","hasRole(bytes32,address)":"91d14854","renounceRole(bytes32,address)":"36568abe","revokeRole(bytes32,address)":"d547741f"}},"solidity/FastBridge.sol:IAccessControlEnumerable":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.20 ^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 pure 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/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// 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/FastBridge.sol\n\ncontract FastBridge is IFastBridge, Admin {\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 enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeStatus) public bridgeStatuses;\n /// @notice Proof of relayed bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeProof) public bridgeProofs;\n /// @notice Whether bridge has been relayed on destination chain\n mapping(bytes32 =\u003e bool) public bridgeRelays;\n\n /// @dev to prevent replays\n uint256 public nonce;\n // @dev 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 /// @notice Pulls a requested token from the user to the requested recipient.\n /// @dev Be careful of re-entrancy issues when msg.value \u003e 0 and recipient != address(this)\n function _pullToken(address recipient, address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token != UniversalTokenLib.ETH_ADDRESS) {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(recipient);\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, recipient, amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(recipient) - amountPulled;\n } else {\n // Otherwise, we need to check that ETH amount matches msg.value\n if (amount != msg.value) revert MsgValueIncorrect();\n // Transfer value to recipient if not this address\n if (recipient != address(this)) token.universalTransfer(recipient, amount);\n // We will forward msg.value in the external call later, if recipient is not this contract\n amountPulled = msg.value;\n }\n }\n\n /// @inheritdoc IFastBridge\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n // check bridge params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\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\n // transfer tokens to bridge contract\n // @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(address(this), 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 BridgeTransaction({\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 sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n\n // check haven't exceeded deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n\n // mark bridge transaction as relayed\n if (bridgeRelays[transactionId]) revert TransactionRelayed();\n bridgeRelays[transactionId] = true;\n\n // transfer tokens to recipient on destination chain and gas rebate if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n uint256 rebate = chainGasAmount;\n if (!transaction.sendChainGas) {\n // forward erc20\n rebate = 0;\n _pullToken(to, token, amount);\n } else if (token == UniversalTokenLib.ETH_ADDRESS) {\n // lump in gas rebate into amount in native gas token\n _pullToken(to, token, amount + rebate);\n } else {\n // forward erc20 then forward gas rebate in native gas token\n _pullToken(to, token, amount);\n _pullToken(to, UniversalTokenLib.ETH_ADDRESS, rebate);\n }\n\n emit BridgeRelayed(\n transactionId,\n msg.sender,\n to,\n transaction.originChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n rebate\n );\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n // update bridge tx status given proof provided\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = BridgeStatus.RELAYER_PROVED;\n bridgeProofs[transactionId] = BridgeProof({timestamp: uint96(block.timestamp), relayer: msg.sender}); // overflow ok\n\n emit BridgeProofProvided(transactionId, msg.sender, destTxHash);\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint96(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint96).max but\n /// proof.timestamp \u003c type(uint96).max via unchecked statement\n /// @param proof The bridge proof\n /// @return delta Time delta since proof submitted\n function _timeSince(BridgeProof memory proof) internal view returns (uint256 delta) {\n unchecked {\n delta = uint96(block.timestamp) - proof.timestamp;\n }\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != relayer) revert SenderIncorrect();\n return _timeSince(proof) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != msg.sender) revert SenderIncorrect();\n if (_timeSince(proof) \u003c= DISPUTE_PERIOD) revert DisputePeriodNotPassed();\n\n bridgeStatuses[transactionId] = 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, msg.sender, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeProofs[transactionId]) \u003e DISPUTE_PERIOD) revert DisputePeriodPassed();\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n delete bridgeProofs[transactionId];\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 BridgeTransaction memory transaction = getBridgeTransaction(request);\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 // set status to refunded if still in requested state\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = 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","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","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.20+commit.a1b79de6\"},\"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/FastBridge.sol\":\"IAccessControlEnumerable\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridge.sol\":{\"keccak256\":\"0xae743277f3eb2d2ec8189b107f86be1274c339a5e25efd78e2513a1adfb904cf\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://2adf46956fa5eb58f2073d4a611632ccc208ba24ea99e0a0e224cdce7b79b135\",\"dweb:/ipfs/QmU3RGCG6sstiJ4HUPg5RP7gNds74eBn7YMSCqQfRG8Cpb\"]}},\"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/FastBridge.sol:IAdmin":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.20 ^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 pure 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/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// 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/FastBridge.sol\n\ncontract FastBridge is IFastBridge, Admin {\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 enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeStatus) public bridgeStatuses;\n /// @notice Proof of relayed bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeProof) public bridgeProofs;\n /// @notice Whether bridge has been relayed on destination chain\n mapping(bytes32 =\u003e bool) public bridgeRelays;\n\n /// @dev to prevent replays\n uint256 public nonce;\n // @dev 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 /// @notice Pulls a requested token from the user to the requested recipient.\n /// @dev Be careful of re-entrancy issues when msg.value \u003e 0 and recipient != address(this)\n function _pullToken(address recipient, address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token != UniversalTokenLib.ETH_ADDRESS) {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(recipient);\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, recipient, amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(recipient) - amountPulled;\n } else {\n // Otherwise, we need to check that ETH amount matches msg.value\n if (amount != msg.value) revert MsgValueIncorrect();\n // Transfer value to recipient if not this address\n if (recipient != address(this)) token.universalTransfer(recipient, amount);\n // We will forward msg.value in the external call later, if recipient is not this contract\n amountPulled = msg.value;\n }\n }\n\n /// @inheritdoc IFastBridge\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n // check bridge params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\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\n // transfer tokens to bridge contract\n // @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(address(this), 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 BridgeTransaction({\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 sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n\n // check haven't exceeded deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n\n // mark bridge transaction as relayed\n if (bridgeRelays[transactionId]) revert TransactionRelayed();\n bridgeRelays[transactionId] = true;\n\n // transfer tokens to recipient on destination chain and gas rebate if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n uint256 rebate = chainGasAmount;\n if (!transaction.sendChainGas) {\n // forward erc20\n rebate = 0;\n _pullToken(to, token, amount);\n } else if (token == UniversalTokenLib.ETH_ADDRESS) {\n // lump in gas rebate into amount in native gas token\n _pullToken(to, token, amount + rebate);\n } else {\n // forward erc20 then forward gas rebate in native gas token\n _pullToken(to, token, amount);\n _pullToken(to, UniversalTokenLib.ETH_ADDRESS, rebate);\n }\n\n emit BridgeRelayed(\n transactionId,\n msg.sender,\n to,\n transaction.originChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n rebate\n );\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n // update bridge tx status given proof provided\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = BridgeStatus.RELAYER_PROVED;\n bridgeProofs[transactionId] = BridgeProof({timestamp: uint96(block.timestamp), relayer: msg.sender}); // overflow ok\n\n emit BridgeProofProvided(transactionId, msg.sender, destTxHash);\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint96(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint96).max but\n /// proof.timestamp \u003c type(uint96).max via unchecked statement\n /// @param proof The bridge proof\n /// @return delta Time delta since proof submitted\n function _timeSince(BridgeProof memory proof) internal view returns (uint256 delta) {\n unchecked {\n delta = uint96(block.timestamp) - proof.timestamp;\n }\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != relayer) revert SenderIncorrect();\n return _timeSince(proof) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != msg.sender) revert SenderIncorrect();\n if (_timeSince(proof) \u003c= DISPUTE_PERIOD) revert DisputePeriodNotPassed();\n\n bridgeStatuses[transactionId] = 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, msg.sender, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeProofs[transactionId]) \u003e DISPUTE_PERIOD) revert DisputePeriodPassed();\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n delete bridgeProofs[transactionId];\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 BridgeTransaction memory transaction = getBridgeTransaction(request);\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 // set status to refunded if still in requested state\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = 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","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","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.20+commit.a1b79de6\"},\"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/FastBridge.sol\":\"IAdmin\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridge.sol\":{\"keccak256\":\"0xae743277f3eb2d2ec8189b107f86be1274c339a5e25efd78e2513a1adfb904cf\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://2adf46956fa5eb58f2073d4a611632ccc208ba24ea99e0a0e224cdce7b79b135\",\"dweb:/ipfs/QmU3RGCG6sstiJ4HUPg5RP7gNds74eBn7YMSCqQfRG8Cpb\"]}},\"version\":1}"},"hashes":{"setChainGasAmount(uint256)":"b250fe6b","setProtocolFeeRate(uint256)":"b13aa2d6","sweepProtocolFees(address,address)":"06f333f2"}},"solidity/FastBridge.sol:IERC165":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.20 ^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 pure 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/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// 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/FastBridge.sol\n\ncontract FastBridge is IFastBridge, Admin {\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 enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeStatus) public bridgeStatuses;\n /// @notice Proof of relayed bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeProof) public bridgeProofs;\n /// @notice Whether bridge has been relayed on destination chain\n mapping(bytes32 =\u003e bool) public bridgeRelays;\n\n /// @dev to prevent replays\n uint256 public nonce;\n // @dev 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 /// @notice Pulls a requested token from the user to the requested recipient.\n /// @dev Be careful of re-entrancy issues when msg.value \u003e 0 and recipient != address(this)\n function _pullToken(address recipient, address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token != UniversalTokenLib.ETH_ADDRESS) {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(recipient);\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, recipient, amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(recipient) - amountPulled;\n } else {\n // Otherwise, we need to check that ETH amount matches msg.value\n if (amount != msg.value) revert MsgValueIncorrect();\n // Transfer value to recipient if not this address\n if (recipient != address(this)) token.universalTransfer(recipient, amount);\n // We will forward msg.value in the external call later, if recipient is not this contract\n amountPulled = msg.value;\n }\n }\n\n /// @inheritdoc IFastBridge\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n // check bridge params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\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\n // transfer tokens to bridge contract\n // @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(address(this), 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 BridgeTransaction({\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 sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n\n // check haven't exceeded deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n\n // mark bridge transaction as relayed\n if (bridgeRelays[transactionId]) revert TransactionRelayed();\n bridgeRelays[transactionId] = true;\n\n // transfer tokens to recipient on destination chain and gas rebate if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n uint256 rebate = chainGasAmount;\n if (!transaction.sendChainGas) {\n // forward erc20\n rebate = 0;\n _pullToken(to, token, amount);\n } else if (token == UniversalTokenLib.ETH_ADDRESS) {\n // lump in gas rebate into amount in native gas token\n _pullToken(to, token, amount + rebate);\n } else {\n // forward erc20 then forward gas rebate in native gas token\n _pullToken(to, token, amount);\n _pullToken(to, UniversalTokenLib.ETH_ADDRESS, rebate);\n }\n\n emit BridgeRelayed(\n transactionId,\n msg.sender,\n to,\n transaction.originChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n rebate\n );\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n // update bridge tx status given proof provided\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = BridgeStatus.RELAYER_PROVED;\n bridgeProofs[transactionId] = BridgeProof({timestamp: uint96(block.timestamp), relayer: msg.sender}); // overflow ok\n\n emit BridgeProofProvided(transactionId, msg.sender, destTxHash);\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint96(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint96).max but\n /// proof.timestamp \u003c type(uint96).max via unchecked statement\n /// @param proof The bridge proof\n /// @return delta Time delta since proof submitted\n function _timeSince(BridgeProof memory proof) internal view returns (uint256 delta) {\n unchecked {\n delta = uint96(block.timestamp) - proof.timestamp;\n }\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != relayer) revert SenderIncorrect();\n return _timeSince(proof) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != msg.sender) revert SenderIncorrect();\n if (_timeSince(proof) \u003c= DISPUTE_PERIOD) revert DisputePeriodNotPassed();\n\n bridgeStatuses[transactionId] = 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, msg.sender, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeProofs[transactionId]) \u003e DISPUTE_PERIOD) revert DisputePeriodPassed();\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n delete bridgeProofs[transactionId];\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 BridgeTransaction memory transaction = getBridgeTransaction(request);\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 // set status to refunded if still in requested state\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = 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","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","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.20+commit.a1b79de6\"},\"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/FastBridge.sol\":\"IERC165\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridge.sol\":{\"keccak256\":\"0xae743277f3eb2d2ec8189b107f86be1274c339a5e25efd78e2513a1adfb904cf\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://2adf46956fa5eb58f2073d4a611632ccc208ba24ea99e0a0e224cdce7b79b135\",\"dweb:/ipfs/QmU3RGCG6sstiJ4HUPg5RP7gNds74eBn7YMSCqQfRG8Cpb\"]}},\"version\":1}"},"hashes":{"supportsInterface(bytes4)":"01ffc9a7"}},"solidity/FastBridge.sol:IERC20":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.20 ^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 pure 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/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// 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/FastBridge.sol\n\ncontract FastBridge is IFastBridge, Admin {\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 enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeStatus) public bridgeStatuses;\n /// @notice Proof of relayed bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeProof) public bridgeProofs;\n /// @notice Whether bridge has been relayed on destination chain\n mapping(bytes32 =\u003e bool) public bridgeRelays;\n\n /// @dev to prevent replays\n uint256 public nonce;\n // @dev 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 /// @notice Pulls a requested token from the user to the requested recipient.\n /// @dev Be careful of re-entrancy issues when msg.value \u003e 0 and recipient != address(this)\n function _pullToken(address recipient, address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token != UniversalTokenLib.ETH_ADDRESS) {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(recipient);\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, recipient, amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(recipient) - amountPulled;\n } else {\n // Otherwise, we need to check that ETH amount matches msg.value\n if (amount != msg.value) revert MsgValueIncorrect();\n // Transfer value to recipient if not this address\n if (recipient != address(this)) token.universalTransfer(recipient, amount);\n // We will forward msg.value in the external call later, if recipient is not this contract\n amountPulled = msg.value;\n }\n }\n\n /// @inheritdoc IFastBridge\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n // check bridge params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\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\n // transfer tokens to bridge contract\n // @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(address(this), 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 BridgeTransaction({\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 sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n\n // check haven't exceeded deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n\n // mark bridge transaction as relayed\n if (bridgeRelays[transactionId]) revert TransactionRelayed();\n bridgeRelays[transactionId] = true;\n\n // transfer tokens to recipient on destination chain and gas rebate if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n uint256 rebate = chainGasAmount;\n if (!transaction.sendChainGas) {\n // forward erc20\n rebate = 0;\n _pullToken(to, token, amount);\n } else if (token == UniversalTokenLib.ETH_ADDRESS) {\n // lump in gas rebate into amount in native gas token\n _pullToken(to, token, amount + rebate);\n } else {\n // forward erc20 then forward gas rebate in native gas token\n _pullToken(to, token, amount);\n _pullToken(to, UniversalTokenLib.ETH_ADDRESS, rebate);\n }\n\n emit BridgeRelayed(\n transactionId,\n msg.sender,\n to,\n transaction.originChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n rebate\n );\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n // update bridge tx status given proof provided\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = BridgeStatus.RELAYER_PROVED;\n bridgeProofs[transactionId] = BridgeProof({timestamp: uint96(block.timestamp), relayer: msg.sender}); // overflow ok\n\n emit BridgeProofProvided(transactionId, msg.sender, destTxHash);\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint96(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint96).max but\n /// proof.timestamp \u003c type(uint96).max via unchecked statement\n /// @param proof The bridge proof\n /// @return delta Time delta since proof submitted\n function _timeSince(BridgeProof memory proof) internal view returns (uint256 delta) {\n unchecked {\n delta = uint96(block.timestamp) - proof.timestamp;\n }\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != relayer) revert SenderIncorrect();\n return _timeSince(proof) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != msg.sender) revert SenderIncorrect();\n if (_timeSince(proof) \u003c= DISPUTE_PERIOD) revert DisputePeriodNotPassed();\n\n bridgeStatuses[transactionId] = 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, msg.sender, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeProofs[transactionId]) \u003e DISPUTE_PERIOD) revert DisputePeriodPassed();\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n delete bridgeProofs[transactionId];\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 BridgeTransaction memory transaction = getBridgeTransaction(request);\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 // set status to refunded if still in requested state\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = 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","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","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.20+commit.a1b79de6\"},\"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/FastBridge.sol\":\"IERC20\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridge.sol\":{\"keccak256\":\"0xae743277f3eb2d2ec8189b107f86be1274c339a5e25efd78e2513a1adfb904cf\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://2adf46956fa5eb58f2073d4a611632ccc208ba24ea99e0a0e224cdce7b79b135\",\"dweb:/ipfs/QmU3RGCG6sstiJ4HUPg5RP7gNds74eBn7YMSCqQfRG8Cpb\"]}},\"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/FastBridge.sol:IERC20Permit":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.20 ^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 pure 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/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// 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/FastBridge.sol\n\ncontract FastBridge is IFastBridge, Admin {\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 enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeStatus) public bridgeStatuses;\n /// @notice Proof of relayed bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeProof) public bridgeProofs;\n /// @notice Whether bridge has been relayed on destination chain\n mapping(bytes32 =\u003e bool) public bridgeRelays;\n\n /// @dev to prevent replays\n uint256 public nonce;\n // @dev 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 /// @notice Pulls a requested token from the user to the requested recipient.\n /// @dev Be careful of re-entrancy issues when msg.value \u003e 0 and recipient != address(this)\n function _pullToken(address recipient, address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token != UniversalTokenLib.ETH_ADDRESS) {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(recipient);\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, recipient, amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(recipient) - amountPulled;\n } else {\n // Otherwise, we need to check that ETH amount matches msg.value\n if (amount != msg.value) revert MsgValueIncorrect();\n // Transfer value to recipient if not this address\n if (recipient != address(this)) token.universalTransfer(recipient, amount);\n // We will forward msg.value in the external call later, if recipient is not this contract\n amountPulled = msg.value;\n }\n }\n\n /// @inheritdoc IFastBridge\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n // check bridge params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\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\n // transfer tokens to bridge contract\n // @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(address(this), 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 BridgeTransaction({\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 sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n\n // check haven't exceeded deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n\n // mark bridge transaction as relayed\n if (bridgeRelays[transactionId]) revert TransactionRelayed();\n bridgeRelays[transactionId] = true;\n\n // transfer tokens to recipient on destination chain and gas rebate if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n uint256 rebate = chainGasAmount;\n if (!transaction.sendChainGas) {\n // forward erc20\n rebate = 0;\n _pullToken(to, token, amount);\n } else if (token == UniversalTokenLib.ETH_ADDRESS) {\n // lump in gas rebate into amount in native gas token\n _pullToken(to, token, amount + rebate);\n } else {\n // forward erc20 then forward gas rebate in native gas token\n _pullToken(to, token, amount);\n _pullToken(to, UniversalTokenLib.ETH_ADDRESS, rebate);\n }\n\n emit BridgeRelayed(\n transactionId,\n msg.sender,\n to,\n transaction.originChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n rebate\n );\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n // update bridge tx status given proof provided\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = BridgeStatus.RELAYER_PROVED;\n bridgeProofs[transactionId] = BridgeProof({timestamp: uint96(block.timestamp), relayer: msg.sender}); // overflow ok\n\n emit BridgeProofProvided(transactionId, msg.sender, destTxHash);\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint96(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint96).max but\n /// proof.timestamp \u003c type(uint96).max via unchecked statement\n /// @param proof The bridge proof\n /// @return delta Time delta since proof submitted\n function _timeSince(BridgeProof memory proof) internal view returns (uint256 delta) {\n unchecked {\n delta = uint96(block.timestamp) - proof.timestamp;\n }\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != relayer) revert SenderIncorrect();\n return _timeSince(proof) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != msg.sender) revert SenderIncorrect();\n if (_timeSince(proof) \u003c= DISPUTE_PERIOD) revert DisputePeriodNotPassed();\n\n bridgeStatuses[transactionId] = 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, msg.sender, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeProofs[transactionId]) \u003e DISPUTE_PERIOD) revert DisputePeriodPassed();\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n delete bridgeProofs[transactionId];\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 BridgeTransaction memory transaction = getBridgeTransaction(request);\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 // set status to refunded if still in requested state\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = 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","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","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.20+commit.a1b79de6\"},\"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/FastBridge.sol\":\"IERC20Permit\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridge.sol\":{\"keccak256\":\"0xae743277f3eb2d2ec8189b107f86be1274c339a5e25efd78e2513a1adfb904cf\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://2adf46956fa5eb58f2073d4a611632ccc208ba24ea99e0a0e224cdce7b79b135\",\"dweb:/ipfs/QmU3RGCG6sstiJ4HUPg5RP7gNds74eBn7YMSCqQfRG8Cpb\"]}},\"version\":1}"},"hashes":{"DOMAIN_SEPARATOR()":"3644e515","nonces(address)":"7ecebe00","permit(address,address,uint256,uint256,uint8,bytes32,bytes32)":"d505accf"}},"solidity/FastBridge.sol:IFastBridge":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.20 ^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 pure 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/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// 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/FastBridge.sol\n\ncontract FastBridge is IFastBridge, Admin {\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 enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeStatus) public bridgeStatuses;\n /// @notice Proof of relayed bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeProof) public bridgeProofs;\n /// @notice Whether bridge has been relayed on destination chain\n mapping(bytes32 =\u003e bool) public bridgeRelays;\n\n /// @dev to prevent replays\n uint256 public nonce;\n // @dev 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 /// @notice Pulls a requested token from the user to the requested recipient.\n /// @dev Be careful of re-entrancy issues when msg.value \u003e 0 and recipient != address(this)\n function _pullToken(address recipient, address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token != UniversalTokenLib.ETH_ADDRESS) {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(recipient);\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, recipient, amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(recipient) - amountPulled;\n } else {\n // Otherwise, we need to check that ETH amount matches msg.value\n if (amount != msg.value) revert MsgValueIncorrect();\n // Transfer value to recipient if not this address\n if (recipient != address(this)) token.universalTransfer(recipient, amount);\n // We will forward msg.value in the external call later, if recipient is not this contract\n amountPulled = msg.value;\n }\n }\n\n /// @inheritdoc IFastBridge\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n // check bridge params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\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\n // transfer tokens to bridge contract\n // @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(address(this), 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 BridgeTransaction({\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 sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n\n // check haven't exceeded deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n\n // mark bridge transaction as relayed\n if (bridgeRelays[transactionId]) revert TransactionRelayed();\n bridgeRelays[transactionId] = true;\n\n // transfer tokens to recipient on destination chain and gas rebate if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n uint256 rebate = chainGasAmount;\n if (!transaction.sendChainGas) {\n // forward erc20\n rebate = 0;\n _pullToken(to, token, amount);\n } else if (token == UniversalTokenLib.ETH_ADDRESS) {\n // lump in gas rebate into amount in native gas token\n _pullToken(to, token, amount + rebate);\n } else {\n // forward erc20 then forward gas rebate in native gas token\n _pullToken(to, token, amount);\n _pullToken(to, UniversalTokenLib.ETH_ADDRESS, rebate);\n }\n\n emit BridgeRelayed(\n transactionId,\n msg.sender,\n to,\n transaction.originChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n rebate\n );\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n // update bridge tx status given proof provided\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = BridgeStatus.RELAYER_PROVED;\n bridgeProofs[transactionId] = BridgeProof({timestamp: uint96(block.timestamp), relayer: msg.sender}); // overflow ok\n\n emit BridgeProofProvided(transactionId, msg.sender, destTxHash);\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint96(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint96).max but\n /// proof.timestamp \u003c type(uint96).max via unchecked statement\n /// @param proof The bridge proof\n /// @return delta Time delta since proof submitted\n function _timeSince(BridgeProof memory proof) internal view returns (uint256 delta) {\n unchecked {\n delta = uint96(block.timestamp) - proof.timestamp;\n }\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != relayer) revert SenderIncorrect();\n return _timeSince(proof) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != msg.sender) revert SenderIncorrect();\n if (_timeSince(proof) \u003c= DISPUTE_PERIOD) revert DisputePeriodNotPassed();\n\n bridgeStatuses[transactionId] = 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, msg.sender, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeProofs[transactionId]) \u003e DISPUTE_PERIOD) revert DisputePeriodPassed();\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n delete bridgeProofs[transactionId];\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 BridgeTransaction memory transaction = getBridgeTransaction(request);\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 // set status to refunded if still in requested state\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = 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","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","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":"pure","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.20+commit.a1b79de6\"},\"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\":\"pure\",\"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/FastBridge.sol\":\"IFastBridge\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridge.sol\":{\"keccak256\":\"0xae743277f3eb2d2ec8189b107f86be1274c339a5e25efd78e2513a1adfb904cf\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://2adf46956fa5eb58f2073d4a611632ccc208ba24ea99e0a0e224cdce7b79b135\",\"dweb:/ipfs/QmU3RGCG6sstiJ4HUPg5RP7gNds74eBn7YMSCqQfRG8Cpb\"]}},\"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/FastBridge.sol:SafeERC20":{"code":"0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220666e86cec9574f32fc5a03b62558b15e14d370d438ddcd50d491395202b88bd664736f6c63430008140033","runtime-code":"0x73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220666e86cec9574f32fc5a03b62558b15e14d370d438ddcd50d491395202b88bd664736f6c63430008140033","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.20 ^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 pure 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/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// 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/FastBridge.sol\n\ncontract FastBridge is IFastBridge, Admin {\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 enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeStatus) public bridgeStatuses;\n /// @notice Proof of relayed bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeProof) public bridgeProofs;\n /// @notice Whether bridge has been relayed on destination chain\n mapping(bytes32 =\u003e bool) public bridgeRelays;\n\n /// @dev to prevent replays\n uint256 public nonce;\n // @dev 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 /// @notice Pulls a requested token from the user to the requested recipient.\n /// @dev Be careful of re-entrancy issues when msg.value \u003e 0 and recipient != address(this)\n function _pullToken(address recipient, address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token != UniversalTokenLib.ETH_ADDRESS) {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(recipient);\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, recipient, amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(recipient) - amountPulled;\n } else {\n // Otherwise, we need to check that ETH amount matches msg.value\n if (amount != msg.value) revert MsgValueIncorrect();\n // Transfer value to recipient if not this address\n if (recipient != address(this)) token.universalTransfer(recipient, amount);\n // We will forward msg.value in the external call later, if recipient is not this contract\n amountPulled = msg.value;\n }\n }\n\n /// @inheritdoc IFastBridge\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n // check bridge params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\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\n // transfer tokens to bridge contract\n // @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(address(this), 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 BridgeTransaction({\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 sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n\n // check haven't exceeded deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n\n // mark bridge transaction as relayed\n if (bridgeRelays[transactionId]) revert TransactionRelayed();\n bridgeRelays[transactionId] = true;\n\n // transfer tokens to recipient on destination chain and gas rebate if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n uint256 rebate = chainGasAmount;\n if (!transaction.sendChainGas) {\n // forward erc20\n rebate = 0;\n _pullToken(to, token, amount);\n } else if (token == UniversalTokenLib.ETH_ADDRESS) {\n // lump in gas rebate into amount in native gas token\n _pullToken(to, token, amount + rebate);\n } else {\n // forward erc20 then forward gas rebate in native gas token\n _pullToken(to, token, amount);\n _pullToken(to, UniversalTokenLib.ETH_ADDRESS, rebate);\n }\n\n emit BridgeRelayed(\n transactionId,\n msg.sender,\n to,\n transaction.originChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n rebate\n );\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n // update bridge tx status given proof provided\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = BridgeStatus.RELAYER_PROVED;\n bridgeProofs[transactionId] = BridgeProof({timestamp: uint96(block.timestamp), relayer: msg.sender}); // overflow ok\n\n emit BridgeProofProvided(transactionId, msg.sender, destTxHash);\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint96(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint96).max but\n /// proof.timestamp \u003c type(uint96).max via unchecked statement\n /// @param proof The bridge proof\n /// @return delta Time delta since proof submitted\n function _timeSince(BridgeProof memory proof) internal view returns (uint256 delta) {\n unchecked {\n delta = uint96(block.timestamp) - proof.timestamp;\n }\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != relayer) revert SenderIncorrect();\n return _timeSince(proof) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != msg.sender) revert SenderIncorrect();\n if (_timeSince(proof) \u003c= DISPUTE_PERIOD) revert DisputePeriodNotPassed();\n\n bridgeStatuses[transactionId] = 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, msg.sender, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeProofs[transactionId]) \u003e DISPUTE_PERIOD) revert DisputePeriodPassed();\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n delete bridgeProofs[transactionId];\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 BridgeTransaction memory transaction = getBridgeTransaction(request);\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 // set status to refunded if still in requested state\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = 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","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","compilerOptions":"--combined-json bin,bin-runtime,srcmap,srcmap-runtime,abi,userdoc,devdoc,metadata,hashes --optimize --optimize-runs 10000 --allow-paths ., ./, ../ --evm-version=istanbul","srcMap":"39257:5018:0:-:0;;;;;;;;;;;;;;;-1:-1:-1;;;39257:5018:0;;;;;;;;;;;;;;;;;","srcMapRuntime":"39257: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.20+commit.a1b79de6\"},\"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/FastBridge.sol\":\"SafeERC20\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridge.sol\":{\"keccak256\":\"0xae743277f3eb2d2ec8189b107f86be1274c339a5e25efd78e2513a1adfb904cf\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://2adf46956fa5eb58f2073d4a611632ccc208ba24ea99e0a0e224cdce7b79b135\",\"dweb:/ipfs/QmU3RGCG6sstiJ4HUPg5RP7gNds74eBn7YMSCqQfRG8Cpb\"]}},\"version\":1}"},"hashes":{}},"solidity/FastBridge.sol:UniversalTokenLib":{"code":"0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220e4e2d25d1ecf953d0c56b6c7466118f3a795674cafbd14e67cc1d0633ea190a764736f6c63430008140033","runtime-code":"0x73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220e4e2d25d1ecf953d0c56b6c7466118f3a795674cafbd14e67cc1d0633ea190a764736f6c63430008140033","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.20 ^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 pure 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/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// 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/FastBridge.sol\n\ncontract FastBridge is IFastBridge, Admin {\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 enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeStatus) public bridgeStatuses;\n /// @notice Proof of relayed bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeProof) public bridgeProofs;\n /// @notice Whether bridge has been relayed on destination chain\n mapping(bytes32 =\u003e bool) public bridgeRelays;\n\n /// @dev to prevent replays\n uint256 public nonce;\n // @dev 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 /// @notice Pulls a requested token from the user to the requested recipient.\n /// @dev Be careful of re-entrancy issues when msg.value \u003e 0 and recipient != address(this)\n function _pullToken(address recipient, address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token != UniversalTokenLib.ETH_ADDRESS) {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(recipient);\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, recipient, amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(recipient) - amountPulled;\n } else {\n // Otherwise, we need to check that ETH amount matches msg.value\n if (amount != msg.value) revert MsgValueIncorrect();\n // Transfer value to recipient if not this address\n if (recipient != address(this)) token.universalTransfer(recipient, amount);\n // We will forward msg.value in the external call later, if recipient is not this contract\n amountPulled = msg.value;\n }\n }\n\n /// @inheritdoc IFastBridge\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n // check bridge params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\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\n // transfer tokens to bridge contract\n // @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(address(this), 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 BridgeTransaction({\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 sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n\n // check haven't exceeded deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n\n // mark bridge transaction as relayed\n if (bridgeRelays[transactionId]) revert TransactionRelayed();\n bridgeRelays[transactionId] = true;\n\n // transfer tokens to recipient on destination chain and gas rebate if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n uint256 rebate = chainGasAmount;\n if (!transaction.sendChainGas) {\n // forward erc20\n rebate = 0;\n _pullToken(to, token, amount);\n } else if (token == UniversalTokenLib.ETH_ADDRESS) {\n // lump in gas rebate into amount in native gas token\n _pullToken(to, token, amount + rebate);\n } else {\n // forward erc20 then forward gas rebate in native gas token\n _pullToken(to, token, amount);\n _pullToken(to, UniversalTokenLib.ETH_ADDRESS, rebate);\n }\n\n emit BridgeRelayed(\n transactionId,\n msg.sender,\n to,\n transaction.originChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n rebate\n );\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n // update bridge tx status given proof provided\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = BridgeStatus.RELAYER_PROVED;\n bridgeProofs[transactionId] = BridgeProof({timestamp: uint96(block.timestamp), relayer: msg.sender}); // overflow ok\n\n emit BridgeProofProvided(transactionId, msg.sender, destTxHash);\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint96(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint96).max but\n /// proof.timestamp \u003c type(uint96).max via unchecked statement\n /// @param proof The bridge proof\n /// @return delta Time delta since proof submitted\n function _timeSince(BridgeProof memory proof) internal view returns (uint256 delta) {\n unchecked {\n delta = uint96(block.timestamp) - proof.timestamp;\n }\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != relayer) revert SenderIncorrect();\n return _timeSince(proof) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != msg.sender) revert SenderIncorrect();\n if (_timeSince(proof) \u003c= DISPUTE_PERIOD) revert DisputePeriodNotPassed();\n\n bridgeStatuses[transactionId] = 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, msg.sender, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeProofs[transactionId]) \u003e DISPUTE_PERIOD) revert DisputePeriodPassed();\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n delete bridgeProofs[transactionId];\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 BridgeTransaction memory transaction = getBridgeTransaction(request);\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 // set status to refunded if still in requested state\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = 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","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","compilerOptions":"--combined-json bin,bin-runtime,srcmap,srcmap-runtime,abi,userdoc,devdoc,metadata,hashes --optimize --optimize-runs 10000 --allow-paths ., ./, ../ --evm-version=istanbul","srcMap":"51216:2551:0:-:0;;;;;;;;;;;;;;;-1:-1:-1;;;51216:2551:0;;;;;;;;;;;;;;;;;","srcMapRuntime":"51216:2551:0:-:0;;;;;;;;","abiDefinition":[],"userDoc":{"kind":"user","methods":{},"version":1},"developerDoc":{"kind":"dev","methods":{},"version":1},"metadata":"{\"compiler\":{\"version\":\"0.8.20+commit.a1b79de6\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/FastBridge.sol\":\"UniversalTokenLib\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridge.sol\":{\"keccak256\":\"0xae743277f3eb2d2ec8189b107f86be1274c339a5e25efd78e2513a1adfb904cf\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://2adf46956fa5eb58f2073d4a611632ccc208ba24ea99e0a0e224cdce7b79b135\",\"dweb:/ipfs/QmU3RGCG6sstiJ4HUPg5RP7gNds74eBn7YMSCqQfRG8Cpb\"]}},\"version\":1}"},"hashes":{}}} \ No newline at end of file diff --git a/services/rfq/contracts/testcontracts/fastbridgemock/fastbridgemock.abigen.go b/services/rfq/contracts/testcontracts/fastbridgemock/fastbridgemock.abigen.go index bd92907a76..97090041a8 100644 --- a/services/rfq/contracts/testcontracts/fastbridgemock/fastbridgemock.abigen.go +++ b/services/rfq/contracts/testcontracts/fastbridgemock/fastbridgemock.abigen.go @@ -1799,7 +1799,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: "0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea264697066735822122069309b4b154b9a5a3f92efe9269fb006052caf08cd8c5c5c6db55daf70b3227964736f6c63430008140033", + Bin: "0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220e1828b68e29fbb3dc84ef6cf93a098d0b733b59ccc6648eaafcd08a35aa7518a64736f6c63430008140033", } // AddressABI is the input ABI used to generate the binding from. @@ -1995,7 +1995,7 @@ var AdminMetaData = &bind.MetaData{ "01ffc9a7": "supportsInterface(bytes4)", "06f333f2": "sweepProtocolFees(address,address)", }, - Bin: "0x60806040523480156200001157600080fd5b50604051620014123803806200141283398101604081905262000034916200018e565b6200004160008262000049565b5050620001b9565b60008062000058848462000086565b905080156200007d5760008481526001602052604090206200007b908462000134565b505b90505b92915050565b6000828152602081815260408083206001600160a01b038516845290915281205460ff166200012b576000838152602081815260408083206001600160a01b03861684529091529020805460ff19166001179055620000e23390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a450600162000080565b50600062000080565b60006200007d836001600160a01b03841660008181526001830160205260408120546200012b5750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915562000080565b600060208284031215620001a157600080fd5b81516001600160a01b03811681146200007d57600080fd5b61124980620001c96000396000f3fe608060405234801561001057600080fd5b50600436106101775760003560e01c806391d14854116100d8578063bf333f2c1161008c578063d547741f11610066578063d547741f14610385578063dcf844a714610398578063e00a83e0146103b857600080fd5b8063bf333f2c14610341578063ca15c8731461034b578063ccc574901461035e57600080fd5b8063a217fddf116100bd578063a217fddf14610313578063b13aa2d61461031b578063b250fe6b1461032e57600080fd5b806391d14854146102a8578063926d7d7f146102ec57600080fd5b80632f2ff15d1161012f57806358f858801161011457806358f85880146102405780635960ccf2146102495780639010d07c1461027057600080fd5b80632f2ff15d1461021a57806336568abe1461022d57600080fd5b806306f333f21161016057806306f333f2146101d95780630f5f6ed7146101ee578063248a9ca3146101f757600080fd5b806301ffc9a71461017c57806303ed0ee5146101a4575b600080fd5b61018f61018a366004611013565b6103c1565b60405190151581526020015b60405180910390f35b6101cb7f043c983c49d46f0e102151eaf8085d4a2e6571d5df2d47b013f39bddfd4a639d81565b60405190815260200161019b565b6101ec6101e736600461107e565b61041d565b005b6101cb61271081565b6101cb6102053660046110b1565b60009081526020819052604090206001015490565b6101ec6102283660046110ca565b61050b565b6101ec61023b3660046110ca565b610536565b6101cb60025481565b6101cb7fdb9556138406326f00296e13ea2ad7db24ba82381212d816b1a40c23b466b32781565b61028361027e3660046110ed565b61058f565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161019b565b61018f6102b63660046110ca565b60009182526020828152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b6101cb7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc481565b6101cb600081565b6101ec6103293660046110b1565b6105ae565b6101ec61033c3660046110b1565b610690565b6101cb620f424081565b6101cb6103593660046110b1565b6106f8565b6101cb7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5581565b6101ec6103933660046110ca565b61070f565b6101cb6103a636600461110f565b60036020526000908152604090205481565b6101cb60045481565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f5a05180f000000000000000000000000000000000000000000000000000000001480610417575061041782610734565b92915050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f55610447816107cb565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600360205260408120549081900361047b5750505050565b73ffffffffffffffffffffffffffffffffffffffff84166000818152600360205260408120556104ac9084836107d8565b6040805173ffffffffffffffffffffffffffffffffffffffff8087168252851660208201529081018290527f244e51bc38c1452fa8aaf487bcb4bca36c2baa3a5fbdb776b1eabd8dc6d277cd9060600160405180910390a1505b505050565b600082815260208190526040902060010154610526816107cb565b610530838361092f565b50505050565b73ffffffffffffffffffffffffffffffffffffffff81163314610585576040517f6697b23200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6105068282610964565b60008281526001602052604081206105a79083610991565b9392505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f556105d8816107cb565b612710821115610649576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f6e657746656552617465203e206d61780000000000000000000000000000000060448201526064015b60405180910390fd5b600280549083905560408051828152602081018590527f14914da2bf76024616fbe1859783fcd4dbddcb179b1f3a854949fbf920dcb95791015b60405180910390a1505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f556106ba816107cb565b600480549083905560408051828152602081018590527f5cf09b12f3f56b4c564d51b25b40360af6d795198adb61ae0806a36c294323fa9101610683565b60008181526001602052604081206104179061099d565b60008281526020819052604090206001015461072a816107cb565b6105308383610964565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061041757507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614610417565b6107d581336109a7565b50565b3073ffffffffffffffffffffffffffffffffffffffff8316036107fa57505050565b8060000361080757505050565b7fffffffffffffffffffffffff111111111111111111111111111111111111111273ffffffffffffffffffffffffffffffffffffffff84160161090e5760008273ffffffffffffffffffffffffffffffffffffffff168260405160006040518083038185875af1925050503d806000811461089e576040519150601f19603f3d011682016040523d82523d6000602084013e6108a3565b606091505b5050905080610530576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f455448207472616e73666572206661696c6564000000000000000000000000006044820152606401610640565b61050673ffffffffffffffffffffffffffffffffffffffff84168383610a31565b60008061093c8484610abe565b905080156105a757600084815260016020526040902061095c9084610bba565b509392505050565b6000806109718484610bdc565b905080156105a757600084815260016020526040902061095c9084610c97565b60006105a78383610cb9565b6000610417825490565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16610a2d576040517fe2517d3f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8216600482015260248101839052604401610640565b5050565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000179052610506908490610ce3565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915281205460ff16610bb25760008381526020818152604080832073ffffffffffffffffffffffffffffffffffffffff86168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055610b503390565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a4506001610417565b506000610417565b60006105a78373ffffffffffffffffffffffffffffffffffffffff8416610d79565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915281205460ff1615610bb25760008381526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8616808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a4506001610417565b60006105a78373ffffffffffffffffffffffffffffffffffffffff8416610dc0565b6000826000018281548110610cd057610cd061112a565b9060005260206000200154905092915050565b6000610d0573ffffffffffffffffffffffffffffffffffffffff841683610eb3565b90508051600014158015610d2a575080806020019051810190610d289190611159565b155b15610506576040517f5274afe700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84166004820152602401610640565b6000818152600183016020526040812054610bb257508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610417565b60008181526001830160205260408120548015610ea9576000610de460018361117b565b8554909150600090610df89060019061117b565b9050808214610e5d576000866000018281548110610e1857610e1861112a565b9060005260206000200154905080876000018481548110610e3b57610e3b61112a565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080610e6e57610e6e6111b5565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610417565b6000915050610417565b60606105a783836000846000808573ffffffffffffffffffffffffffffffffffffffff168486604051610ee691906111e4565b60006040518083038185875af1925050503d8060008114610f23576040519150601f19603f3d011682016040523d82523d6000602084013e610f28565b606091505b5091509150610f38868383610f42565b9695505050505050565b606082610f5757610f5282610fd1565b6105a7565b8151158015610f7b575073ffffffffffffffffffffffffffffffffffffffff84163b155b15610fca576040517f9996b31500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85166004820152602401610640565b50806105a7565b805115610fe15780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006020828403121561102557600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146105a757600080fd5b803573ffffffffffffffffffffffffffffffffffffffff8116811461107957600080fd5b919050565b6000806040838503121561109157600080fd5b61109a83611055565b91506110a860208401611055565b90509250929050565b6000602082840312156110c357600080fd5b5035919050565b600080604083850312156110dd57600080fd5b823591506110a860208401611055565b6000806040838503121561110057600080fd5b50508035926020909101359150565b60006020828403121561112157600080fd5b6105a782611055565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006020828403121561116b57600080fd5b815180151581146105a757600080fd5b81810381811115610417577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b6000825160005b8181101561120557602081860181015185830152016111eb565b50600092019182525091905056fea26469706673582212201dd993fc5abfac80cc090826421c56b0e7f52ac1e663c8aeeb7526f35e1246c464736f6c63430008140033", + Bin: "0x60806040523480156200001157600080fd5b50604051620014123803806200141283398101604081905262000034916200018e565b6200004160008262000049565b5050620001b9565b60008062000058848462000086565b905080156200007d5760008481526001602052604090206200007b908462000134565b505b90505b92915050565b6000828152602081815260408083206001600160a01b038516845290915281205460ff166200012b576000838152602081815260408083206001600160a01b03861684529091529020805460ff19166001179055620000e23390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a450600162000080565b50600062000080565b60006200007d836001600160a01b03841660008181526001830160205260408120546200012b5750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915562000080565b600060208284031215620001a157600080fd5b81516001600160a01b03811681146200007d57600080fd5b61124980620001c96000396000f3fe608060405234801561001057600080fd5b50600436106101775760003560e01c806391d14854116100d8578063bf333f2c1161008c578063d547741f11610066578063d547741f14610385578063dcf844a714610398578063e00a83e0146103b857600080fd5b8063bf333f2c14610341578063ca15c8731461034b578063ccc574901461035e57600080fd5b8063a217fddf116100bd578063a217fddf14610313578063b13aa2d61461031b578063b250fe6b1461032e57600080fd5b806391d14854146102a8578063926d7d7f146102ec57600080fd5b80632f2ff15d1161012f57806358f858801161011457806358f85880146102405780635960ccf2146102495780639010d07c1461027057600080fd5b80632f2ff15d1461021a57806336568abe1461022d57600080fd5b806306f333f21161016057806306f333f2146101d95780630f5f6ed7146101ee578063248a9ca3146101f757600080fd5b806301ffc9a71461017c57806303ed0ee5146101a4575b600080fd5b61018f61018a366004611013565b6103c1565b60405190151581526020015b60405180910390f35b6101cb7f043c983c49d46f0e102151eaf8085d4a2e6571d5df2d47b013f39bddfd4a639d81565b60405190815260200161019b565b6101ec6101e736600461107e565b61041d565b005b6101cb61271081565b6101cb6102053660046110b1565b60009081526020819052604090206001015490565b6101ec6102283660046110ca565b61050b565b6101ec61023b3660046110ca565b610536565b6101cb60025481565b6101cb7fdb9556138406326f00296e13ea2ad7db24ba82381212d816b1a40c23b466b32781565b61028361027e3660046110ed565b61058f565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161019b565b61018f6102b63660046110ca565b60009182526020828152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b6101cb7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc481565b6101cb600081565b6101ec6103293660046110b1565b6105ae565b6101ec61033c3660046110b1565b610690565b6101cb620f424081565b6101cb6103593660046110b1565b6106f8565b6101cb7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5581565b6101ec6103933660046110ca565b61070f565b6101cb6103a636600461110f565b60036020526000908152604090205481565b6101cb60045481565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f5a05180f000000000000000000000000000000000000000000000000000000001480610417575061041782610734565b92915050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f55610447816107cb565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600360205260408120549081900361047b5750505050565b73ffffffffffffffffffffffffffffffffffffffff84166000818152600360205260408120556104ac9084836107d8565b6040805173ffffffffffffffffffffffffffffffffffffffff8087168252851660208201529081018290527f244e51bc38c1452fa8aaf487bcb4bca36c2baa3a5fbdb776b1eabd8dc6d277cd9060600160405180910390a1505b505050565b600082815260208190526040902060010154610526816107cb565b610530838361092f565b50505050565b73ffffffffffffffffffffffffffffffffffffffff81163314610585576040517f6697b23200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6105068282610964565b60008281526001602052604081206105a79083610991565b9392505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f556105d8816107cb565b612710821115610649576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f6e657746656552617465203e206d61780000000000000000000000000000000060448201526064015b60405180910390fd5b600280549083905560408051828152602081018590527f14914da2bf76024616fbe1859783fcd4dbddcb179b1f3a854949fbf920dcb95791015b60405180910390a1505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f556106ba816107cb565b600480549083905560408051828152602081018590527f5cf09b12f3f56b4c564d51b25b40360af6d795198adb61ae0806a36c294323fa9101610683565b60008181526001602052604081206104179061099d565b60008281526020819052604090206001015461072a816107cb565b6105308383610964565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061041757507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614610417565b6107d581336109a7565b50565b3073ffffffffffffffffffffffffffffffffffffffff8316036107fa57505050565b8060000361080757505050565b7fffffffffffffffffffffffff111111111111111111111111111111111111111273ffffffffffffffffffffffffffffffffffffffff84160161090e5760008273ffffffffffffffffffffffffffffffffffffffff168260405160006040518083038185875af1925050503d806000811461089e576040519150601f19603f3d011682016040523d82523d6000602084013e6108a3565b606091505b5050905080610530576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f455448207472616e73666572206661696c6564000000000000000000000000006044820152606401610640565b61050673ffffffffffffffffffffffffffffffffffffffff84168383610a31565b60008061093c8484610abe565b905080156105a757600084815260016020526040902061095c9084610bba565b509392505050565b6000806109718484610bdc565b905080156105a757600084815260016020526040902061095c9084610c97565b60006105a78383610cb9565b6000610417825490565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16610a2d576040517fe2517d3f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8216600482015260248101839052604401610640565b5050565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000179052610506908490610ce3565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915281205460ff16610bb25760008381526020818152604080832073ffffffffffffffffffffffffffffffffffffffff86168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055610b503390565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a4506001610417565b506000610417565b60006105a78373ffffffffffffffffffffffffffffffffffffffff8416610d79565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915281205460ff1615610bb25760008381526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8616808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a4506001610417565b60006105a78373ffffffffffffffffffffffffffffffffffffffff8416610dc0565b6000826000018281548110610cd057610cd061112a565b9060005260206000200154905092915050565b6000610d0573ffffffffffffffffffffffffffffffffffffffff841683610eb3565b90508051600014158015610d2a575080806020019051810190610d289190611159565b155b15610506576040517f5274afe700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84166004820152602401610640565b6000818152600183016020526040812054610bb257508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610417565b60008181526001830160205260408120548015610ea9576000610de460018361117b565b8554909150600090610df89060019061117b565b9050808214610e5d576000866000018281548110610e1857610e1861112a565b9060005260206000200154905080876000018481548110610e3b57610e3b61112a565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080610e6e57610e6e6111b5565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610417565b6000915050610417565b60606105a783836000846000808573ffffffffffffffffffffffffffffffffffffffff168486604051610ee691906111e4565b60006040518083038185875af1925050503d8060008114610f23576040519150601f19603f3d011682016040523d82523d6000602084013e610f28565b606091505b5091509150610f38868383610f42565b9695505050505050565b606082610f5757610f5282610fd1565b6105a7565b8151158015610f7b575073ffffffffffffffffffffffffffffffffffffffff84163b155b15610fca576040517f9996b31500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85166004820152602401610640565b50806105a7565b805115610fe15780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006020828403121561102557600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146105a757600080fd5b803573ffffffffffffffffffffffffffffffffffffffff8116811461107957600080fd5b919050565b6000806040838503121561109157600080fd5b61109a83611055565b91506110a860208401611055565b90509250929050565b6000602082840312156110c357600080fd5b5035919050565b600080604083850312156110dd57600080fd5b823591506110a860208401611055565b6000806040838503121561110057600080fd5b50508035926020909101359150565b60006020828403121561112157600080fd5b6105a782611055565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006020828403121561116b57600080fd5b815180151581146105a757600080fd5b81810381811115610417577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b6000825160005b8181101561120557602081860181015185830152016111eb565b50600092019182525091905056fea2646970667358221220f8a690a9e53a73fae27a3411c13cdb2a1b5392c7c709848e4b898d92e8162e6164736f6c63430008140033", } // AdminABI is the input ABI used to generate the binding from. @@ -3995,7 +3995,7 @@ func (_ERC165 *ERC165CallerSession) SupportsInterface(interfaceId [4]byte) (bool // EnumerableSetMetaData contains all meta data concerning the EnumerableSet contract. var EnumerableSetMetaData = &bind.MetaData{ ABI: "[]", - Bin: "0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212200d8618a82dfc0c2e00136a6baf933d53111fd9bd0c5433b637ac80498bb32ba464736f6c63430008140033", + Bin: "0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212202f269d118504dda82572144eb47e6cd8f57b1d550267c82258312e57d46f164664736f6c63430008140033", } // EnumerableSetABI is the input ABI used to generate the binding from. @@ -4207,7 +4207,7 @@ var FastBridgeMetaData = &bind.MetaData{ "01ffc9a7": "supportsInterface(bytes4)", "06f333f2": "sweepProtocolFees(address,address)", }, - Bin: "0x60a06040523480156200001157600080fd5b5060405162002d7a38038062002d7a833981016040819052620000349162000194565b80620000426000826200004f565b50504360805250620001bf565b6000806200005e84846200008c565b90508015620000835760008481526001602052604090206200008190846200013a565b505b90505b92915050565b6000828152602081815260408083206001600160a01b038516845290915281205460ff1662000131576000838152602081815260408083206001600160a01b03861684529091529020805460ff19166001179055620000e83390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a450600162000086565b50600062000086565b600062000083836001600160a01b0384166000818152600183016020526040812054620001315750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915562000086565b600060208284031215620001a757600080fd5b81516001600160a01b03811681146200008357600080fd5b608051612b9f620001db60003960006106510152612b9f6000f3fe60806040526004361061026a5760003560e01c80639010d07c11610153578063add98c70116100cb578063ca15c8731161007f578063d547741f11610064578063d547741f146107a1578063dcf844a7146107c1578063e00a83e0146107ee57600080fd5b8063ca15c8731461074d578063ccc574901461076d57600080fd5b8063b13aa2d6116100b0578063b13aa2d6146106f6578063b250fe6b14610716578063bf333f2c1461073657600080fd5b8063add98c70146106c0578063affed0e0146106e057600080fd5b8063a217fddf11610122578063a5bbe22b11610107578063a5bbe22b1461047f578063aa9641ab14610673578063ac11fb1a1461069357600080fd5b8063a217fddf1461062a578063a3ec191a1461063f57600080fd5b80639010d07c146104f857806391ad50391461053057806391d14854146105b2578063926d7d7f146105f657600080fd5b806341fcb612116101e65780635eb7d946116101b55780638379a24f1161019a5780638379a24f14610495578063886d36ff146104c55780638f0d6f17146104e557600080fd5b80635eb7d9461461045f578063820688d51461047f57600080fd5b806341fcb612146103e2578063458516941461040257806358f85880146104155780635960ccf21461042b57600080fd5b80630f5f6ed71161023d578063248a9ca311610222578063248a9ca3146103725780632f2ff15d146103a257806336568abe146103c257600080fd5b80630f5f6ed714610345578063190da5951461035b57600080fd5b806301ffc9a71461026f57806303ed0ee5146102a4578063051287bc146102e657806306f333f214610323575b600080fd5b34801561027b57600080fd5b5061028f61028a3660046122fc565b610804565b60405190151581526020015b60405180910390f35b3480156102b057600080fd5b506102d87f043c983c49d46f0e102151eaf8085d4a2e6571d5df2d47b013f39bddfd4a639d81565b60405190815260200161029b565b3480156102f257600080fd5b5061031661030136600461233e565b60056020526000908152604090205460ff1681565b60405161029b9190612386565b34801561032f57600080fd5b5061034361033e3660046123ec565b610860565b005b34801561035157600080fd5b506102d861271081565b34801561036757600080fd5b506102d862093a8081565b34801561037e57600080fd5b506102d861038d36600461233e565b60009081526020819052604090206001015490565b3480156103ae57600080fd5b506103436103bd366004612425565b610927565b3480156103ce57600080fd5b506103436103dd366004612425565b610952565b3480156103ee57600080fd5b506103436103fd366004612572565b61099e565b6103436104103660046125ef565b610bd7565b34801561042157600080fd5b506102d860025481565b34801561043757600080fd5b506102d87fdb9556138406326f00296e13ea2ad7db24ba82381212d816b1a40c23b466b32781565b34801561046b57600080fd5b5061034361047a366004612692565b610ee5565b34801561048b57600080fd5b506102d861070881565b3480156104a157600080fd5b5061028f6104b036600461233e565b60076020526000908152604090205460ff1681565b3480156104d157600080fd5b506103436104e03660046126cf565b6110bd565b6103436104f3366004612692565b6111f0565b34801561050457600080fd5b50610518610513366004612714565b611437565b6040516001600160a01b03909116815260200161029b565b34801561053c57600080fd5b5061058661054b36600461233e565b6006602052600090815260409020546bffffffffffffffffffffffff8116906c0100000000000000000000000090046001600160a01b031682565b604080516bffffffffffffffffffffffff90931683526001600160a01b0390911660208301520161029b565b3480156105be57600080fd5b5061028f6105cd366004612425565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b34801561060257600080fd5b506102d87fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc481565b34801561063657600080fd5b506102d8600081565b34801561064b57600080fd5b506102d87f000000000000000000000000000000000000000000000000000000000000000081565b34801561067f57600080fd5b5061028f61068e366004612425565b611456565b34801561069f57600080fd5b506106b36106ae366004612692565b611559565b60405161029b9190612736565b3480156106cc57600080fd5b506103436106db36600461233e565b6115cc565b3480156106ec57600080fd5b506102d860085481565b34801561070257600080fd5b5061034361071136600461233e565b611735565b34801561072257600080fd5b5061034361073136600461233e565b611817565b34801561074257600080fd5b506102d8620f424081565b34801561075957600080fd5b506102d861076836600461233e565b61187f565b34801561077957600080fd5b506102d87f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5581565b3480156107ad57600080fd5b506103436107bc366004612425565b611896565b3480156107cd57600080fd5b506102d86107dc36600461281c565b60036020526000908152604090205481565b3480156107fa57600080fd5b506102d860045481565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f5a05180f00000000000000000000000000000000000000000000000000000000148061085a575061085a826118bb565b92915050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5561088a81611952565b6001600160a01b038316600090815260036020526040812054908190036108b15750505050565b6001600160a01b0384166000818152600360205260408120556108d590848361195f565b604080516001600160a01b038087168252851660208201529081018290527f244e51bc38c1452fa8aaf487bcb4bca36c2baa3a5fbdb776b1eabd8dc6d277cd9060600160405180910390a1505b505050565b60008281526020819052604090206001015461094281611952565b61094c8383611a82565b50505050565b6001600160a01b0381163314610994576040517f6697b23200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6109228282611ab7565b7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc46109c881611952565b8251602084012060006109da85611559565b9050600260008381526005602052604090205460ff166004811115610a0157610a01612357565b14610a38576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000828152600660209081526040918290208251808401909352546bffffffffffffffffffffffff811683526c0100000000000000000000000090046001600160a01b03169082018190523314610abb576040517f4af43a9000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80516107089042036bffffffffffffffffffffffff1611610b08576040517f1992d0bd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000838152600560205260409020805460ff1916600317905561010082015115610b645761010082015160808301516001600160a01b031660009081526003602052604081208054909190610b5e908490612868565b90915550505b608082015160c0830151610b826001600160a01b038316888361195f565b604080516001600160a01b03848116825260208201849052891691339188917f582211c35a2139ac3bbaac74663c6a1f56c6cbb658b41fe11fd45a82074ac67891015b60405180910390a45050505050505050565b46816000015163ffffffff1603610c1a576040517f7029fdf900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60a08101511580610c2d575060c0810151155b15610c64576040517fe38820c800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60608101516001600160a01b03161580610c89575060808101516001600160a01b0316155b15610cc0576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610ccc61070842612868565b8161010001511015610d0a576040517f04b7fcc800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000610d1f3083606001518460a00151611ae4565b90506000806002541115610d4c57620f424060025483610d3f919061287b565b610d499190612892565b90505b610d5681836128cd565b915060006040518061018001604052804663ffffffff168152602001856000015163ffffffff16815260200185602001516001600160a01b0316815260200185604001516001600160a01b0316815260200185606001516001600160a01b0316815260200185608001516001600160a01b031681526020018481526020018560c0015181526020018381526020018560e0015115158152602001856101000151815260200160086000815480929190610e0e906128e0565b909155509052604051610e249190602001612736565b604080518083037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0018152828252805160208083019190912060008181526005835293909320805460ff191660011790558701518751606089015160808a015160c08b015160e08c015195985095966001600160a01b039094169587957f120ea0364f36cdac7983bcfdd55270ca09d7f9b314a2ebc425a3b01ab1d6403a95610ed6958b959094909390928e9261293c565b60405180910390a35050505050565b805160208201206000610ef783611559565b3360009081527fd2043bf65931af3dbecf60d0db8f40e4160406d7beb00522f4200cf4944a1eb8602052604090205490915060ff1615610f74578061014001514211610f6f576040517fe15ff9ea00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610fc0565b62093a80816101400151610f889190612868565b4211610fc0576040517fe15ff9ea00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600160008381526005602052604090205460ff166004811115610fe557610fe5612357565b1461101c576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600082815260056020526040808220805460ff19166004179055820151608083015161010084015160c0850151929391926110579190612868565b905061106d6001600160a01b038316848361195f565b604080516001600160a01b0384811682526020820184905285169187917fb4c55c0c9bc613519b920e88748090150b890a875d307f21bea7d4fb2e8bc958910160405180910390a3505050505050565b7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc46110e781611952565b82516020840120600160008281526005602052604090205460ff16600481111561111357611113612357565b1461114a576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008181526005602090815260408083208054600260ff19909116179055805180820182526bffffffffffffffffffffffff4281168252338285018181528787526006865295849020925195516001600160a01b03166c0100000000000000000000000002959091169490941790555185815283917f4ac8af8a2cd87193d64dfc7a3b8d9923b714ec528b18725d080aa1299be0c5e4910160405180910390a350505050565b7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc461121a81611952565b81516020830120600061122c84611559565b90504663ffffffff16816020015163ffffffff1614611277576040517f7029fdf900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8061014001514211156112b6576040517f559895a300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008281526007602052604090205460ff16156112ff576040517fbef7bb7d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000828152600760205260409020805460ff19166001179055606081015160a082015160e083015160045461012085015161134857506000611342848484611ae4565b506113b9565b7fffffffffffffffffffffffff11111111111111111111111111111111111111126001600160a01b0384160161138c5761134284846113878486612868565b611ae4565b611397848484611ae4565b506113b78473eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee83611ae4565b505b845160808087015160a08089015160c0808b015160e08c01516040805163ffffffff90991689526001600160a01b0396871660208a0152938616938801939093526060870152938501528301849052861691339189917ff8ae392d784b1ea5e8881bfa586d81abf07ef4f1e2fc75f7fe51c90f05199a5c9101610bc5565b600082815260016020526040812061144f9083611cb3565b9392505050565b6000600260008481526005602052604090205460ff16600481111561147d5761147d612357565b146114b4576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000838152600660209081526040918290208251808401909352546bffffffffffffffffffffffff811683526001600160a01b036c01000000000000000000000000909104811691830182905284161461153a576040517f4af43a9000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80516107089042036bffffffffffffffffffffffff1611949350505050565b604080516101808101825260008082526020808301829052928201819052606082018190526080820181905260a0820181905260c0820181905260e082018190526101008201819052610120820181905261014082018190526101608201528251909161085a91840181019084016129ed565b7f043c983c49d46f0e102151eaf8085d4a2e6571d5df2d47b013f39bddfd4a639d6115f681611952565b600260008381526005602052604090205460ff16600481111561161b5761161b612357565b14611652576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000828152600660209081526040918290208251808401909352546bffffffffffffffffffffffff8082168085526c010000000000000000000000009092046001600160a01b031693909201929092526107089142031611156116e1576040517f3e908aac00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000828152600560209081526040808320805460ff19166001179055600690915280822082905551339184917f0695cf1d39b3055dcd0fe02d8b47eaf0d5a13e1996de925de59d0ef9b7f7fad49190a35050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5561175f81611952565b6127108211156117d0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f6e657746656552617465203e206d61780000000000000000000000000000000060448201526064015b60405180910390fd5b600280549083905560408051828152602081018590527f14914da2bf76024616fbe1859783fcd4dbddcb179b1f3a854949fbf920dcb95791015b60405180910390a1505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5561184181611952565b600480549083905560408051828152602081018590527f5cf09b12f3f56b4c564d51b25b40360af6d795198adb61ae0806a36c294323fa910161180a565b600081815260016020526040812061085a90611cbf565b6000828152602081905260409020600101546118b181611952565b61094c8383611ab7565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061085a57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff0000000000000000000000000000000000000000000000000000000083161461085a565b61195c8133611cc9565b50565b306001600160a01b0383160361197457505050565b8060000361198157505050565b7fffffffffffffffffffffffff11111111111111111111111111111111111111126001600160a01b03841601611a6e576000826001600160a01b03168260405160006040518083038185875af1925050503d80600081146119fe576040519150601f19603f3d011682016040523d82523d6000602084013e611a03565b606091505b505090508061094c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f455448207472616e73666572206661696c65640000000000000000000000000060448201526064016117c7565b6109226001600160a01b0384168383611d39565b600080611a8f8484611dad565b9050801561144f576000848152600160205260409020611aaf9084611e57565b509392505050565b600080611ac48484611e6c565b9050801561144f576000848152600160205260409020611aaf9084611eef565b60006001600160a01b03831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14611c4d57611b1c836001600160a01b0316611f04565b6040517f70a082310000000000000000000000000000000000000000000000000000000081526001600160a01b0385811660048301528416906370a0823190602401602060405180830381865afa158015611b7b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b9f9190612ab9565b9050611bb66001600160a01b038416338685611faa565b6040517f70a082310000000000000000000000000000000000000000000000000000000081526001600160a01b0385811660048301528291908516906370a0823190602401602060405180830381865afa158015611c18573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c3c9190612ab9565b611c4691906128cd565b905061144f565b348214611c86576040517f81de0bf300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b0384163014611caa57611caa6001600160a01b038416858461195f565b50349392505050565b600061144f8383611fe3565b600061085a825490565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16611d35576040517fe2517d3f0000000000000000000000000000000000000000000000000000000081526001600160a01b0382166004820152602481018390526044016117c7565b5050565b6040516001600160a01b0383811660248301526044820183905261092291859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505061200d565b6000828152602081815260408083206001600160a01b038516845290915281205460ff16611e4f576000838152602081815260408083206001600160a01b03861684529091529020805460ff19166001179055611e073390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a450600161085a565b50600061085a565b600061144f836001600160a01b038416612089565b6000828152602081815260408083206001600160a01b038516845290915281205460ff1615611e4f576000838152602081815260408083206001600160a01b0386168085529252808320805460ff1916905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a450600161085a565b600061144f836001600160a01b0384166120d0565b7fffffffffffffffffffffffff11111111111111111111111111111111111111126001600160a01b03821601611f66576040517f7f523fe800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b806001600160a01b03163b60000361195c576040517f7f523fe800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040516001600160a01b03848116602483015283811660448301526064820183905261094c9186918216906323b872dd90608401611d66565b6000826000018281548110611ffa57611ffa612ad2565b9060005260206000200154905092915050565b60006120226001600160a01b038416836121c3565b905080516000141580156120475750808060200190518101906120459190612b01565b155b15610922576040517f5274afe70000000000000000000000000000000000000000000000000000000081526001600160a01b03841660048201526024016117c7565b6000818152600183016020526040812054611e4f5750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561085a565b600081815260018301602052604081205480156121b95760006120f46001836128cd565b8554909150600090612108906001906128cd565b905080821461216d57600086600001828154811061212857612128612ad2565b906000526020600020015490508087600001848154811061214b5761214b612ad2565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061217e5761217e612b1e565b60019003818190600052602060002001600090559055856001016000868152602001908152602001600020600090556001935050505061085a565b600091505061085a565b606061144f8383600084600080856001600160a01b031684866040516121e99190612b4d565b60006040518083038185875af1925050503d8060008114612226576040519150601f19603f3d011682016040523d82523d6000602084013e61222b565b606091505b509150915061223b868383612245565b9695505050505050565b60608261225a57612255826122ba565b61144f565b815115801561227157506001600160a01b0384163b155b156122b3576040517f9996b3150000000000000000000000000000000000000000000000000000000081526001600160a01b03851660048201526024016117c7565b508061144f565b8051156122ca5780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006020828403121561230e57600080fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811461144f57600080fd5b60006020828403121561235057600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b60208101600583106123c1577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b91905290565b6001600160a01b038116811461195c57600080fd5b80356123e7816123c7565b919050565b600080604083850312156123ff57600080fd5b823561240a816123c7565b9150602083013561241a816123c7565b809150509250929050565b6000806040838503121561243857600080fd5b82359150602083013561241a816123c7565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051610120810167ffffffffffffffff8111828210171561249d5761249d61244a565b60405290565b604051610180810167ffffffffffffffff8111828210171561249d5761249d61244a565b600082601f8301126124d857600080fd5b813567ffffffffffffffff808211156124f3576124f361244a565b604051601f83017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f011681019082821181831017156125395761253961244a565b8160405283815286602085880101111561255257600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000806040838503121561258557600080fd5b823567ffffffffffffffff81111561259c57600080fd5b6125a8858286016124c7565b925050602083013561241a816123c7565b63ffffffff8116811461195c57600080fd5b80356123e7816125b9565b801515811461195c57600080fd5b80356123e7816125d6565b6000610120828403121561260257600080fd5b61260a612479565b612613836125cb565b8152612621602084016123dc565b6020820152612632604084016123dc565b6040820152612643606084016123dc565b6060820152612654608084016123dc565b608082015260a083013560a082015260c083013560c082015261267960e084016125e4565b60e0820152610100928301359281019290925250919050565b6000602082840312156126a457600080fd5b813567ffffffffffffffff8111156126bb57600080fd5b6126c7848285016124c7565b949350505050565b600080604083850312156126e257600080fd5b823567ffffffffffffffff8111156126f957600080fd5b612705858286016124c7565b95602094909401359450505050565b6000806040838503121561272757600080fd5b50508035926020909101359150565b815163ffffffff1681526101808101602083015161275c602084018263ffffffff169052565b50604083015161277760408401826001600160a01b03169052565b50606083015161279260608401826001600160a01b03169052565b5060808301516127ad60808401826001600160a01b03169052565b5060a08301516127c860a08401826001600160a01b03169052565b5060c083015160c083015260e083015160e0830152610100808401518184015250610120808401516127fd8285018215159052565b5050610140838101519083015261016092830151929091019190915290565b60006020828403121561282e57600080fd5b813561144f816123c7565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8082018082111561085a5761085a612839565b808202811582820484141761085a5761085a612839565b6000826128c8577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b8181038181111561085a5761085a612839565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361291157612911612839565b5060010190565b60005b8381101561293357818101518382015260200161291b565b50506000910152565b60e08152600088518060e084015261010061295d8282860160208e01612918565b63ffffffff9990991660208401526001600160a01b039788166040840152959096166060820152608081019390935260a0830191909152151560c0820152601f9091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0160190910192915050565b80516123e7816125b9565b80516123e7816123c7565b80516123e7816125d6565b60006101808284031215612a0057600080fd5b612a086124a3565b612a11836129cc565b8152612a1f602084016129cc565b6020820152612a30604084016129d7565b6040820152612a41606084016129d7565b6060820152612a52608084016129d7565b6080820152612a6360a084016129d7565b60a082015260c083015160c082015260e083015160e0820152610100808401518183015250610120612a968185016129e2565b908201526101408381015190820152610160928301519281019290925250919050565b600060208284031215612acb57600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600060208284031215612b1357600080fd5b815161144f816125d6565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b60008251612b5f818460208701612918565b919091019291505056fea26469706673582212203bd946d03327296505c829a4894b0a06df193475064ebb0445d9c80a5699ab3164736f6c63430008140033", + Bin: "0x60a06040523480156200001157600080fd5b5060405162002d7a38038062002d7a833981016040819052620000349162000194565b80620000426000826200004f565b50504360805250620001bf565b6000806200005e84846200008c565b90508015620000835760008481526001602052604090206200008190846200013a565b505b90505b92915050565b6000828152602081815260408083206001600160a01b038516845290915281205460ff1662000131576000838152602081815260408083206001600160a01b03861684529091529020805460ff19166001179055620000e83390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a450600162000086565b50600062000086565b600062000083836001600160a01b0384166000818152600183016020526040812054620001315750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915562000086565b600060208284031215620001a757600080fd5b81516001600160a01b03811681146200008357600080fd5b608051612b9f620001db60003960006106510152612b9f6000f3fe60806040526004361061026a5760003560e01c80639010d07c11610153578063add98c70116100cb578063ca15c8731161007f578063d547741f11610064578063d547741f146107a1578063dcf844a7146107c1578063e00a83e0146107ee57600080fd5b8063ca15c8731461074d578063ccc574901461076d57600080fd5b8063b13aa2d6116100b0578063b13aa2d6146106f6578063b250fe6b14610716578063bf333f2c1461073657600080fd5b8063add98c70146106c0578063affed0e0146106e057600080fd5b8063a217fddf11610122578063a5bbe22b11610107578063a5bbe22b1461047f578063aa9641ab14610673578063ac11fb1a1461069357600080fd5b8063a217fddf1461062a578063a3ec191a1461063f57600080fd5b80639010d07c146104f857806391ad50391461053057806391d14854146105b2578063926d7d7f146105f657600080fd5b806341fcb612116101e65780635eb7d946116101b55780638379a24f1161019a5780638379a24f14610495578063886d36ff146104c55780638f0d6f17146104e557600080fd5b80635eb7d9461461045f578063820688d51461047f57600080fd5b806341fcb612146103e2578063458516941461040257806358f85880146104155780635960ccf21461042b57600080fd5b80630f5f6ed71161023d578063248a9ca311610222578063248a9ca3146103725780632f2ff15d146103a257806336568abe146103c257600080fd5b80630f5f6ed714610345578063190da5951461035b57600080fd5b806301ffc9a71461026f57806303ed0ee5146102a4578063051287bc146102e657806306f333f214610323575b600080fd5b34801561027b57600080fd5b5061028f61028a3660046122fc565b610804565b60405190151581526020015b60405180910390f35b3480156102b057600080fd5b506102d87f043c983c49d46f0e102151eaf8085d4a2e6571d5df2d47b013f39bddfd4a639d81565b60405190815260200161029b565b3480156102f257600080fd5b5061031661030136600461233e565b60056020526000908152604090205460ff1681565b60405161029b9190612386565b34801561032f57600080fd5b5061034361033e3660046123ec565b610860565b005b34801561035157600080fd5b506102d861271081565b34801561036757600080fd5b506102d862093a8081565b34801561037e57600080fd5b506102d861038d36600461233e565b60009081526020819052604090206001015490565b3480156103ae57600080fd5b506103436103bd366004612425565b610927565b3480156103ce57600080fd5b506103436103dd366004612425565b610952565b3480156103ee57600080fd5b506103436103fd366004612572565b61099e565b6103436104103660046125ef565b610bd7565b34801561042157600080fd5b506102d860025481565b34801561043757600080fd5b506102d87fdb9556138406326f00296e13ea2ad7db24ba82381212d816b1a40c23b466b32781565b34801561046b57600080fd5b5061034361047a366004612692565b610ee5565b34801561048b57600080fd5b506102d861070881565b3480156104a157600080fd5b5061028f6104b036600461233e565b60076020526000908152604090205460ff1681565b3480156104d157600080fd5b506103436104e03660046126cf565b6110bd565b6103436104f3366004612692565b6111f0565b34801561050457600080fd5b50610518610513366004612714565b611437565b6040516001600160a01b03909116815260200161029b565b34801561053c57600080fd5b5061058661054b36600461233e565b6006602052600090815260409020546bffffffffffffffffffffffff8116906c0100000000000000000000000090046001600160a01b031682565b604080516bffffffffffffffffffffffff90931683526001600160a01b0390911660208301520161029b565b3480156105be57600080fd5b5061028f6105cd366004612425565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b34801561060257600080fd5b506102d87fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc481565b34801561063657600080fd5b506102d8600081565b34801561064b57600080fd5b506102d87f000000000000000000000000000000000000000000000000000000000000000081565b34801561067f57600080fd5b5061028f61068e366004612425565b611456565b34801561069f57600080fd5b506106b36106ae366004612692565b611559565b60405161029b9190612736565b3480156106cc57600080fd5b506103436106db36600461233e565b6115cc565b3480156106ec57600080fd5b506102d860085481565b34801561070257600080fd5b5061034361071136600461233e565b611735565b34801561072257600080fd5b5061034361073136600461233e565b611817565b34801561074257600080fd5b506102d8620f424081565b34801561075957600080fd5b506102d861076836600461233e565b61187f565b34801561077957600080fd5b506102d87f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5581565b3480156107ad57600080fd5b506103436107bc366004612425565b611896565b3480156107cd57600080fd5b506102d86107dc36600461281c565b60036020526000908152604090205481565b3480156107fa57600080fd5b506102d860045481565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f5a05180f00000000000000000000000000000000000000000000000000000000148061085a575061085a826118bb565b92915050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5561088a81611952565b6001600160a01b038316600090815260036020526040812054908190036108b15750505050565b6001600160a01b0384166000818152600360205260408120556108d590848361195f565b604080516001600160a01b038087168252851660208201529081018290527f244e51bc38c1452fa8aaf487bcb4bca36c2baa3a5fbdb776b1eabd8dc6d277cd9060600160405180910390a1505b505050565b60008281526020819052604090206001015461094281611952565b61094c8383611a82565b50505050565b6001600160a01b0381163314610994576040517f6697b23200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6109228282611ab7565b7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc46109c881611952565b8251602084012060006109da85611559565b9050600260008381526005602052604090205460ff166004811115610a0157610a01612357565b14610a38576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000828152600660209081526040918290208251808401909352546bffffffffffffffffffffffff811683526c0100000000000000000000000090046001600160a01b03169082018190523314610abb576040517f4af43a9000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80516107089042036bffffffffffffffffffffffff1611610b08576040517f1992d0bd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000838152600560205260409020805460ff1916600317905561010082015115610b645761010082015160808301516001600160a01b031660009081526003602052604081208054909190610b5e908490612868565b90915550505b608082015160c0830151610b826001600160a01b038316888361195f565b604080516001600160a01b03848116825260208201849052891691339188917f582211c35a2139ac3bbaac74663c6a1f56c6cbb658b41fe11fd45a82074ac67891015b60405180910390a45050505050505050565b46816000015163ffffffff1603610c1a576040517f7029fdf900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60a08101511580610c2d575060c0810151155b15610c64576040517fe38820c800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60608101516001600160a01b03161580610c89575060808101516001600160a01b0316155b15610cc0576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610ccc61070842612868565b8161010001511015610d0a576040517f04b7fcc800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000610d1f3083606001518460a00151611ae4565b90506000806002541115610d4c57620f424060025483610d3f919061287b565b610d499190612892565b90505b610d5681836128cd565b915060006040518061018001604052804663ffffffff168152602001856000015163ffffffff16815260200185602001516001600160a01b0316815260200185604001516001600160a01b0316815260200185606001516001600160a01b0316815260200185608001516001600160a01b031681526020018481526020018560c0015181526020018381526020018560e0015115158152602001856101000151815260200160086000815480929190610e0e906128e0565b909155509052604051610e249190602001612736565b604080518083037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0018152828252805160208083019190912060008181526005835293909320805460ff191660011790558701518751606089015160808a015160c08b015160e08c015195985095966001600160a01b039094169587957f120ea0364f36cdac7983bcfdd55270ca09d7f9b314a2ebc425a3b01ab1d6403a95610ed6958b959094909390928e9261293c565b60405180910390a35050505050565b805160208201206000610ef783611559565b3360009081527fd2043bf65931af3dbecf60d0db8f40e4160406d7beb00522f4200cf4944a1eb8602052604090205490915060ff1615610f74578061014001514211610f6f576040517fe15ff9ea00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610fc0565b62093a80816101400151610f889190612868565b4211610fc0576040517fe15ff9ea00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600160008381526005602052604090205460ff166004811115610fe557610fe5612357565b1461101c576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600082815260056020526040808220805460ff19166004179055820151608083015161010084015160c0850151929391926110579190612868565b905061106d6001600160a01b038316848361195f565b604080516001600160a01b0384811682526020820184905285169187917fb4c55c0c9bc613519b920e88748090150b890a875d307f21bea7d4fb2e8bc958910160405180910390a3505050505050565b7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc46110e781611952565b82516020840120600160008281526005602052604090205460ff16600481111561111357611113612357565b1461114a576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008181526005602090815260408083208054600260ff19909116179055805180820182526bffffffffffffffffffffffff4281168252338285018181528787526006865295849020925195516001600160a01b03166c0100000000000000000000000002959091169490941790555185815283917f4ac8af8a2cd87193d64dfc7a3b8d9923b714ec528b18725d080aa1299be0c5e4910160405180910390a350505050565b7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc461121a81611952565b81516020830120600061122c84611559565b90504663ffffffff16816020015163ffffffff1614611277576040517f7029fdf900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8061014001514211156112b6576040517f559895a300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008281526007602052604090205460ff16156112ff576040517fbef7bb7d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000828152600760205260409020805460ff19166001179055606081015160a082015160e083015160045461012085015161134857506000611342848484611ae4565b506113b9565b7fffffffffffffffffffffffff11111111111111111111111111111111111111126001600160a01b0384160161138c5761134284846113878486612868565b611ae4565b611397848484611ae4565b506113b78473eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee83611ae4565b505b845160808087015160a08089015160c0808b015160e08c01516040805163ffffffff90991689526001600160a01b0396871660208a0152938616938801939093526060870152938501528301849052861691339189917ff8ae392d784b1ea5e8881bfa586d81abf07ef4f1e2fc75f7fe51c90f05199a5c9101610bc5565b600082815260016020526040812061144f9083611cb3565b9392505050565b6000600260008481526005602052604090205460ff16600481111561147d5761147d612357565b146114b4576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000838152600660209081526040918290208251808401909352546bffffffffffffffffffffffff811683526001600160a01b036c01000000000000000000000000909104811691830182905284161461153a576040517f4af43a9000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80516107089042036bffffffffffffffffffffffff1611949350505050565b604080516101808101825260008082526020808301829052928201819052606082018190526080820181905260a0820181905260c0820181905260e082018190526101008201819052610120820181905261014082018190526101608201528251909161085a91840181019084016129ed565b7f043c983c49d46f0e102151eaf8085d4a2e6571d5df2d47b013f39bddfd4a639d6115f681611952565b600260008381526005602052604090205460ff16600481111561161b5761161b612357565b14611652576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000828152600660209081526040918290208251808401909352546bffffffffffffffffffffffff8082168085526c010000000000000000000000009092046001600160a01b031693909201929092526107089142031611156116e1576040517f3e908aac00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000828152600560209081526040808320805460ff19166001179055600690915280822082905551339184917f0695cf1d39b3055dcd0fe02d8b47eaf0d5a13e1996de925de59d0ef9b7f7fad49190a35050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5561175f81611952565b6127108211156117d0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f6e657746656552617465203e206d61780000000000000000000000000000000060448201526064015b60405180910390fd5b600280549083905560408051828152602081018590527f14914da2bf76024616fbe1859783fcd4dbddcb179b1f3a854949fbf920dcb95791015b60405180910390a1505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5561184181611952565b600480549083905560408051828152602081018590527f5cf09b12f3f56b4c564d51b25b40360af6d795198adb61ae0806a36c294323fa910161180a565b600081815260016020526040812061085a90611cbf565b6000828152602081905260409020600101546118b181611952565b61094c8383611ab7565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061085a57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff0000000000000000000000000000000000000000000000000000000083161461085a565b61195c8133611cc9565b50565b306001600160a01b0383160361197457505050565b8060000361198157505050565b7fffffffffffffffffffffffff11111111111111111111111111111111111111126001600160a01b03841601611a6e576000826001600160a01b03168260405160006040518083038185875af1925050503d80600081146119fe576040519150601f19603f3d011682016040523d82523d6000602084013e611a03565b606091505b505090508061094c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f455448207472616e73666572206661696c65640000000000000000000000000060448201526064016117c7565b6109226001600160a01b0384168383611d39565b600080611a8f8484611dad565b9050801561144f576000848152600160205260409020611aaf9084611e57565b509392505050565b600080611ac48484611e6c565b9050801561144f576000848152600160205260409020611aaf9084611eef565b60006001600160a01b03831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14611c4d57611b1c836001600160a01b0316611f04565b6040517f70a082310000000000000000000000000000000000000000000000000000000081526001600160a01b0385811660048301528416906370a0823190602401602060405180830381865afa158015611b7b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b9f9190612ab9565b9050611bb66001600160a01b038416338685611faa565b6040517f70a082310000000000000000000000000000000000000000000000000000000081526001600160a01b0385811660048301528291908516906370a0823190602401602060405180830381865afa158015611c18573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c3c9190612ab9565b611c4691906128cd565b905061144f565b348214611c86576040517f81de0bf300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b0384163014611caa57611caa6001600160a01b038416858461195f565b50349392505050565b600061144f8383611fe3565b600061085a825490565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16611d35576040517fe2517d3f0000000000000000000000000000000000000000000000000000000081526001600160a01b0382166004820152602481018390526044016117c7565b5050565b6040516001600160a01b0383811660248301526044820183905261092291859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505061200d565b6000828152602081815260408083206001600160a01b038516845290915281205460ff16611e4f576000838152602081815260408083206001600160a01b03861684529091529020805460ff19166001179055611e073390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a450600161085a565b50600061085a565b600061144f836001600160a01b038416612089565b6000828152602081815260408083206001600160a01b038516845290915281205460ff1615611e4f576000838152602081815260408083206001600160a01b0386168085529252808320805460ff1916905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a450600161085a565b600061144f836001600160a01b0384166120d0565b7fffffffffffffffffffffffff11111111111111111111111111111111111111126001600160a01b03821601611f66576040517f7f523fe800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b806001600160a01b03163b60000361195c576040517f7f523fe800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040516001600160a01b03848116602483015283811660448301526064820183905261094c9186918216906323b872dd90608401611d66565b6000826000018281548110611ffa57611ffa612ad2565b9060005260206000200154905092915050565b60006120226001600160a01b038416836121c3565b905080516000141580156120475750808060200190518101906120459190612b01565b155b15610922576040517f5274afe70000000000000000000000000000000000000000000000000000000081526001600160a01b03841660048201526024016117c7565b6000818152600183016020526040812054611e4f5750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561085a565b600081815260018301602052604081205480156121b95760006120f46001836128cd565b8554909150600090612108906001906128cd565b905080821461216d57600086600001828154811061212857612128612ad2565b906000526020600020015490508087600001848154811061214b5761214b612ad2565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061217e5761217e612b1e565b60019003818190600052602060002001600090559055856001016000868152602001908152602001600020600090556001935050505061085a565b600091505061085a565b606061144f8383600084600080856001600160a01b031684866040516121e99190612b4d565b60006040518083038185875af1925050503d8060008114612226576040519150601f19603f3d011682016040523d82523d6000602084013e61222b565b606091505b509150915061223b868383612245565b9695505050505050565b60608261225a57612255826122ba565b61144f565b815115801561227157506001600160a01b0384163b155b156122b3576040517f9996b3150000000000000000000000000000000000000000000000000000000081526001600160a01b03851660048201526024016117c7565b508061144f565b8051156122ca5780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006020828403121561230e57600080fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811461144f57600080fd5b60006020828403121561235057600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b60208101600583106123c1577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b91905290565b6001600160a01b038116811461195c57600080fd5b80356123e7816123c7565b919050565b600080604083850312156123ff57600080fd5b823561240a816123c7565b9150602083013561241a816123c7565b809150509250929050565b6000806040838503121561243857600080fd5b82359150602083013561241a816123c7565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051610120810167ffffffffffffffff8111828210171561249d5761249d61244a565b60405290565b604051610180810167ffffffffffffffff8111828210171561249d5761249d61244a565b600082601f8301126124d857600080fd5b813567ffffffffffffffff808211156124f3576124f361244a565b604051601f83017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f011681019082821181831017156125395761253961244a565b8160405283815286602085880101111561255257600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000806040838503121561258557600080fd5b823567ffffffffffffffff81111561259c57600080fd5b6125a8858286016124c7565b925050602083013561241a816123c7565b63ffffffff8116811461195c57600080fd5b80356123e7816125b9565b801515811461195c57600080fd5b80356123e7816125d6565b6000610120828403121561260257600080fd5b61260a612479565b612613836125cb565b8152612621602084016123dc565b6020820152612632604084016123dc565b6040820152612643606084016123dc565b6060820152612654608084016123dc565b608082015260a083013560a082015260c083013560c082015261267960e084016125e4565b60e0820152610100928301359281019290925250919050565b6000602082840312156126a457600080fd5b813567ffffffffffffffff8111156126bb57600080fd5b6126c7848285016124c7565b949350505050565b600080604083850312156126e257600080fd5b823567ffffffffffffffff8111156126f957600080fd5b612705858286016124c7565b95602094909401359450505050565b6000806040838503121561272757600080fd5b50508035926020909101359150565b815163ffffffff1681526101808101602083015161275c602084018263ffffffff169052565b50604083015161277760408401826001600160a01b03169052565b50606083015161279260608401826001600160a01b03169052565b5060808301516127ad60808401826001600160a01b03169052565b5060a08301516127c860a08401826001600160a01b03169052565b5060c083015160c083015260e083015160e0830152610100808401518184015250610120808401516127fd8285018215159052565b5050610140838101519083015261016092830151929091019190915290565b60006020828403121561282e57600080fd5b813561144f816123c7565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8082018082111561085a5761085a612839565b808202811582820484141761085a5761085a612839565b6000826128c8577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b8181038181111561085a5761085a612839565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361291157612911612839565b5060010190565b60005b8381101561293357818101518382015260200161291b565b50506000910152565b60e08152600088518060e084015261010061295d8282860160208e01612918565b63ffffffff9990991660208401526001600160a01b039788166040840152959096166060820152608081019390935260a0830191909152151560c0820152601f9091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0160190910192915050565b80516123e7816125b9565b80516123e7816123c7565b80516123e7816125d6565b60006101808284031215612a0057600080fd5b612a086124a3565b612a11836129cc565b8152612a1f602084016129cc565b6020820152612a30604084016129d7565b6040820152612a41606084016129d7565b6060820152612a52608084016129d7565b6080820152612a6360a084016129d7565b60a082015260c083015160c082015260e083015160e0820152610100808401518183015250610120612a968185016129e2565b908201526101408381015190820152610160928301519281019290925250919050565b600060208284031215612acb57600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600060208284031215612b1357600080fd5b815161144f816125d6565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b60008251612b5f818460208701612918565b919091019291505056fea264697066735822122016de8ab3fbbf98dc7b8aefd2c1101a7e56e21e4cb0d5d346e4c36bff34ea738264736f6c63430008140033", } // FastBridgeABI is the input ABI used to generate the binding from. @@ -7308,7 +7308,7 @@ var FastBridgeMockMetaData = &bind.MetaData{ "01ffc9a7": "supportsInterface(bytes4)", "06f333f2": "sweepProtocolFees(address,address)", }, - Bin: "0x60a06040523480156200001157600080fd5b506040516200254e3803806200254e833981016040819052620000349162000194565b80620000426000826200004f565b50504360805250620001bf565b6000806200005e84846200008c565b90508015620000835760008481526001602052604090206200008190846200013a565b505b90505b92915050565b6000828152602081815260408083206001600160a01b038516845290915281205460ff1662000131576000838152602081815260408083206001600160a01b03861684529091529020805460ff19166001179055620000e83390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a450600162000086565b50600062000086565b600062000083836001600160a01b0384166000818152600183016020526040812054620001315750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915562000086565b600060208284031215620001a757600080fd5b81516001600160a01b03811681146200008357600080fd5b608051612373620001db600039600061053201526123736000f3fe6080604052600436106102345760003560e01c8063926d7d7f11610138578063b13aa2d6116100b0578063ca15c8731161007f578063d547741f11610064578063d547741f146106dd578063dcf844a7146106fd578063e00a83e01461072a57600080fd5b8063ca15c87314610689578063ccc57490146106a957600080fd5b8063b13aa2d614610612578063b250fe6b14610632578063bf333f2c14610652578063c72870cc1461066957600080fd5b8063ac11fb1a11610107578063add98c70116100ec578063add98c70146105c1578063aedf009d146105dc578063affed0e0146105fc57600080fd5b8063ac11fb1a14610574578063acaebbf1146105a157600080fd5b8063926d7d7f146104d7578063a217fddf1461050b578063a3ec191a14610520578063aa9641ab1461055457600080fd5b806345851694116101cb57806385ad903d1161019a5780638f0d6f171161017f5780638f0d6f17146104335780639010d07c1461044157806391d148541461048657600080fd5b806385ad903d146103eb578063886d36ff1461041857600080fd5b8063458516941461037857806358f85880146103865780635960ccf21461039c5780635eb7d946146103d057600080fd5b8063248a9ca311610207578063248a9ca3146102e85780632f2ff15d1461031857806336568abe1461033857806341fcb6121461035857600080fd5b806301ffc9a71461023957806303ed0ee51461026e57806306f333f2146102b05780630f5f6ed7146102d2575b600080fd5b34801561024557600080fd5b5061025961025436600461195d565b610740565b60405190151581526020015b60405180910390f35b34801561027a57600080fd5b506102a27f043c983c49d46f0e102151eaf8085d4a2e6571d5df2d47b013f39bddfd4a639d81565b604051908152602001610265565b3480156102bc57600080fd5b506102d06102cb3660046119d1565b61079c565b005b3480156102de57600080fd5b506102a261271081565b3480156102f457600080fd5b506102a2610303366004611a0a565b60009081526020819052604090206001015490565b34801561032457600080fd5b506102d0610333366004611a23565b61088a565b34801561034457600080fd5b506102d0610353366004611a23565b6108b5565b34801561036457600080fd5b506102d0610373366004611b70565b61090e565b6102d0610373366004611c90565b34801561039257600080fd5b506102a260025481565b3480156103a857600080fd5b506102a27fdb9556138406326f00296e13ea2ad7db24ba82381212d816b1a40c23b466b32781565b3480156103dc57600080fd5b506102d0610373366004611cad565b3480156103f757600080fd5b5061040b610406366004611cea565b610975565b6040516102659190611d79565b34801561042457600080fd5b506102d0610373366004611d8c565b6102d0610373366004611cad565b34801561044d57600080fd5b5061046161045c366004611dd1565b610b25565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610265565b34801561049257600080fd5b506102596104a1366004611a23565b60009182526020828152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b3480156104e357600080fd5b506102a27fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc481565b34801561051757600080fd5b506102a2600081565b34801561052c57600080fd5b506102a27f000000000000000000000000000000000000000000000000000000000000000081565b34801561056057600080fd5b5061025961056f366004611a23565b610b44565b34801561058057600080fd5b5061059461058f366004611cad565b610ba9565b6040516102659190611df3565b3480156105ad57600080fd5b506102d06105bc366004611f0d565b610c1c565b3480156105cd57600080fd5b506102d0610373366004611a0a565b3480156105e857600080fd5b506102d06105f7366004611f4d565b610dec565b34801561060857600080fd5b506102a260055481565b34801561061e57600080fd5b506102d061062d366004611a0a565b610e77565b34801561063e57600080fd5b506102d061064d366004611a0a565b610f54565b34801561065e57600080fd5b506102a2620f424081565b34801561067557600080fd5b506102d0610684366004611fa6565b610fbc565b34801561069557600080fd5b506102a26106a4366004611a0a565b611042565b3480156106b557600080fd5b506102a27f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5581565b3480156106e957600080fd5b506102d06106f8366004611a23565b611059565b34801561070957600080fd5b506102a261071836600461203e565b60036020526000908152604090205481565b34801561073657600080fd5b506102a260045481565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f5a05180f00000000000000000000000000000000000000000000000000000000148061079657506107968261107e565b92915050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f556107c681611115565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260036020526040812054908190036107fa5750505050565b73ffffffffffffffffffffffffffffffffffffffff841660008181526003602052604081205561082b908483611122565b6040805173ffffffffffffffffffffffffffffffffffffffff8087168252851660208201529081018290527f244e51bc38c1452fa8aaf487bcb4bca36c2baa3a5fbdb776b1eabd8dc6d277cd9060600160405180910390a1505b505050565b6000828152602081905260409020600101546108a581611115565b6108af8383611279565b50505050565b73ffffffffffffffffffffffffffffffffffffffff81163314610904576040517f6697b23200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61088582826112ae565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f6e6f7420696d706c656d656e746564000000000000000000000000000000000060448201526064015b60405180910390fd5b60608160048111156109895761098961205b565b6000036109c957505060408051808201909152600481527f4e554c4c00000000000000000000000000000000000000000000000000000000602082015290565b8160048111156109db576109db61205b565b600103610a1b57505060408051808201909152600981527f5245515545535445440000000000000000000000000000000000000000000000602082015290565b816004811115610a2d57610a2d61205b565b600203610a6d57505060408051808201909152600e81527f52454c415945525f50524f564544000000000000000000000000000000000000602082015290565b816004811115610a7f57610a7f61205b565b600303610abf57505060408051808201909152600f81527f52454c415945525f434c41494d45440000000000000000000000000000000000602082015290565b816004811115610ad157610ad161205b565b600403610b1157505060408051808201909152600881527f524546554e444544000000000000000000000000000000000000000000000000602082015290565b505060408051602081019091526000815290565b6000828152600160205260408120610b3d90836112db565b9392505050565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f6e6f7420696d706c656d656e7465640000000000000000000000000000000000604482015260009060640161096c565b604080516101808101825260008082526020808301829052928201819052606082018190526080820181905260a0820181905260c0820181905260e082018190526101008201819052610120820181905261014082018190526101608201528251909161079691840181019084016120ab565b6000620f42406002548360a00151610c3491906121a6565b610c3e91906121bd565b9050808260a001818151610c5291906121f8565b9150818152505060006040518061018001604052804663ffffffff168152602001846000015163ffffffff168152602001846020015173ffffffffffffffffffffffffffffffffffffffff168152602001846040015173ffffffffffffffffffffffffffffffffffffffff168152602001846060015173ffffffffffffffffffffffffffffffffffffffff168152602001846080015173ffffffffffffffffffffffffffffffffffffffff1681526020018460a0015181526020018460c0015181526020018381526020018460e0015115158152602001846101000151815260200160056000815480929190610d479061220b565b909155509052604051610d5d9190602001611df3565b6040516020818303038152906040529050826020015173ffffffffffffffffffffffffffffffffffffffff16857f120ea0364f36cdac7983bcfdd55270ca09d7f9b314a2ebc425a3b01ab1d6403a838660000151876060015188608001518960a001518a60c001518b60e00151604051610ddd9796959493929190612243565b60405180910390a35050505050565b6000610df782610ba9565b9050806040015173ffffffffffffffffffffffffffffffffffffffff16847f120ea0364f36cdac7983bcfdd55270ca09d7f9b314a2ebc425a3b01ab1d6403a84846020015185608001518660a001518760c001518860e00151896101200151604051610e699796959493929190612243565b60405180910390a350505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f55610ea181611115565b612710821115610f0d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f6e657746656552617465203e206d617800000000000000000000000000000000604482015260640161096c565b600280549083905560408051828152602081018590527f14914da2bf76024616fbe1859783fcd4dbddcb179b1f3a854949fbf920dcb95791015b60405180910390a1505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f55610f7e81611115565b600480549083905560408051828152602081018590527f5cf09b12f3f56b4c564d51b25b40360af6d795198adb61ae0806a36c294323fa9101610f47565b6040805163ffffffff8816815273ffffffffffffffffffffffffffffffffffffffff878116602083015286811682840152606082018690526080820185905260a082018490529151898316928b16918c917ff8ae392d784b1ea5e8881bfa586d81abf07ef4f1e2fc75f7fe51c90f05199a5c9181900360c00190a4505050505050505050565b6000818152600160205260408120610796906112e7565b60008281526020819052604090206001015461107481611115565b6108af83836112ae565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061079657507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614610796565b61111f81336112f1565b50565b3073ffffffffffffffffffffffffffffffffffffffff83160361114457505050565b8060000361115157505050565b7fffffffffffffffffffffffff111111111111111111111111111111111111111273ffffffffffffffffffffffffffffffffffffffff8416016112585760008273ffffffffffffffffffffffffffffffffffffffff168260405160006040518083038185875af1925050503d80600081146111e8576040519150601f19603f3d011682016040523d82523d6000602084013e6111ed565b606091505b50509050806108af576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f455448207472616e73666572206661696c656400000000000000000000000000604482015260640161096c565b61088573ffffffffffffffffffffffffffffffffffffffff8416838361137b565b6000806112868484611408565b90508015610b3d5760008481526001602052604090206112a69084611504565b509392505050565b6000806112bb8484611526565b90508015610b3d5760008481526001602052604090206112a690846115e1565b6000610b3d8383611603565b6000610796825490565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16611377576040517fe2517d3f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff821660048201526024810183905260440161096c565b5050565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb0000000000000000000000000000000000000000000000000000000017905261088590849061162d565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915281205460ff166114fc5760008381526020818152604080832073ffffffffffffffffffffffffffffffffffffffff86168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905561149a3390565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a4506001610796565b506000610796565b6000610b3d8373ffffffffffffffffffffffffffffffffffffffff84166116c3565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915281205460ff16156114fc5760008381526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8616808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a4506001610796565b6000610b3d8373ffffffffffffffffffffffffffffffffffffffff841661170a565b600082600001828154811061161a5761161a6122a6565b9060005260206000200154905092915050565b600061164f73ffffffffffffffffffffffffffffffffffffffff8416836117fd565b9050805160001415801561167457508080602001905181019061167291906122d5565b155b15610885576040517f5274afe700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8416600482015260240161096c565b60008181526001830160205260408120546114fc57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610796565b600081815260018301602052604081205480156117f357600061172e6001836121f8565b8554909150600090611742906001906121f8565b90508082146117a7576000866000018281548110611762576117626122a6565b9060005260206000200154905080876000018481548110611785576117856122a6565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806117b8576117b86122f2565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610796565b6000915050610796565b6060610b3d83836000846000808573ffffffffffffffffffffffffffffffffffffffff1684866040516118309190612321565b60006040518083038185875af1925050503d806000811461186d576040519150601f19603f3d011682016040523d82523d6000602084013e611872565b606091505b509150915061188286838361188c565b9695505050505050565b6060826118a15761189c8261191b565b610b3d565b81511580156118c5575073ffffffffffffffffffffffffffffffffffffffff84163b155b15611914576040517f9996b31500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8516600482015260240161096c565b5080610b3d565b80511561192b5780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006020828403121561196f57600080fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114610b3d57600080fd5b73ffffffffffffffffffffffffffffffffffffffff8116811461111f57600080fd5b80356119cc8161199f565b919050565b600080604083850312156119e457600080fd5b82356119ef8161199f565b915060208301356119ff8161199f565b809150509250929050565b600060208284031215611a1c57600080fd5b5035919050565b60008060408385031215611a3657600080fd5b8235915060208301356119ff8161199f565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051610120810167ffffffffffffffff81118282101715611a9b57611a9b611a48565b60405290565b604051610180810167ffffffffffffffff81118282101715611a9b57611a9b611a48565b600082601f830112611ad657600080fd5b813567ffffffffffffffff80821115611af157611af1611a48565b604051601f83017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908282118183101715611b3757611b37611a48565b81604052838152866020858801011115611b5057600080fd5b836020870160208301376000602085830101528094505050505092915050565b60008060408385031215611b8357600080fd5b823567ffffffffffffffff811115611b9a57600080fd5b611ba685828601611ac5565b92505060208301356119ff8161199f565b63ffffffff8116811461111f57600080fd5b80356119cc81611bb7565b801515811461111f57600080fd5b80356119cc81611bd4565b60006101208284031215611c0057600080fd5b611c08611a77565b9050611c1382611bc9565b8152611c21602083016119c1565b6020820152611c32604083016119c1565b6040820152611c43606083016119c1565b6060820152611c54608083016119c1565b608082015260a082013560a082015260c082013560c0820152611c7960e08301611be2565b60e082015261010080830135818301525092915050565b60006101208284031215611ca357600080fd5b610b3d8383611bed565b600060208284031215611cbf57600080fd5b813567ffffffffffffffff811115611cd657600080fd5b611ce284828501611ac5565b949350505050565b600060208284031215611cfc57600080fd5b813560058110610b3d57600080fd5b60005b83811015611d26578181015183820152602001611d0e565b50506000910152565b60008151808452611d47816020860160208601611d0b565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b602081526000610b3d6020830184611d2f565b60008060408385031215611d9f57600080fd5b823567ffffffffffffffff811115611db657600080fd5b611dc285828601611ac5565b95602094909401359450505050565b60008060408385031215611de457600080fd5b50508035926020909101359150565b815163ffffffff16815261018081016020830151611e19602084018263ffffffff169052565b506040830151611e41604084018273ffffffffffffffffffffffffffffffffffffffff169052565b506060830151611e69606084018273ffffffffffffffffffffffffffffffffffffffff169052565b506080830151611e91608084018273ffffffffffffffffffffffffffffffffffffffff169052565b5060a0830151611eb960a084018273ffffffffffffffffffffffffffffffffffffffff169052565b5060c083015160c083015260e083015160e083015261010080840151818401525061012080840151611eee8285018215159052565b5050610140838101519083015261016092830151929091019190915290565b60008060006101608486031215611f2357600080fd5b833592506020840135611f358161199f565b9150611f448560408601611bed565b90509250925092565b600080600060608486031215611f6257600080fd5b833592506020840135611f748161199f565b9150604084013567ffffffffffffffff811115611f9057600080fd5b611f9c86828701611ac5565b9150509250925092565b60008060008060008060008060006101208a8c031215611fc557600080fd5b8935985060208a0135611fd78161199f565b975060408a0135611fe78161199f565b965060608a0135611ff781611bb7565b955060808a01356120078161199f565b945060a08a01356120178161199f565b8094505060c08a0135925060e08a013591506101008a013590509295985092959850929598565b60006020828403121561205057600080fd5b8135610b3d8161199f565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b80516119cc81611bb7565b80516119cc8161199f565b80516119cc81611bd4565b600061018082840312156120be57600080fd5b6120c6611aa1565b6120cf8361208a565b81526120dd6020840161208a565b60208201526120ee60408401612095565b60408201526120ff60608401612095565b606082015261211060808401612095565b608082015261212160a08401612095565b60a082015260c083015160c082015260e083015160e08201526101008084015181830152506101206121548185016120a0565b908201526101408381015190820152610160928301519281019290925250919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b808202811582820484141761079657610796612177565b6000826121f3577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b8181038181111561079657610796612177565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361223c5761223c612177565b5060010190565b60e08152600061225660e083018a611d2f565b63ffffffff9890981660208301525073ffffffffffffffffffffffffffffffffffffffff9586166040820152939094166060840152608083019190915260a082015290151560c090910152919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000602082840312156122e757600080fd5b8151610b3d81611bd4565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b60008251612333818460208701611d0b565b919091019291505056fea264697066735822122033e24b6f39317f0eea840aab6ee071e2b648a79ea7849efa62c112cddf55815d64736f6c63430008140033", + Bin: "0x60a06040523480156200001157600080fd5b506040516200254e3803806200254e833981016040819052620000349162000194565b80620000426000826200004f565b50504360805250620001bf565b6000806200005e84846200008c565b90508015620000835760008481526001602052604090206200008190846200013a565b505b90505b92915050565b6000828152602081815260408083206001600160a01b038516845290915281205460ff1662000131576000838152602081815260408083206001600160a01b03861684529091529020805460ff19166001179055620000e83390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a450600162000086565b50600062000086565b600062000083836001600160a01b0384166000818152600183016020526040812054620001315750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915562000086565b600060208284031215620001a757600080fd5b81516001600160a01b03811681146200008357600080fd5b608051612373620001db600039600061053201526123736000f3fe6080604052600436106102345760003560e01c8063926d7d7f11610138578063b13aa2d6116100b0578063ca15c8731161007f578063d547741f11610064578063d547741f146106dd578063dcf844a7146106fd578063e00a83e01461072a57600080fd5b8063ca15c87314610689578063ccc57490146106a957600080fd5b8063b13aa2d614610612578063b250fe6b14610632578063bf333f2c14610652578063c72870cc1461066957600080fd5b8063ac11fb1a11610107578063add98c70116100ec578063add98c70146105c1578063aedf009d146105dc578063affed0e0146105fc57600080fd5b8063ac11fb1a14610574578063acaebbf1146105a157600080fd5b8063926d7d7f146104d7578063a217fddf1461050b578063a3ec191a14610520578063aa9641ab1461055457600080fd5b806345851694116101cb57806385ad903d1161019a5780638f0d6f171161017f5780638f0d6f17146104335780639010d07c1461044157806391d148541461048657600080fd5b806385ad903d146103eb578063886d36ff1461041857600080fd5b8063458516941461037857806358f85880146103865780635960ccf21461039c5780635eb7d946146103d057600080fd5b8063248a9ca311610207578063248a9ca3146102e85780632f2ff15d1461031857806336568abe1461033857806341fcb6121461035857600080fd5b806301ffc9a71461023957806303ed0ee51461026e57806306f333f2146102b05780630f5f6ed7146102d2575b600080fd5b34801561024557600080fd5b5061025961025436600461195d565b610740565b60405190151581526020015b60405180910390f35b34801561027a57600080fd5b506102a27f043c983c49d46f0e102151eaf8085d4a2e6571d5df2d47b013f39bddfd4a639d81565b604051908152602001610265565b3480156102bc57600080fd5b506102d06102cb3660046119d1565b61079c565b005b3480156102de57600080fd5b506102a261271081565b3480156102f457600080fd5b506102a2610303366004611a0a565b60009081526020819052604090206001015490565b34801561032457600080fd5b506102d0610333366004611a23565b61088a565b34801561034457600080fd5b506102d0610353366004611a23565b6108b5565b34801561036457600080fd5b506102d0610373366004611b70565b61090e565b6102d0610373366004611c90565b34801561039257600080fd5b506102a260025481565b3480156103a857600080fd5b506102a27fdb9556138406326f00296e13ea2ad7db24ba82381212d816b1a40c23b466b32781565b3480156103dc57600080fd5b506102d0610373366004611cad565b3480156103f757600080fd5b5061040b610406366004611cea565b610975565b6040516102659190611d79565b34801561042457600080fd5b506102d0610373366004611d8c565b6102d0610373366004611cad565b34801561044d57600080fd5b5061046161045c366004611dd1565b610b25565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610265565b34801561049257600080fd5b506102596104a1366004611a23565b60009182526020828152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b3480156104e357600080fd5b506102a27fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc481565b34801561051757600080fd5b506102a2600081565b34801561052c57600080fd5b506102a27f000000000000000000000000000000000000000000000000000000000000000081565b34801561056057600080fd5b5061025961056f366004611a23565b610b44565b34801561058057600080fd5b5061059461058f366004611cad565b610ba9565b6040516102659190611df3565b3480156105ad57600080fd5b506102d06105bc366004611f0d565b610c1c565b3480156105cd57600080fd5b506102d0610373366004611a0a565b3480156105e857600080fd5b506102d06105f7366004611f4d565b610dec565b34801561060857600080fd5b506102a260055481565b34801561061e57600080fd5b506102d061062d366004611a0a565b610e77565b34801561063e57600080fd5b506102d061064d366004611a0a565b610f54565b34801561065e57600080fd5b506102a2620f424081565b34801561067557600080fd5b506102d0610684366004611fa6565b610fbc565b34801561069557600080fd5b506102a26106a4366004611a0a565b611042565b3480156106b557600080fd5b506102a27f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5581565b3480156106e957600080fd5b506102d06106f8366004611a23565b611059565b34801561070957600080fd5b506102a261071836600461203e565b60036020526000908152604090205481565b34801561073657600080fd5b506102a260045481565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f5a05180f00000000000000000000000000000000000000000000000000000000148061079657506107968261107e565b92915050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f556107c681611115565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260036020526040812054908190036107fa5750505050565b73ffffffffffffffffffffffffffffffffffffffff841660008181526003602052604081205561082b908483611122565b6040805173ffffffffffffffffffffffffffffffffffffffff8087168252851660208201529081018290527f244e51bc38c1452fa8aaf487bcb4bca36c2baa3a5fbdb776b1eabd8dc6d277cd9060600160405180910390a1505b505050565b6000828152602081905260409020600101546108a581611115565b6108af8383611279565b50505050565b73ffffffffffffffffffffffffffffffffffffffff81163314610904576040517f6697b23200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61088582826112ae565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f6e6f7420696d706c656d656e746564000000000000000000000000000000000060448201526064015b60405180910390fd5b60608160048111156109895761098961205b565b6000036109c957505060408051808201909152600481527f4e554c4c00000000000000000000000000000000000000000000000000000000602082015290565b8160048111156109db576109db61205b565b600103610a1b57505060408051808201909152600981527f5245515545535445440000000000000000000000000000000000000000000000602082015290565b816004811115610a2d57610a2d61205b565b600203610a6d57505060408051808201909152600e81527f52454c415945525f50524f564544000000000000000000000000000000000000602082015290565b816004811115610a7f57610a7f61205b565b600303610abf57505060408051808201909152600f81527f52454c415945525f434c41494d45440000000000000000000000000000000000602082015290565b816004811115610ad157610ad161205b565b600403610b1157505060408051808201909152600881527f524546554e444544000000000000000000000000000000000000000000000000602082015290565b505060408051602081019091526000815290565b6000828152600160205260408120610b3d90836112db565b9392505050565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f6e6f7420696d706c656d656e7465640000000000000000000000000000000000604482015260009060640161096c565b604080516101808101825260008082526020808301829052928201819052606082018190526080820181905260a0820181905260c0820181905260e082018190526101008201819052610120820181905261014082018190526101608201528251909161079691840181019084016120ab565b6000620f42406002548360a00151610c3491906121a6565b610c3e91906121bd565b9050808260a001818151610c5291906121f8565b9150818152505060006040518061018001604052804663ffffffff168152602001846000015163ffffffff168152602001846020015173ffffffffffffffffffffffffffffffffffffffff168152602001846040015173ffffffffffffffffffffffffffffffffffffffff168152602001846060015173ffffffffffffffffffffffffffffffffffffffff168152602001846080015173ffffffffffffffffffffffffffffffffffffffff1681526020018460a0015181526020018460c0015181526020018381526020018460e0015115158152602001846101000151815260200160056000815480929190610d479061220b565b909155509052604051610d5d9190602001611df3565b6040516020818303038152906040529050826020015173ffffffffffffffffffffffffffffffffffffffff16857f120ea0364f36cdac7983bcfdd55270ca09d7f9b314a2ebc425a3b01ab1d6403a838660000151876060015188608001518960a001518a60c001518b60e00151604051610ddd9796959493929190612243565b60405180910390a35050505050565b6000610df782610ba9565b9050806040015173ffffffffffffffffffffffffffffffffffffffff16847f120ea0364f36cdac7983bcfdd55270ca09d7f9b314a2ebc425a3b01ab1d6403a84846020015185608001518660a001518760c001518860e00151896101200151604051610e699796959493929190612243565b60405180910390a350505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f55610ea181611115565b612710821115610f0d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f6e657746656552617465203e206d617800000000000000000000000000000000604482015260640161096c565b600280549083905560408051828152602081018590527f14914da2bf76024616fbe1859783fcd4dbddcb179b1f3a854949fbf920dcb95791015b60405180910390a1505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f55610f7e81611115565b600480549083905560408051828152602081018590527f5cf09b12f3f56b4c564d51b25b40360af6d795198adb61ae0806a36c294323fa9101610f47565b6040805163ffffffff8816815273ffffffffffffffffffffffffffffffffffffffff878116602083015286811682840152606082018690526080820185905260a082018490529151898316928b16918c917ff8ae392d784b1ea5e8881bfa586d81abf07ef4f1e2fc75f7fe51c90f05199a5c9181900360c00190a4505050505050505050565b6000818152600160205260408120610796906112e7565b60008281526020819052604090206001015461107481611115565b6108af83836112ae565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061079657507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614610796565b61111f81336112f1565b50565b3073ffffffffffffffffffffffffffffffffffffffff83160361114457505050565b8060000361115157505050565b7fffffffffffffffffffffffff111111111111111111111111111111111111111273ffffffffffffffffffffffffffffffffffffffff8416016112585760008273ffffffffffffffffffffffffffffffffffffffff168260405160006040518083038185875af1925050503d80600081146111e8576040519150601f19603f3d011682016040523d82523d6000602084013e6111ed565b606091505b50509050806108af576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f455448207472616e73666572206661696c656400000000000000000000000000604482015260640161096c565b61088573ffffffffffffffffffffffffffffffffffffffff8416838361137b565b6000806112868484611408565b90508015610b3d5760008481526001602052604090206112a69084611504565b509392505050565b6000806112bb8484611526565b90508015610b3d5760008481526001602052604090206112a690846115e1565b6000610b3d8383611603565b6000610796825490565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16611377576040517fe2517d3f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff821660048201526024810183905260440161096c565b5050565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb0000000000000000000000000000000000000000000000000000000017905261088590849061162d565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915281205460ff166114fc5760008381526020818152604080832073ffffffffffffffffffffffffffffffffffffffff86168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905561149a3390565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a4506001610796565b506000610796565b6000610b3d8373ffffffffffffffffffffffffffffffffffffffff84166116c3565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915281205460ff16156114fc5760008381526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8616808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a4506001610796565b6000610b3d8373ffffffffffffffffffffffffffffffffffffffff841661170a565b600082600001828154811061161a5761161a6122a6565b9060005260206000200154905092915050565b600061164f73ffffffffffffffffffffffffffffffffffffffff8416836117fd565b9050805160001415801561167457508080602001905181019061167291906122d5565b155b15610885576040517f5274afe700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8416600482015260240161096c565b60008181526001830160205260408120546114fc57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610796565b600081815260018301602052604081205480156117f357600061172e6001836121f8565b8554909150600090611742906001906121f8565b90508082146117a7576000866000018281548110611762576117626122a6565b9060005260206000200154905080876000018481548110611785576117856122a6565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806117b8576117b86122f2565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610796565b6000915050610796565b6060610b3d83836000846000808573ffffffffffffffffffffffffffffffffffffffff1684866040516118309190612321565b60006040518083038185875af1925050503d806000811461186d576040519150601f19603f3d011682016040523d82523d6000602084013e611872565b606091505b509150915061188286838361188c565b9695505050505050565b6060826118a15761189c8261191b565b610b3d565b81511580156118c5575073ffffffffffffffffffffffffffffffffffffffff84163b155b15611914576040517f9996b31500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8516600482015260240161096c565b5080610b3d565b80511561192b5780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006020828403121561196f57600080fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114610b3d57600080fd5b73ffffffffffffffffffffffffffffffffffffffff8116811461111f57600080fd5b80356119cc8161199f565b919050565b600080604083850312156119e457600080fd5b82356119ef8161199f565b915060208301356119ff8161199f565b809150509250929050565b600060208284031215611a1c57600080fd5b5035919050565b60008060408385031215611a3657600080fd5b8235915060208301356119ff8161199f565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051610120810167ffffffffffffffff81118282101715611a9b57611a9b611a48565b60405290565b604051610180810167ffffffffffffffff81118282101715611a9b57611a9b611a48565b600082601f830112611ad657600080fd5b813567ffffffffffffffff80821115611af157611af1611a48565b604051601f83017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908282118183101715611b3757611b37611a48565b81604052838152866020858801011115611b5057600080fd5b836020870160208301376000602085830101528094505050505092915050565b60008060408385031215611b8357600080fd5b823567ffffffffffffffff811115611b9a57600080fd5b611ba685828601611ac5565b92505060208301356119ff8161199f565b63ffffffff8116811461111f57600080fd5b80356119cc81611bb7565b801515811461111f57600080fd5b80356119cc81611bd4565b60006101208284031215611c0057600080fd5b611c08611a77565b9050611c1382611bc9565b8152611c21602083016119c1565b6020820152611c32604083016119c1565b6040820152611c43606083016119c1565b6060820152611c54608083016119c1565b608082015260a082013560a082015260c082013560c0820152611c7960e08301611be2565b60e082015261010080830135818301525092915050565b60006101208284031215611ca357600080fd5b610b3d8383611bed565b600060208284031215611cbf57600080fd5b813567ffffffffffffffff811115611cd657600080fd5b611ce284828501611ac5565b949350505050565b600060208284031215611cfc57600080fd5b813560058110610b3d57600080fd5b60005b83811015611d26578181015183820152602001611d0e565b50506000910152565b60008151808452611d47816020860160208601611d0b565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b602081526000610b3d6020830184611d2f565b60008060408385031215611d9f57600080fd5b823567ffffffffffffffff811115611db657600080fd5b611dc285828601611ac5565b95602094909401359450505050565b60008060408385031215611de457600080fd5b50508035926020909101359150565b815163ffffffff16815261018081016020830151611e19602084018263ffffffff169052565b506040830151611e41604084018273ffffffffffffffffffffffffffffffffffffffff169052565b506060830151611e69606084018273ffffffffffffffffffffffffffffffffffffffff169052565b506080830151611e91608084018273ffffffffffffffffffffffffffffffffffffffff169052565b5060a0830151611eb960a084018273ffffffffffffffffffffffffffffffffffffffff169052565b5060c083015160c083015260e083015160e083015261010080840151818401525061012080840151611eee8285018215159052565b5050610140838101519083015261016092830151929091019190915290565b60008060006101608486031215611f2357600080fd5b833592506020840135611f358161199f565b9150611f448560408601611bed565b90509250925092565b600080600060608486031215611f6257600080fd5b833592506020840135611f748161199f565b9150604084013567ffffffffffffffff811115611f9057600080fd5b611f9c86828701611ac5565b9150509250925092565b60008060008060008060008060006101208a8c031215611fc557600080fd5b8935985060208a0135611fd78161199f565b975060408a0135611fe78161199f565b965060608a0135611ff781611bb7565b955060808a01356120078161199f565b945060a08a01356120178161199f565b8094505060c08a0135925060e08a013591506101008a013590509295985092959850929598565b60006020828403121561205057600080fd5b8135610b3d8161199f565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b80516119cc81611bb7565b80516119cc8161199f565b80516119cc81611bd4565b600061018082840312156120be57600080fd5b6120c6611aa1565b6120cf8361208a565b81526120dd6020840161208a565b60208201526120ee60408401612095565b60408201526120ff60608401612095565b606082015261211060808401612095565b608082015261212160a08401612095565b60a082015260c083015160c082015260e083015160e08201526101008084015181830152506101206121548185016120a0565b908201526101408381015190820152610160928301519281019290925250919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b808202811582820484141761079657610796612177565b6000826121f3577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b8181038181111561079657610796612177565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361223c5761223c612177565b5060010190565b60e08152600061225660e083018a611d2f565b63ffffffff9890981660208301525073ffffffffffffffffffffffffffffffffffffffff9586166040820152939094166060840152608083019190915260a082015290151560c090910152919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000602082840312156122e757600080fd5b8151610b3d81611bd4565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b60008251612333818460208701611d0b565b919091019291505056fea26469706673582212201d7ae4ad64395f4be873cab646bc0ae5107f20500d3986f2482df1a500db3bc664736f6c63430008140033", } // FastBridgeMockABI is the input ABI used to generate the binding from. @@ -14871,7 +14871,7 @@ func (_IFastBridge *IFastBridgeFilterer) ParseBridgeRequested(log types.Log) (*I // 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: "0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220c51b222f1984df769e9e9836d8b17da22ec98bfb801c9728e848da279f2ef33e64736f6c63430008140033", + Bin: "0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220be43a1ff38e79e6a2033a41cc8a252d3eb127b7334d123eac31b1ff4a05b94a464736f6c63430008140033", } // SafeERC20ABI is the input ABI used to generate the binding from. @@ -15044,7 +15044,7 @@ func (_SafeERC20 *SafeERC20TransactorRaw) Transact(opts *bind.TransactOpts, meth // UniversalTokenLibMetaData contains all meta data concerning the UniversalTokenLib contract. var UniversalTokenLibMetaData = &bind.MetaData{ ABI: "[]", - Bin: "0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220091110fff57e33a0f49e1afe323fd28b79984a963c9cb8afaca914399291e9a964736f6c63430008140033", + Bin: "0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220606dedacc186512fbfa88e9a001df8533c52e60258d832c4081dc4e5c1aba09a64736f6c63430008140033", } // UniversalTokenLibABI is the input ABI used to generate the binding from. diff --git a/services/rfq/contracts/testcontracts/fastbridgemock/fastbridgemock.contractinfo.json b/services/rfq/contracts/testcontracts/fastbridgemock/fastbridgemock.contractinfo.json index 778e6fee04..401f881dd8 100644 --- a/services/rfq/contracts/testcontracts/fastbridgemock/fastbridgemock.contractinfo.json +++ b/services/rfq/contracts/testcontracts/fastbridgemock/fastbridgemock.contractinfo.json @@ -1 +1 @@ -{"solidity/FastBridgeMock.sol:AccessControl":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.20 ^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 pure 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/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// lib/openzeppelin-contracts/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 ERC-165 detection.\n */\ninterface IAccessControl {\n /**\n * @dev The `account` is missing a role.\n */\n error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);\n\n /**\n * @dev The caller of a function is not the expected one.\n *\n * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.\n */\n error AccessControlBadConfirmation();\n\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted 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// lib/openzeppelin-contracts/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 ERC-20 standard as defined in the ERC.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the value of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the value of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 value) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n * caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 value) external returns (bool);\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\n * allowance mechanism. `value` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n\n// lib/openzeppelin-contracts/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 ERC-20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[ERC-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC-20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n *\n * ==== Security Considerations\n *\n * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\n * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\n * considered as an intention to spend the allowance in any specific way. The second is that because permits have\n * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\n * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\n * generally recommended is:\n *\n * ```solidity\n * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\n * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\n * doThing(..., value);\n * }\n *\n * function doThing(..., uint256 value) public {\n * token.safeTransferFrom(msg.sender, address(this), value);\n * ...\n * }\n * ```\n *\n * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\n * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\n * {SafeERC20-safeTransferFrom}).\n *\n * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\n * contracts should have entry points that don't rely on permit.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also 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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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 ERC-165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[ERC].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n\n// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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 ERC-165 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// lib/openzeppelin-contracts/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 ERC-165 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// lib/openzeppelin-contracts/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 ERC-20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n /**\n * @dev An operation with an ERC-20 token failed.\n */\n error SafeERC20FailedOperation(address token);\n\n /**\n * @dev Indicates a failed `decreaseAllowance` request.\n */\n error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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/FastBridge.sol\n\ncontract FastBridge is IFastBridge, Admin {\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 enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeStatus) public bridgeStatuses;\n /// @notice Proof of relayed bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeProof) public bridgeProofs;\n /// @notice Whether bridge has been relayed on destination chain\n mapping(bytes32 =\u003e bool) public bridgeRelays;\n\n /// @dev to prevent replays\n uint256 public nonce;\n // @dev 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 /// @notice Pulls a requested token from the user to the requested recipient.\n /// @dev Be careful of re-entrancy issues when msg.value \u003e 0 and recipient != address(this)\n function _pullToken(address recipient, address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token != UniversalTokenLib.ETH_ADDRESS) {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(recipient);\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, recipient, amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(recipient) - amountPulled;\n } else {\n // Otherwise, we need to check that ETH amount matches msg.value\n if (amount != msg.value) revert MsgValueIncorrect();\n // Transfer value to recipient if not this address\n if (recipient != address(this)) token.universalTransfer(recipient, amount);\n // We will forward msg.value in the external call later, if recipient is not this contract\n amountPulled = msg.value;\n }\n }\n\n /// @inheritdoc IFastBridge\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n // check bridge params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\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\n // transfer tokens to bridge contract\n // @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(address(this), 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 BridgeTransaction({\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 sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n\n // check haven't exceeded deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n\n // mark bridge transaction as relayed\n if (bridgeRelays[transactionId]) revert TransactionRelayed();\n bridgeRelays[transactionId] = true;\n\n // transfer tokens to recipient on destination chain and gas rebate if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n uint256 rebate = chainGasAmount;\n if (!transaction.sendChainGas) {\n // forward erc20\n rebate = 0;\n _pullToken(to, token, amount);\n } else if (token == UniversalTokenLib.ETH_ADDRESS) {\n // lump in gas rebate into amount in native gas token\n _pullToken(to, token, amount + rebate);\n } else {\n // forward erc20 then forward gas rebate in native gas token\n _pullToken(to, token, amount);\n _pullToken(to, UniversalTokenLib.ETH_ADDRESS, rebate);\n }\n\n emit BridgeRelayed(\n transactionId,\n msg.sender,\n to,\n transaction.originChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n rebate\n );\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n // update bridge tx status given proof provided\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = BridgeStatus.RELAYER_PROVED;\n bridgeProofs[transactionId] = BridgeProof({timestamp: uint96(block.timestamp), relayer: msg.sender}); // overflow ok\n\n emit BridgeProofProvided(transactionId, msg.sender, destTxHash);\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint96(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint96).max but\n /// proof.timestamp \u003c type(uint96).max via unchecked statement\n /// @param proof The bridge proof\n /// @return delta Time delta since proof submitted\n function _timeSince(BridgeProof memory proof) internal view returns (uint256 delta) {\n unchecked {\n delta = uint96(block.timestamp) - proof.timestamp;\n }\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != relayer) revert SenderIncorrect();\n return _timeSince(proof) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != msg.sender) revert SenderIncorrect();\n if (_timeSince(proof) \u003c= DISPUTE_PERIOD) revert DisputePeriodNotPassed();\n\n bridgeStatuses[transactionId] = 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, msg.sender, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeProofs[transactionId]) \u003e DISPUTE_PERIOD) revert DisputePeriodPassed();\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n delete bridgeProofs[transactionId];\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 BridgeTransaction memory transaction = getBridgeTransaction(request);\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 // set status to refunded if still in requested state\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = 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\n// test/FastBridgeMock.sol\n\ncontract FastBridgeMock is IFastBridge, Admin {\n // @dev 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 /// @dev to prevent replays\n uint256 public nonce;\n\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n // used for testing in go.\n // see: https://ethereum.stackexchange.com/questions/21155/how-to-expose-enum-in-solidity-contract\n // make sure to update fastbridge/status.go if this changes\n // or underliyng enum changes.\n //\n // TODO: a foundry test should be added to ensure this is always in sync.\n function getEnumKeyByValue(FastBridge.BridgeStatus keyValue) public pure returns (string memory) {\n if (FastBridge.BridgeStatus.NULL == keyValue) return \"NULL\";\n if (FastBridge.BridgeStatus.REQUESTED == keyValue) return \"REQUESTED\";\n if (FastBridge.BridgeStatus.RELAYER_PROVED == keyValue) return \"RELAYER_PROVED\";\n if (FastBridge.BridgeStatus.RELAYER_CLAIMED == keyValue) return \"RELAYER_CLAIMED\";\n if (FastBridge.BridgeStatus.REFUNDED == keyValue) return \"REFUNDED\";\n return \"\";\n }\n\n function mockBridgeRequest(bytes32 transactionId, address sender, BridgeParams memory params) external {\n uint256 originFeeAmount = (params.originAmount * protocolFeeRate) / FEE_BPS;\n params.originAmount -= originFeeAmount;\n\n bytes memory request = abi.encode(\n BridgeTransaction({\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: params.originAmount, // includes relayer fee\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n params.originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n function mockBridgeRequestRaw(bytes32 transactionId, address sender, bytes memory request) external {\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n emit BridgeRequested(\n transactionId,\n transaction.originSender,\n request,\n transaction.destChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n transaction.sendChainGas\n );\n }\n\n function mockBridgeRelayer(\n bytes32 transactionId,\n address relayer,\n address to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n )\n external\n {\n emit BridgeRelayed(\n transactionId, relayer, to, originChainId, originToken, destToken, originAmount, destAmount, chainGasAmount\n );\n }\n\n function bridge(BridgeParams memory params) external payable {\n revert(\"not implemented\");\n }\n\n function relay(bytes memory request) external payable {\n revert(\"not implemented\");\n }\n\n function prove(bytes memory request, bytes32 destTxHash) external {\n revert(\"not implemented\");\n }\n\n function canClaim(bytes32 transactionid, address relayer) external view returns (bool) {\n revert(\"not implemented\");\n }\n\n function claim(bytes memory request, address to) external {\n revert(\"not implemented\");\n }\n\n function dispute(bytes32 transactionId) external {\n revert(\"not implemented\");\n }\n\n function refund(bytes memory request) external {\n revert(\"not implemented\");\n }\n}\n","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","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.20+commit.a1b79de6\"},\"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/FastBridgeMock.sol\":\"AccessControl\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeMock.sol\":{\"keccak256\":\"0x4fff59c4cd271340f4a824126cbe4ebe7c8dc20639e268edf42ff873af31f862\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://4d33ef4f98d2abd98b4bbcb403b27495c37843b37000bea9f48e533078144d84\",\"dweb:/ipfs/QmTMkQhtNJPVgpxiLnEG45Ww7xfXHMEoVQ5JdbEbaFXwwS\"]}},\"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/FastBridgeMock.sol:AccessControlEnumerable":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.20 ^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 pure 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/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// lib/openzeppelin-contracts/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 ERC-165 detection.\n */\ninterface IAccessControl {\n /**\n * @dev The `account` is missing a role.\n */\n error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);\n\n /**\n * @dev The caller of a function is not the expected one.\n *\n * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.\n */\n error AccessControlBadConfirmation();\n\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted 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// lib/openzeppelin-contracts/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 ERC-20 standard as defined in the ERC.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the value of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the value of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 value) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n * caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 value) external returns (bool);\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\n * allowance mechanism. `value` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n\n// lib/openzeppelin-contracts/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 ERC-20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[ERC-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC-20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n *\n * ==== Security Considerations\n *\n * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\n * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\n * considered as an intention to spend the allowance in any specific way. The second is that because permits have\n * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\n * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\n * generally recommended is:\n *\n * ```solidity\n * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\n * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\n * doThing(..., value);\n * }\n *\n * function doThing(..., uint256 value) public {\n * token.safeTransferFrom(msg.sender, address(this), value);\n * ...\n * }\n * ```\n *\n * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\n * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\n * {SafeERC20-safeTransferFrom}).\n *\n * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\n * contracts should have entry points that don't rely on permit.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also 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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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 ERC-165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[ERC].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n\n// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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 ERC-165 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// lib/openzeppelin-contracts/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 ERC-165 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// lib/openzeppelin-contracts/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 ERC-20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n /**\n * @dev An operation with an ERC-20 token failed.\n */\n error SafeERC20FailedOperation(address token);\n\n /**\n * @dev Indicates a failed `decreaseAllowance` request.\n */\n error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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/FastBridge.sol\n\ncontract FastBridge is IFastBridge, Admin {\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 enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeStatus) public bridgeStatuses;\n /// @notice Proof of relayed bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeProof) public bridgeProofs;\n /// @notice Whether bridge has been relayed on destination chain\n mapping(bytes32 =\u003e bool) public bridgeRelays;\n\n /// @dev to prevent replays\n uint256 public nonce;\n // @dev 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 /// @notice Pulls a requested token from the user to the requested recipient.\n /// @dev Be careful of re-entrancy issues when msg.value \u003e 0 and recipient != address(this)\n function _pullToken(address recipient, address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token != UniversalTokenLib.ETH_ADDRESS) {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(recipient);\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, recipient, amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(recipient) - amountPulled;\n } else {\n // Otherwise, we need to check that ETH amount matches msg.value\n if (amount != msg.value) revert MsgValueIncorrect();\n // Transfer value to recipient if not this address\n if (recipient != address(this)) token.universalTransfer(recipient, amount);\n // We will forward msg.value in the external call later, if recipient is not this contract\n amountPulled = msg.value;\n }\n }\n\n /// @inheritdoc IFastBridge\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n // check bridge params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\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\n // transfer tokens to bridge contract\n // @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(address(this), 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 BridgeTransaction({\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 sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n\n // check haven't exceeded deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n\n // mark bridge transaction as relayed\n if (bridgeRelays[transactionId]) revert TransactionRelayed();\n bridgeRelays[transactionId] = true;\n\n // transfer tokens to recipient on destination chain and gas rebate if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n uint256 rebate = chainGasAmount;\n if (!transaction.sendChainGas) {\n // forward erc20\n rebate = 0;\n _pullToken(to, token, amount);\n } else if (token == UniversalTokenLib.ETH_ADDRESS) {\n // lump in gas rebate into amount in native gas token\n _pullToken(to, token, amount + rebate);\n } else {\n // forward erc20 then forward gas rebate in native gas token\n _pullToken(to, token, amount);\n _pullToken(to, UniversalTokenLib.ETH_ADDRESS, rebate);\n }\n\n emit BridgeRelayed(\n transactionId,\n msg.sender,\n to,\n transaction.originChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n rebate\n );\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n // update bridge tx status given proof provided\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = BridgeStatus.RELAYER_PROVED;\n bridgeProofs[transactionId] = BridgeProof({timestamp: uint96(block.timestamp), relayer: msg.sender}); // overflow ok\n\n emit BridgeProofProvided(transactionId, msg.sender, destTxHash);\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint96(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint96).max but\n /// proof.timestamp \u003c type(uint96).max via unchecked statement\n /// @param proof The bridge proof\n /// @return delta Time delta since proof submitted\n function _timeSince(BridgeProof memory proof) internal view returns (uint256 delta) {\n unchecked {\n delta = uint96(block.timestamp) - proof.timestamp;\n }\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != relayer) revert SenderIncorrect();\n return _timeSince(proof) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != msg.sender) revert SenderIncorrect();\n if (_timeSince(proof) \u003c= DISPUTE_PERIOD) revert DisputePeriodNotPassed();\n\n bridgeStatuses[transactionId] = 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, msg.sender, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeProofs[transactionId]) \u003e DISPUTE_PERIOD) revert DisputePeriodPassed();\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n delete bridgeProofs[transactionId];\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 BridgeTransaction memory transaction = getBridgeTransaction(request);\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 // set status to refunded if still in requested state\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = 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\n// test/FastBridgeMock.sol\n\ncontract FastBridgeMock is IFastBridge, Admin {\n // @dev 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 /// @dev to prevent replays\n uint256 public nonce;\n\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n // used for testing in go.\n // see: https://ethereum.stackexchange.com/questions/21155/how-to-expose-enum-in-solidity-contract\n // make sure to update fastbridge/status.go if this changes\n // or underliyng enum changes.\n //\n // TODO: a foundry test should be added to ensure this is always in sync.\n function getEnumKeyByValue(FastBridge.BridgeStatus keyValue) public pure returns (string memory) {\n if (FastBridge.BridgeStatus.NULL == keyValue) return \"NULL\";\n if (FastBridge.BridgeStatus.REQUESTED == keyValue) return \"REQUESTED\";\n if (FastBridge.BridgeStatus.RELAYER_PROVED == keyValue) return \"RELAYER_PROVED\";\n if (FastBridge.BridgeStatus.RELAYER_CLAIMED == keyValue) return \"RELAYER_CLAIMED\";\n if (FastBridge.BridgeStatus.REFUNDED == keyValue) return \"REFUNDED\";\n return \"\";\n }\n\n function mockBridgeRequest(bytes32 transactionId, address sender, BridgeParams memory params) external {\n uint256 originFeeAmount = (params.originAmount * protocolFeeRate) / FEE_BPS;\n params.originAmount -= originFeeAmount;\n\n bytes memory request = abi.encode(\n BridgeTransaction({\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: params.originAmount, // includes relayer fee\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n params.originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n function mockBridgeRequestRaw(bytes32 transactionId, address sender, bytes memory request) external {\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n emit BridgeRequested(\n transactionId,\n transaction.originSender,\n request,\n transaction.destChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n transaction.sendChainGas\n );\n }\n\n function mockBridgeRelayer(\n bytes32 transactionId,\n address relayer,\n address to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n )\n external\n {\n emit BridgeRelayed(\n transactionId, relayer, to, originChainId, originToken, destToken, originAmount, destAmount, chainGasAmount\n );\n }\n\n function bridge(BridgeParams memory params) external payable {\n revert(\"not implemented\");\n }\n\n function relay(bytes memory request) external payable {\n revert(\"not implemented\");\n }\n\n function prove(bytes memory request, bytes32 destTxHash) external {\n revert(\"not implemented\");\n }\n\n function canClaim(bytes32 transactionid, address relayer) external view returns (bool) {\n revert(\"not implemented\");\n }\n\n function claim(bytes memory request, address to) external {\n revert(\"not implemented\");\n }\n\n function dispute(bytes32 transactionId) external {\n revert(\"not implemented\");\n }\n\n function refund(bytes memory request) external {\n revert(\"not implemented\");\n }\n}\n","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","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.20+commit.a1b79de6\"},\"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/FastBridgeMock.sol\":\"AccessControlEnumerable\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeMock.sol\":{\"keccak256\":\"0x4fff59c4cd271340f4a824126cbe4ebe7c8dc20639e268edf42ff873af31f862\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://4d33ef4f98d2abd98b4bbcb403b27495c37843b37000bea9f48e533078144d84\",\"dweb:/ipfs/QmTMkQhtNJPVgpxiLnEG45Ww7xfXHMEoVQ5JdbEbaFXwwS\"]}},\"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/FastBridgeMock.sol:Address":{"code":"0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea264697066735822122069309b4b154b9a5a3f92efe9269fb006052caf08cd8c5c5c6db55daf70b3227964736f6c63430008140033","runtime-code":"0x73000000000000000000000000000000000000000030146080604052600080fdfea264697066735822122069309b4b154b9a5a3f92efe9269fb006052caf08cd8c5c5c6db55daf70b3227964736f6c63430008140033","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.20 ^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 pure 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/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// lib/openzeppelin-contracts/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 ERC-165 detection.\n */\ninterface IAccessControl {\n /**\n * @dev The `account` is missing a role.\n */\n error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);\n\n /**\n * @dev The caller of a function is not the expected one.\n *\n * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.\n */\n error AccessControlBadConfirmation();\n\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted 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// lib/openzeppelin-contracts/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 ERC-20 standard as defined in the ERC.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the value of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the value of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 value) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n * caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 value) external returns (bool);\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\n * allowance mechanism. `value` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n\n// lib/openzeppelin-contracts/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 ERC-20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[ERC-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC-20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n *\n * ==== Security Considerations\n *\n * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\n * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\n * considered as an intention to spend the allowance in any specific way. The second is that because permits have\n * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\n * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\n * generally recommended is:\n *\n * ```solidity\n * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\n * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\n * doThing(..., value);\n * }\n *\n * function doThing(..., uint256 value) public {\n * token.safeTransferFrom(msg.sender, address(this), value);\n * ...\n * }\n * ```\n *\n * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\n * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\n * {SafeERC20-safeTransferFrom}).\n *\n * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\n * contracts should have entry points that don't rely on permit.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also 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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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 ERC-165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[ERC].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n\n// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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 ERC-165 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// lib/openzeppelin-contracts/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 ERC-165 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// lib/openzeppelin-contracts/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 ERC-20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n /**\n * @dev An operation with an ERC-20 token failed.\n */\n error SafeERC20FailedOperation(address token);\n\n /**\n * @dev Indicates a failed `decreaseAllowance` request.\n */\n error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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/FastBridge.sol\n\ncontract FastBridge is IFastBridge, Admin {\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 enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeStatus) public bridgeStatuses;\n /// @notice Proof of relayed bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeProof) public bridgeProofs;\n /// @notice Whether bridge has been relayed on destination chain\n mapping(bytes32 =\u003e bool) public bridgeRelays;\n\n /// @dev to prevent replays\n uint256 public nonce;\n // @dev 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 /// @notice Pulls a requested token from the user to the requested recipient.\n /// @dev Be careful of re-entrancy issues when msg.value \u003e 0 and recipient != address(this)\n function _pullToken(address recipient, address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token != UniversalTokenLib.ETH_ADDRESS) {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(recipient);\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, recipient, amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(recipient) - amountPulled;\n } else {\n // Otherwise, we need to check that ETH amount matches msg.value\n if (amount != msg.value) revert MsgValueIncorrect();\n // Transfer value to recipient if not this address\n if (recipient != address(this)) token.universalTransfer(recipient, amount);\n // We will forward msg.value in the external call later, if recipient is not this contract\n amountPulled = msg.value;\n }\n }\n\n /// @inheritdoc IFastBridge\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n // check bridge params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\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\n // transfer tokens to bridge contract\n // @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(address(this), 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 BridgeTransaction({\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 sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n\n // check haven't exceeded deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n\n // mark bridge transaction as relayed\n if (bridgeRelays[transactionId]) revert TransactionRelayed();\n bridgeRelays[transactionId] = true;\n\n // transfer tokens to recipient on destination chain and gas rebate if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n uint256 rebate = chainGasAmount;\n if (!transaction.sendChainGas) {\n // forward erc20\n rebate = 0;\n _pullToken(to, token, amount);\n } else if (token == UniversalTokenLib.ETH_ADDRESS) {\n // lump in gas rebate into amount in native gas token\n _pullToken(to, token, amount + rebate);\n } else {\n // forward erc20 then forward gas rebate in native gas token\n _pullToken(to, token, amount);\n _pullToken(to, UniversalTokenLib.ETH_ADDRESS, rebate);\n }\n\n emit BridgeRelayed(\n transactionId,\n msg.sender,\n to,\n transaction.originChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n rebate\n );\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n // update bridge tx status given proof provided\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = BridgeStatus.RELAYER_PROVED;\n bridgeProofs[transactionId] = BridgeProof({timestamp: uint96(block.timestamp), relayer: msg.sender}); // overflow ok\n\n emit BridgeProofProvided(transactionId, msg.sender, destTxHash);\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint96(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint96).max but\n /// proof.timestamp \u003c type(uint96).max via unchecked statement\n /// @param proof The bridge proof\n /// @return delta Time delta since proof submitted\n function _timeSince(BridgeProof memory proof) internal view returns (uint256 delta) {\n unchecked {\n delta = uint96(block.timestamp) - proof.timestamp;\n }\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != relayer) revert SenderIncorrect();\n return _timeSince(proof) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != msg.sender) revert SenderIncorrect();\n if (_timeSince(proof) \u003c= DISPUTE_PERIOD) revert DisputePeriodNotPassed();\n\n bridgeStatuses[transactionId] = 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, msg.sender, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeProofs[transactionId]) \u003e DISPUTE_PERIOD) revert DisputePeriodPassed();\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n delete bridgeProofs[transactionId];\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 BridgeTransaction memory transaction = getBridgeTransaction(request);\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 // set status to refunded if still in requested state\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = 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\n// test/FastBridgeMock.sol\n\ncontract FastBridgeMock is IFastBridge, Admin {\n // @dev 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 /// @dev to prevent replays\n uint256 public nonce;\n\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n // used for testing in go.\n // see: https://ethereum.stackexchange.com/questions/21155/how-to-expose-enum-in-solidity-contract\n // make sure to update fastbridge/status.go if this changes\n // or underliyng enum changes.\n //\n // TODO: a foundry test should be added to ensure this is always in sync.\n function getEnumKeyByValue(FastBridge.BridgeStatus keyValue) public pure returns (string memory) {\n if (FastBridge.BridgeStatus.NULL == keyValue) return \"NULL\";\n if (FastBridge.BridgeStatus.REQUESTED == keyValue) return \"REQUESTED\";\n if (FastBridge.BridgeStatus.RELAYER_PROVED == keyValue) return \"RELAYER_PROVED\";\n if (FastBridge.BridgeStatus.RELAYER_CLAIMED == keyValue) return \"RELAYER_CLAIMED\";\n if (FastBridge.BridgeStatus.REFUNDED == keyValue) return \"REFUNDED\";\n return \"\";\n }\n\n function mockBridgeRequest(bytes32 transactionId, address sender, BridgeParams memory params) external {\n uint256 originFeeAmount = (params.originAmount * protocolFeeRate) / FEE_BPS;\n params.originAmount -= originFeeAmount;\n\n bytes memory request = abi.encode(\n BridgeTransaction({\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: params.originAmount, // includes relayer fee\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n params.originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n function mockBridgeRequestRaw(bytes32 transactionId, address sender, bytes memory request) external {\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n emit BridgeRequested(\n transactionId,\n transaction.originSender,\n request,\n transaction.destChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n transaction.sendChainGas\n );\n }\n\n function mockBridgeRelayer(\n bytes32 transactionId,\n address relayer,\n address to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n )\n external\n {\n emit BridgeRelayed(\n transactionId, relayer, to, originChainId, originToken, destToken, originAmount, destAmount, chainGasAmount\n );\n }\n\n function bridge(BridgeParams memory params) external payable {\n revert(\"not implemented\");\n }\n\n function relay(bytes memory request) external payable {\n revert(\"not implemented\");\n }\n\n function prove(bytes memory request, bytes32 destTxHash) external {\n revert(\"not implemented\");\n }\n\n function canClaim(bytes32 transactionid, address relayer) external view returns (bool) {\n revert(\"not implemented\");\n }\n\n function claim(bytes memory request, address to) external {\n revert(\"not implemented\");\n }\n\n function dispute(bytes32 transactionId) external {\n revert(\"not implemented\");\n }\n\n function refund(bytes memory request) external {\n revert(\"not implemented\");\n }\n}\n","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","compilerOptions":"--combined-json bin,bin-runtime,srcmap,srcmap-runtime,abi,userdoc,devdoc,metadata,hashes --optimize --optimize-runs 10000 --allow-paths ., ./, ../ --evm-version=istanbul","srcMap":"15602:6066:0:-:0;;;;;;;;;;;;;;;-1:-1:-1;;;15602:6066:0;;;;;;;;;;;;;;;;;","srcMapRuntime":"15602: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.20+commit.a1b79de6\"},\"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/FastBridgeMock.sol\":\"Address\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeMock.sol\":{\"keccak256\":\"0x4fff59c4cd271340f4a824126cbe4ebe7c8dc20639e268edf42ff873af31f862\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://4d33ef4f98d2abd98b4bbcb403b27495c37843b37000bea9f48e533078144d84\",\"dweb:/ipfs/QmTMkQhtNJPVgpxiLnEG45Ww7xfXHMEoVQ5JdbEbaFXwwS\"]}},\"version\":1}"},"hashes":{}},"solidity/FastBridgeMock.sol:Admin":{"code":"0x60806040523480156200001157600080fd5b50604051620014123803806200141283398101604081905262000034916200018e565b6200004160008262000049565b5050620001b9565b60008062000058848462000086565b905080156200007d5760008481526001602052604090206200007b908462000134565b505b90505b92915050565b6000828152602081815260408083206001600160a01b038516845290915281205460ff166200012b576000838152602081815260408083206001600160a01b03861684529091529020805460ff19166001179055620000e23390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a450600162000080565b50600062000080565b60006200007d836001600160a01b03841660008181526001830160205260408120546200012b5750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915562000080565b600060208284031215620001a157600080fd5b81516001600160a01b03811681146200007d57600080fd5b61124980620001c96000396000f3fe608060405234801561001057600080fd5b50600436106101775760003560e01c806391d14854116100d8578063bf333f2c1161008c578063d547741f11610066578063d547741f14610385578063dcf844a714610398578063e00a83e0146103b857600080fd5b8063bf333f2c14610341578063ca15c8731461034b578063ccc574901461035e57600080fd5b8063a217fddf116100bd578063a217fddf14610313578063b13aa2d61461031b578063b250fe6b1461032e57600080fd5b806391d14854146102a8578063926d7d7f146102ec57600080fd5b80632f2ff15d1161012f57806358f858801161011457806358f85880146102405780635960ccf2146102495780639010d07c1461027057600080fd5b80632f2ff15d1461021a57806336568abe1461022d57600080fd5b806306f333f21161016057806306f333f2146101d95780630f5f6ed7146101ee578063248a9ca3146101f757600080fd5b806301ffc9a71461017c57806303ed0ee5146101a4575b600080fd5b61018f61018a366004611013565b6103c1565b60405190151581526020015b60405180910390f35b6101cb7f043c983c49d46f0e102151eaf8085d4a2e6571d5df2d47b013f39bddfd4a639d81565b60405190815260200161019b565b6101ec6101e736600461107e565b61041d565b005b6101cb61271081565b6101cb6102053660046110b1565b60009081526020819052604090206001015490565b6101ec6102283660046110ca565b61050b565b6101ec61023b3660046110ca565b610536565b6101cb60025481565b6101cb7fdb9556138406326f00296e13ea2ad7db24ba82381212d816b1a40c23b466b32781565b61028361027e3660046110ed565b61058f565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161019b565b61018f6102b63660046110ca565b60009182526020828152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b6101cb7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc481565b6101cb600081565b6101ec6103293660046110b1565b6105ae565b6101ec61033c3660046110b1565b610690565b6101cb620f424081565b6101cb6103593660046110b1565b6106f8565b6101cb7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5581565b6101ec6103933660046110ca565b61070f565b6101cb6103a636600461110f565b60036020526000908152604090205481565b6101cb60045481565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f5a05180f000000000000000000000000000000000000000000000000000000001480610417575061041782610734565b92915050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f55610447816107cb565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600360205260408120549081900361047b5750505050565b73ffffffffffffffffffffffffffffffffffffffff84166000818152600360205260408120556104ac9084836107d8565b6040805173ffffffffffffffffffffffffffffffffffffffff8087168252851660208201529081018290527f244e51bc38c1452fa8aaf487bcb4bca36c2baa3a5fbdb776b1eabd8dc6d277cd9060600160405180910390a1505b505050565b600082815260208190526040902060010154610526816107cb565b610530838361092f565b50505050565b73ffffffffffffffffffffffffffffffffffffffff81163314610585576040517f6697b23200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6105068282610964565b60008281526001602052604081206105a79083610991565b9392505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f556105d8816107cb565b612710821115610649576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f6e657746656552617465203e206d61780000000000000000000000000000000060448201526064015b60405180910390fd5b600280549083905560408051828152602081018590527f14914da2bf76024616fbe1859783fcd4dbddcb179b1f3a854949fbf920dcb95791015b60405180910390a1505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f556106ba816107cb565b600480549083905560408051828152602081018590527f5cf09b12f3f56b4c564d51b25b40360af6d795198adb61ae0806a36c294323fa9101610683565b60008181526001602052604081206104179061099d565b60008281526020819052604090206001015461072a816107cb565b6105308383610964565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061041757507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614610417565b6107d581336109a7565b50565b3073ffffffffffffffffffffffffffffffffffffffff8316036107fa57505050565b8060000361080757505050565b7fffffffffffffffffffffffff111111111111111111111111111111111111111273ffffffffffffffffffffffffffffffffffffffff84160161090e5760008273ffffffffffffffffffffffffffffffffffffffff168260405160006040518083038185875af1925050503d806000811461089e576040519150601f19603f3d011682016040523d82523d6000602084013e6108a3565b606091505b5050905080610530576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f455448207472616e73666572206661696c6564000000000000000000000000006044820152606401610640565b61050673ffffffffffffffffffffffffffffffffffffffff84168383610a31565b60008061093c8484610abe565b905080156105a757600084815260016020526040902061095c9084610bba565b509392505050565b6000806109718484610bdc565b905080156105a757600084815260016020526040902061095c9084610c97565b60006105a78383610cb9565b6000610417825490565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16610a2d576040517fe2517d3f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8216600482015260248101839052604401610640565b5050565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000179052610506908490610ce3565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915281205460ff16610bb25760008381526020818152604080832073ffffffffffffffffffffffffffffffffffffffff86168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055610b503390565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a4506001610417565b506000610417565b60006105a78373ffffffffffffffffffffffffffffffffffffffff8416610d79565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915281205460ff1615610bb25760008381526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8616808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a4506001610417565b60006105a78373ffffffffffffffffffffffffffffffffffffffff8416610dc0565b6000826000018281548110610cd057610cd061112a565b9060005260206000200154905092915050565b6000610d0573ffffffffffffffffffffffffffffffffffffffff841683610eb3565b90508051600014158015610d2a575080806020019051810190610d289190611159565b155b15610506576040517f5274afe700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84166004820152602401610640565b6000818152600183016020526040812054610bb257508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610417565b60008181526001830160205260408120548015610ea9576000610de460018361117b565b8554909150600090610df89060019061117b565b9050808214610e5d576000866000018281548110610e1857610e1861112a565b9060005260206000200154905080876000018481548110610e3b57610e3b61112a565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080610e6e57610e6e6111b5565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610417565b6000915050610417565b60606105a783836000846000808573ffffffffffffffffffffffffffffffffffffffff168486604051610ee691906111e4565b60006040518083038185875af1925050503d8060008114610f23576040519150601f19603f3d011682016040523d82523d6000602084013e610f28565b606091505b5091509150610f38868383610f42565b9695505050505050565b606082610f5757610f5282610fd1565b6105a7565b8151158015610f7b575073ffffffffffffffffffffffffffffffffffffffff84163b155b15610fca576040517f9996b31500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85166004820152602401610640565b50806105a7565b805115610fe15780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006020828403121561102557600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146105a757600080fd5b803573ffffffffffffffffffffffffffffffffffffffff8116811461107957600080fd5b919050565b6000806040838503121561109157600080fd5b61109a83611055565b91506110a860208401611055565b90509250929050565b6000602082840312156110c357600080fd5b5035919050565b600080604083850312156110dd57600080fd5b823591506110a860208401611055565b6000806040838503121561110057600080fd5b50508035926020909101359150565b60006020828403121561112157600080fd5b6105a782611055565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006020828403121561116b57600080fd5b815180151581146105a757600080fd5b81810381811115610417577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b6000825160005b8181101561120557602081860181015185830152016111eb565b50600092019182525091905056fea26469706673582212201dd993fc5abfac80cc090826421c56b0e7f52ac1e663c8aeeb7526f35e1246c464736f6c63430008140033","runtime-code":"0x608060405234801561001057600080fd5b50600436106101775760003560e01c806391d14854116100d8578063bf333f2c1161008c578063d547741f11610066578063d547741f14610385578063dcf844a714610398578063e00a83e0146103b857600080fd5b8063bf333f2c14610341578063ca15c8731461034b578063ccc574901461035e57600080fd5b8063a217fddf116100bd578063a217fddf14610313578063b13aa2d61461031b578063b250fe6b1461032e57600080fd5b806391d14854146102a8578063926d7d7f146102ec57600080fd5b80632f2ff15d1161012f57806358f858801161011457806358f85880146102405780635960ccf2146102495780639010d07c1461027057600080fd5b80632f2ff15d1461021a57806336568abe1461022d57600080fd5b806306f333f21161016057806306f333f2146101d95780630f5f6ed7146101ee578063248a9ca3146101f757600080fd5b806301ffc9a71461017c57806303ed0ee5146101a4575b600080fd5b61018f61018a366004611013565b6103c1565b60405190151581526020015b60405180910390f35b6101cb7f043c983c49d46f0e102151eaf8085d4a2e6571d5df2d47b013f39bddfd4a639d81565b60405190815260200161019b565b6101ec6101e736600461107e565b61041d565b005b6101cb61271081565b6101cb6102053660046110b1565b60009081526020819052604090206001015490565b6101ec6102283660046110ca565b61050b565b6101ec61023b3660046110ca565b610536565b6101cb60025481565b6101cb7fdb9556138406326f00296e13ea2ad7db24ba82381212d816b1a40c23b466b32781565b61028361027e3660046110ed565b61058f565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161019b565b61018f6102b63660046110ca565b60009182526020828152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b6101cb7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc481565b6101cb600081565b6101ec6103293660046110b1565b6105ae565b6101ec61033c3660046110b1565b610690565b6101cb620f424081565b6101cb6103593660046110b1565b6106f8565b6101cb7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5581565b6101ec6103933660046110ca565b61070f565b6101cb6103a636600461110f565b60036020526000908152604090205481565b6101cb60045481565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f5a05180f000000000000000000000000000000000000000000000000000000001480610417575061041782610734565b92915050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f55610447816107cb565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600360205260408120549081900361047b5750505050565b73ffffffffffffffffffffffffffffffffffffffff84166000818152600360205260408120556104ac9084836107d8565b6040805173ffffffffffffffffffffffffffffffffffffffff8087168252851660208201529081018290527f244e51bc38c1452fa8aaf487bcb4bca36c2baa3a5fbdb776b1eabd8dc6d277cd9060600160405180910390a1505b505050565b600082815260208190526040902060010154610526816107cb565b610530838361092f565b50505050565b73ffffffffffffffffffffffffffffffffffffffff81163314610585576040517f6697b23200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6105068282610964565b60008281526001602052604081206105a79083610991565b9392505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f556105d8816107cb565b612710821115610649576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f6e657746656552617465203e206d61780000000000000000000000000000000060448201526064015b60405180910390fd5b600280549083905560408051828152602081018590527f14914da2bf76024616fbe1859783fcd4dbddcb179b1f3a854949fbf920dcb95791015b60405180910390a1505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f556106ba816107cb565b600480549083905560408051828152602081018590527f5cf09b12f3f56b4c564d51b25b40360af6d795198adb61ae0806a36c294323fa9101610683565b60008181526001602052604081206104179061099d565b60008281526020819052604090206001015461072a816107cb565b6105308383610964565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061041757507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614610417565b6107d581336109a7565b50565b3073ffffffffffffffffffffffffffffffffffffffff8316036107fa57505050565b8060000361080757505050565b7fffffffffffffffffffffffff111111111111111111111111111111111111111273ffffffffffffffffffffffffffffffffffffffff84160161090e5760008273ffffffffffffffffffffffffffffffffffffffff168260405160006040518083038185875af1925050503d806000811461089e576040519150601f19603f3d011682016040523d82523d6000602084013e6108a3565b606091505b5050905080610530576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f455448207472616e73666572206661696c6564000000000000000000000000006044820152606401610640565b61050673ffffffffffffffffffffffffffffffffffffffff84168383610a31565b60008061093c8484610abe565b905080156105a757600084815260016020526040902061095c9084610bba565b509392505050565b6000806109718484610bdc565b905080156105a757600084815260016020526040902061095c9084610c97565b60006105a78383610cb9565b6000610417825490565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16610a2d576040517fe2517d3f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8216600482015260248101839052604401610640565b5050565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000179052610506908490610ce3565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915281205460ff16610bb25760008381526020818152604080832073ffffffffffffffffffffffffffffffffffffffff86168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055610b503390565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a4506001610417565b506000610417565b60006105a78373ffffffffffffffffffffffffffffffffffffffff8416610d79565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915281205460ff1615610bb25760008381526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8616808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a4506001610417565b60006105a78373ffffffffffffffffffffffffffffffffffffffff8416610dc0565b6000826000018281548110610cd057610cd061112a565b9060005260206000200154905092915050565b6000610d0573ffffffffffffffffffffffffffffffffffffffff841683610eb3565b90508051600014158015610d2a575080806020019051810190610d289190611159565b155b15610506576040517f5274afe700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84166004820152602401610640565b6000818152600183016020526040812054610bb257508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610417565b60008181526001830160205260408120548015610ea9576000610de460018361117b565b8554909150600090610df89060019061117b565b9050808214610e5d576000866000018281548110610e1857610e1861112a565b9060005260206000200154905080876000018481548110610e3b57610e3b61112a565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080610e6e57610e6e6111b5565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610417565b6000915050610417565b60606105a783836000846000808573ffffffffffffffffffffffffffffffffffffffff168486604051610ee691906111e4565b60006040518083038185875af1925050503d8060008114610f23576040519150601f19603f3d011682016040523d82523d6000602084013e610f28565b606091505b5091509150610f38868383610f42565b9695505050505050565b606082610f5757610f5282610fd1565b6105a7565b8151158015610f7b575073ffffffffffffffffffffffffffffffffffffffff84163b155b15610fca576040517f9996b31500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85166004820152602401610640565b50806105a7565b805115610fe15780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006020828403121561102557600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146105a757600080fd5b803573ffffffffffffffffffffffffffffffffffffffff8116811461107957600080fd5b919050565b6000806040838503121561109157600080fd5b61109a83611055565b91506110a860208401611055565b90509250929050565b6000602082840312156110c357600080fd5b5035919050565b600080604083850312156110dd57600080fd5b823591506110a860208401611055565b6000806040838503121561110057600080fd5b50508035926020909101359150565b60006020828403121561112157600080fd5b6105a782611055565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006020828403121561116b57600080fd5b815180151581146105a757600080fd5b81810381811115610417577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b6000825160005b8181101561120557602081860181015185830152016111eb565b50600092019182525091905056fea26469706673582212201dd993fc5abfac80cc090826421c56b0e7f52ac1e663c8aeeb7526f35e1246c464736f6c63430008140033","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.20 ^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 pure 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/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// lib/openzeppelin-contracts/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 ERC-165 detection.\n */\ninterface IAccessControl {\n /**\n * @dev The `account` is missing a role.\n */\n error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);\n\n /**\n * @dev The caller of a function is not the expected one.\n *\n * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.\n */\n error AccessControlBadConfirmation();\n\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted 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// lib/openzeppelin-contracts/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 ERC-20 standard as defined in the ERC.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the value of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the value of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 value) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n * caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 value) external returns (bool);\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\n * allowance mechanism. `value` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n\n// lib/openzeppelin-contracts/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 ERC-20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[ERC-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC-20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n *\n * ==== Security Considerations\n *\n * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\n * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\n * considered as an intention to spend the allowance in any specific way. The second is that because permits have\n * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\n * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\n * generally recommended is:\n *\n * ```solidity\n * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\n * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\n * doThing(..., value);\n * }\n *\n * function doThing(..., uint256 value) public {\n * token.safeTransferFrom(msg.sender, address(this), value);\n * ...\n * }\n * ```\n *\n * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\n * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\n * {SafeERC20-safeTransferFrom}).\n *\n * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\n * contracts should have entry points that don't rely on permit.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also 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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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 ERC-165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[ERC].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n\n// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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 ERC-165 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// lib/openzeppelin-contracts/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 ERC-165 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// lib/openzeppelin-contracts/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 ERC-20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n /**\n * @dev An operation with an ERC-20 token failed.\n */\n error SafeERC20FailedOperation(address token);\n\n /**\n * @dev Indicates a failed `decreaseAllowance` request.\n */\n error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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/FastBridge.sol\n\ncontract FastBridge is IFastBridge, Admin {\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 enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeStatus) public bridgeStatuses;\n /// @notice Proof of relayed bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeProof) public bridgeProofs;\n /// @notice Whether bridge has been relayed on destination chain\n mapping(bytes32 =\u003e bool) public bridgeRelays;\n\n /// @dev to prevent replays\n uint256 public nonce;\n // @dev 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 /// @notice Pulls a requested token from the user to the requested recipient.\n /// @dev Be careful of re-entrancy issues when msg.value \u003e 0 and recipient != address(this)\n function _pullToken(address recipient, address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token != UniversalTokenLib.ETH_ADDRESS) {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(recipient);\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, recipient, amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(recipient) - amountPulled;\n } else {\n // Otherwise, we need to check that ETH amount matches msg.value\n if (amount != msg.value) revert MsgValueIncorrect();\n // Transfer value to recipient if not this address\n if (recipient != address(this)) token.universalTransfer(recipient, amount);\n // We will forward msg.value in the external call later, if recipient is not this contract\n amountPulled = msg.value;\n }\n }\n\n /// @inheritdoc IFastBridge\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n // check bridge params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\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\n // transfer tokens to bridge contract\n // @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(address(this), 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 BridgeTransaction({\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 sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n\n // check haven't exceeded deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n\n // mark bridge transaction as relayed\n if (bridgeRelays[transactionId]) revert TransactionRelayed();\n bridgeRelays[transactionId] = true;\n\n // transfer tokens to recipient on destination chain and gas rebate if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n uint256 rebate = chainGasAmount;\n if (!transaction.sendChainGas) {\n // forward erc20\n rebate = 0;\n _pullToken(to, token, amount);\n } else if (token == UniversalTokenLib.ETH_ADDRESS) {\n // lump in gas rebate into amount in native gas token\n _pullToken(to, token, amount + rebate);\n } else {\n // forward erc20 then forward gas rebate in native gas token\n _pullToken(to, token, amount);\n _pullToken(to, UniversalTokenLib.ETH_ADDRESS, rebate);\n }\n\n emit BridgeRelayed(\n transactionId,\n msg.sender,\n to,\n transaction.originChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n rebate\n );\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n // update bridge tx status given proof provided\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = BridgeStatus.RELAYER_PROVED;\n bridgeProofs[transactionId] = BridgeProof({timestamp: uint96(block.timestamp), relayer: msg.sender}); // overflow ok\n\n emit BridgeProofProvided(transactionId, msg.sender, destTxHash);\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint96(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint96).max but\n /// proof.timestamp \u003c type(uint96).max via unchecked statement\n /// @param proof The bridge proof\n /// @return delta Time delta since proof submitted\n function _timeSince(BridgeProof memory proof) internal view returns (uint256 delta) {\n unchecked {\n delta = uint96(block.timestamp) - proof.timestamp;\n }\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != relayer) revert SenderIncorrect();\n return _timeSince(proof) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != msg.sender) revert SenderIncorrect();\n if (_timeSince(proof) \u003c= DISPUTE_PERIOD) revert DisputePeriodNotPassed();\n\n bridgeStatuses[transactionId] = 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, msg.sender, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeProofs[transactionId]) \u003e DISPUTE_PERIOD) revert DisputePeriodPassed();\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n delete bridgeProofs[transactionId];\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 BridgeTransaction memory transaction = getBridgeTransaction(request);\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 // set status to refunded if still in requested state\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = 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\n// test/FastBridgeMock.sol\n\ncontract FastBridgeMock is IFastBridge, Admin {\n // @dev 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 /// @dev to prevent replays\n uint256 public nonce;\n\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n // used for testing in go.\n // see: https://ethereum.stackexchange.com/questions/21155/how-to-expose-enum-in-solidity-contract\n // make sure to update fastbridge/status.go if this changes\n // or underliyng enum changes.\n //\n // TODO: a foundry test should be added to ensure this is always in sync.\n function getEnumKeyByValue(FastBridge.BridgeStatus keyValue) public pure returns (string memory) {\n if (FastBridge.BridgeStatus.NULL == keyValue) return \"NULL\";\n if (FastBridge.BridgeStatus.REQUESTED == keyValue) return \"REQUESTED\";\n if (FastBridge.BridgeStatus.RELAYER_PROVED == keyValue) return \"RELAYER_PROVED\";\n if (FastBridge.BridgeStatus.RELAYER_CLAIMED == keyValue) return \"RELAYER_CLAIMED\";\n if (FastBridge.BridgeStatus.REFUNDED == keyValue) return \"REFUNDED\";\n return \"\";\n }\n\n function mockBridgeRequest(bytes32 transactionId, address sender, BridgeParams memory params) external {\n uint256 originFeeAmount = (params.originAmount * protocolFeeRate) / FEE_BPS;\n params.originAmount -= originFeeAmount;\n\n bytes memory request = abi.encode(\n BridgeTransaction({\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: params.originAmount, // includes relayer fee\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n params.originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n function mockBridgeRequestRaw(bytes32 transactionId, address sender, bytes memory request) external {\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n emit BridgeRequested(\n transactionId,\n transaction.originSender,\n request,\n transaction.destChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n transaction.sendChainGas\n );\n }\n\n function mockBridgeRelayer(\n bytes32 transactionId,\n address relayer,\n address to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n )\n external\n {\n emit BridgeRelayed(\n transactionId, relayer, to, originChainId, originToken, destToken, originAmount, destAmount, chainGasAmount\n );\n }\n\n function bridge(BridgeParams memory params) external payable {\n revert(\"not implemented\");\n }\n\n function relay(bytes memory request) external payable {\n revert(\"not implemented\");\n }\n\n function prove(bytes memory request, bytes32 destTxHash) external {\n revert(\"not implemented\");\n }\n\n function canClaim(bytes32 transactionid, address relayer) external view returns (bool) {\n revert(\"not implemented\");\n }\n\n function claim(bytes memory request, address to) external {\n revert(\"not implemented\");\n }\n\n function dispute(bytes32 transactionId) external {\n revert(\"not implemented\");\n }\n\n function refund(bytes memory request) external {\n revert(\"not implemented\");\n }\n}\n","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","compilerOptions":"--combined-json bin,bin-runtime,srcmap,srcmap-runtime,abi,userdoc,devdoc,metadata,hashes --optimize --optimize-runs 10000 --allow-paths ., ./, ../ --evm-version=istanbul","srcMap":"56331:1843:0:-:0;;;57158:83;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;57196:38;46368:4;57227:6;57196:10;:38::i;:::-;;57158:83;56331:1843;;55681:257;55767:4;;55798:31;55815:4;55821:7;55798:16;:31::i;:::-;55783:46;;55843:7;55839:69;;;55866:18;;;;:12;:18;;;;;:31;;55889:7;55866:22;:31::i;:::-;;55839:69;55924:7;-1:-1:-1;55681:257:0;;;;;:::o;50315:316::-;50392:4;47090:12;;;;;;;;;;;-1:-1:-1;;;;;47090:29:0;;;;;;;;;;;;50408:217;;50451:6;:12;;;;;;;;;;;-1:-1:-1;;;;;50451:29:0;;;;;;;;;:36;;-1:-1:-1;;50451:36:0;50483:4;50451:36;;;50533:12;22406:10;;22327:96;50533:12;-1:-1:-1;;;;;50506:40:0;50524:7;-1:-1:-1;;;;;50506:40:0;50518:4;50506:40;;;;;;;;;;-1:-1:-1;50567:4:0;50560:11;;50408:217;-1:-1:-1;50609:5:0;50602:12;;31852:150;31922:4;31945:50;31950:3;-1:-1:-1;;;;;31970:23:0;;25840:4;27896:21;;;:14;;;:21;;;;;;25856:321;;-1:-1:-1;25898:23:0;;;;;;;;:11;:23;;;;;;;;;;;;;26080:18;;26056:21;;;:14;;;:21;;;;;;:42;;;;26112: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;56331:1843:0;;;;;;","srcMapRuntime":"56331:1843:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;54341:212;;;;;;:::i;:::-;;:::i;:::-;;;516:14:1;;509:22;491:41;;479:2;464:18;54341:212:0;;;;;;;;56571:60;;56608:23;56571:60;;;;;689:25:1;;;677:2;662:18;56571:60:0;543:177:1;57543:359:0;;;;;;:::i;:::-;;:::i;:::-;;56753:45;;56792:6;56753:45;;47946:120;;;;;;:::i;:::-;48011:7;48037:12;;;;;;;;;;:22;;;;47946:120;48362:136;;;;;;:::i;:::-;;:::i;49464:245::-;;;;;;:::i;:::-;;:::i;56915:30::-;;;;;;56499:66;;56539:26;56499:66;;55138:142;;;;;;:::i;:::-;;:::i;:::-;;;2246:42:1;2234:55;;;2216:74;;2204:2;2189:18;55138:142:0;2070:226:1;46990:136:0;;;;;;:::i;:::-;47067:4;47090:12;;;;;;;;;;;:29;;;;;;;;;;;;;;;;46990:136;56429:64;;56468:25;56429:64;;46323:49;;46368:4;46323:49;;57247:290;;;;;;:::i;:::-;;:::i;57908:264::-;;;;;;:::i;:::-;;:::i;56710:37::-;;56744:3;56710:37;;55448:131;;;;;;:::i;:::-;;:::i;56637:66::-;;56677:26;56637:66;;48778:138;;;;;;:::i;:::-;;:::i;57001:47::-;;;;;;:::i;:::-;;;;;;;;;;;;;;57122:29;;;;;;54341:212;54426:4;54449:57;;;54464:42;54449:57;;:97;;;54510:36;54534:11;54510:23;:36::i;:::-;54442:104;54341:212;-1:-1:-1;;54341:212:0:o;57543:359::-;56677:26;46600:16;46611:4;46600:10;:16::i;:::-;57667:19:::1;::::0;::::1;57647:17;57667:19:::0;;;:12:::1;:19;::::0;;;;;;57700:14;;;57696:27:::1;;57716:7;57543:359:::0;;;:::o;57696:27::-:1;57764:19;::::0;::::1;57786:1;57764:19:::0;;;:12:::1;:19;::::0;;;;:23;57797:45:::1;::::0;57821:9;57832;57797:23:::1;:45::i;:::-;57857:38;::::0;;2889:42:1;2958:15;;;2940:34;;3010:15;;3005:2;2990:18;;2983:43;3042:18;;;3035:34;;;57857:38:0::1;::::0;2867:2:1;2852:18;57857:38:0::1;;;;;;;57637:265;46626:1;57543:359:::0;;;:::o;48362:136::-;48011:7;48037:12;;;;;;;;;;:22;;;46600:16;46611:4;46600:10;:16::i;:::-;48466:25:::1;48477:4;48483:7;48466:10;:25::i;:::-;;48362:136:::0;;;:::o;49464:245::-;49557:34;;;22406:10;49557:34;49553:102;;49614:30;;;;;;;;;;;;;;49553:102;49665:37;49677:4;49683:18;49665:11;:37::i;55138:142::-;55219:7;55245:18;;;:12;:18;;;;;:28;;55267:5;55245:21;:28::i;:::-;55238:35;55138:142;-1:-1:-1;;;55138:142:0:o;57247:290::-;56677:26;46600:16;46611:4;46600:10;:16::i;:::-;56792:6:::1;57346:10;:26;;57338:55;;;::::0;::::1;::::0;;3282:2:1;57338:55:0::1;::::0;::::1;3264:21:1::0;3321:2;3301:18;;;3294:30;3360:18;3340;;;3333:46;3396:18;;57338:55:0::1;;;;;;;;;57424:15;::::0;;57449:28;;;;57492:38:::1;::::0;;3599:25:1;;;3655:2;3640:18;;3633:34;;;57492:38:0::1;::::0;3572:18:1;57492:38:0::1;;;;;;;;57328:209;57247:290:::0;;:::o;57908:264::-;56677:26;46600:16;46611:4;46600:10;:16::i;:::-;58033:14:::1;::::0;;58057:34;;;;58106:59:::1;::::0;;3599:25:1;;;3655:2;3640:18;;3633:34;;;58106:59:0::1;::::0;3572:18:1;58106:59:0::1;3425:248:1::0;55448:131:0;55519:7;55545:18;;;:12;:18;;;;;:27;;:25;:27::i;48778:138::-;48011:7;48037:12;;;;;;;;;;:22;;;46600:16;46611:4;46600:10;:16::i;:::-;48883:26:::1;48895:4;48901:7;48883:11;:26::i;46701:202::-:0;46786:4;46809:47;;;46824:32;46809:47;;:87;;-1:-1:-1;38614:25:0;38599:40;;;;46860:36;38500:146;47335:103;47401:30;47412:4;22406:10;47401;:30::i;:::-;47335:103;:::o;51613:653::-;51788:4;51774:19;;;;51770:32;;51613:653;;;:::o;51770:32::-;51874:5;51883:1;51874:10;51870:23;;51613:653;;;:::o;51870:23::-;51906:20;;;;;51902:358;;52086:12;52103:2;:7;;52118:5;52103:25;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;52085:43;;;52150:7;52142:39;;;;;;;4090:2:1;52142:39:0;;;4072:21:1;4129:2;4109:18;;;4102:30;4168:21;4148:18;;;4141:49;4207:18;;52142:39:0;3888:343:1;51902:358:0;52212:37;:26;;;52239:2;52243:5;52212:26;:37::i;55681:257::-;55767:4;55783:12;55798:31;55815:4;55821:7;55798:16;:31::i;:::-;55783:46;;55843:7;55839:69;;;55866:18;;;;:12;:18;;;;;:31;;55889:7;55866:22;:31::i;:::-;;55924:7;55681:257;-1:-1:-1;;;55681:257:0:o;56041:262::-;56128:4;56144:12;56159:32;56177:4;56183:7;56159:17;:32::i;:::-;56144:47;;56205:7;56201:72;;;56228:18;;;;:12;:18;;;;;:34;;56254:7;56228:25;:34::i;33110:156::-;33184:7;33234:22;33238:3;33250:5;33234:3;:22::i;32653:115::-;32716:7;32742:19;32750:3;28092:18;;28010:107;47568:197;47067:4;47090:12;;;;;;;;;;;:29;;;;;;;;;;;;;47651:108;;47701:47;;;;;4440:42:1;4428:55;;47701:47:0;;;4410:74:1;4500:18;;;4493:34;;;4383:18;;47701:47:0;4236:297:1;47651:108:0;47568:197;;:::o;39818:160::-;39927:43;;;39942:14;4428:55:1;;39927:43:0;;;4410:74:1;4500:18;;;;4493:34;;;39927:43:0;;;;;;;;;;4383:18:1;;;;39927:43:0;;;;;;;;;;;;;;39900:71;;39920:5;;39900:19;:71::i;50315:316::-;50392:4;47090:12;;;;;;;;;;;:29;;;;;;;;;;;;;50408:217;;50451:6;:12;;;;;;;;;;;:29;;;;;;;;;;:36;;;;50483:4;50451:36;;;50533:12;22406:10;;22327:96;50533:12;50506:40;;50524:7;50506:40;;50518:4;50506:40;;;;;;;;;;-1:-1:-1;50567:4:0;50560:11;;50408:217;-1:-1:-1;50609:5:0;50602:12;;31852:150;31922:4;31945:50;31950:3;31970:23;;;31945:4;:50::i;50866:317::-;50944:4;47090:12;;;;;;;;;;;:29;;;;;;;;;;;;;50960:217;;;51034:5;51002:12;;;;;;;;;;;:29;;;;;;;;;;;:37;;;;;;51058:40;22406:10;;51002:12;;51058:40;;51034:5;51058:40;-1:-1:-1;51119:4:0;51112:11;;32170:156;32243:4;32266:53;32274:3;32294:23;;;32266:7;:53::i;28459:118::-;28526:7;28552:3;:11;;28564:5;28552:18;;;;;;;;:::i;:::-;;;;;;;;;28545:25;;28459:118;;;;:::o;42574:629::-;42993:23;43019:33;:27;;;43047:4;43019:27;:33::i;:::-;42993:59;;43066:10;:17;43087:1;43066:22;;:57;;;;;43104:10;43093:30;;;;;;;;;;;;:::i;:::-;43092:31;43066:57;43062:135;;;43146:40;;;;;2246:42:1;2234:55;;43146:40:0;;;2216:74:1;2189:18;;43146:40:0;2070:226:1;25777:406:0;25840:4;27896:21;;;:14;;;:21;;;;;;25856:321;;-1:-1:-1;25898:23:0;;;;;;;;:11;:23;;;;;;;;;;;;;26080:18;;26056:21;;;:14;;;:21;;;;;;:42;;;;26112:11;;26351:1368;26417:4;26546:21;;;:14;;;:21;;;;;;26582:13;;26578:1135;;26949:18;26970:12;26981:1;26970:8;:12;:::i;:::-;27016:18;;26949:33;;-1:-1:-1;26996:17:0;;27016:22;;27037:1;;27016:22;:::i;:::-;26996:42;;27071:9;27057:10;:23;27053:378;;27100:17;27120:3;:11;;27132:9;27120:22;;;;;;;;:::i;:::-;;;;;;;;;27100:42;;27267:9;27241:3;:11;;27253:10;27241:23;;;;;;;;:::i;:::-;;;;;;;;;;;;:35;;;;27380:25;;;:14;;;:25;;;;;:36;;;27053:378;27509:17;;:3;;:17;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;27612:3;:14;;:21;27627:5;27612:21;;;;;;;;;;;27605:28;;;27655:4;27648:11;;;;;;;26578:1135;27697:5;27690:12;;;;;18112:151;18187:12;18218:38;18240:6;18248:4;18254:1;18187:12;18828;18842:23;18869:6;:11;;18888:5;18895:4;18869:31;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;18827:73;;;;18917:55;18944:6;18952:7;18961:10;18917:26;:55::i;:::-;18910:62;18587:392;-1:-1:-1;;;;;;18587:392:0:o;20032:582::-;20176:12;20205:7;20200:408;;20228:19;20236:10;20228:7;:19::i;:::-;20200:408;;;20452:17;;:22;:49;;;;-1:-1:-1;20478:18:0;;;;:23;20452:49;20448:119;;;20528:24;;;;;2246:42:1;2234:55;;20528:24:0;;;2216:74:1;2189:18;;20528:24:0;2070:226:1;20448:119:0;-1:-1:-1;20587:10:0;20580:17;;21150:516;21281:17;;:21;21277:383;;21509:10;21503:17;21565:15;21552:10;21548:2;21544:19;21537:44;21277:383;21632: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 ERC-20 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.20+commit.a1b79de6\"},\"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 ERC-20 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/FastBridgeMock.sol\":\"Admin\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeMock.sol\":{\"keccak256\":\"0x4fff59c4cd271340f4a824126cbe4ebe7c8dc20639e268edf42ff873af31f862\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://4d33ef4f98d2abd98b4bbcb403b27495c37843b37000bea9f48e533078144d84\",\"dweb:/ipfs/QmTMkQhtNJPVgpxiLnEG45Ww7xfXHMEoVQ5JdbEbaFXwwS\"]}},\"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/FastBridgeMock.sol:Context":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.20 ^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 pure 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/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// lib/openzeppelin-contracts/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 ERC-165 detection.\n */\ninterface IAccessControl {\n /**\n * @dev The `account` is missing a role.\n */\n error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);\n\n /**\n * @dev The caller of a function is not the expected one.\n *\n * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.\n */\n error AccessControlBadConfirmation();\n\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted 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// lib/openzeppelin-contracts/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 ERC-20 standard as defined in the ERC.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the value of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the value of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 value) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n * caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 value) external returns (bool);\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\n * allowance mechanism. `value` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n\n// lib/openzeppelin-contracts/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 ERC-20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[ERC-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC-20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n *\n * ==== Security Considerations\n *\n * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\n * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\n * considered as an intention to spend the allowance in any specific way. The second is that because permits have\n * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\n * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\n * generally recommended is:\n *\n * ```solidity\n * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\n * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\n * doThing(..., value);\n * }\n *\n * function doThing(..., uint256 value) public {\n * token.safeTransferFrom(msg.sender, address(this), value);\n * ...\n * }\n * ```\n *\n * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\n * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\n * {SafeERC20-safeTransferFrom}).\n *\n * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\n * contracts should have entry points that don't rely on permit.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also 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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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 ERC-165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[ERC].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n\n// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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 ERC-165 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// lib/openzeppelin-contracts/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 ERC-165 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// lib/openzeppelin-contracts/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 ERC-20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n /**\n * @dev An operation with an ERC-20 token failed.\n */\n error SafeERC20FailedOperation(address token);\n\n /**\n * @dev Indicates a failed `decreaseAllowance` request.\n */\n error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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/FastBridge.sol\n\ncontract FastBridge is IFastBridge, Admin {\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 enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeStatus) public bridgeStatuses;\n /// @notice Proof of relayed bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeProof) public bridgeProofs;\n /// @notice Whether bridge has been relayed on destination chain\n mapping(bytes32 =\u003e bool) public bridgeRelays;\n\n /// @dev to prevent replays\n uint256 public nonce;\n // @dev 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 /// @notice Pulls a requested token from the user to the requested recipient.\n /// @dev Be careful of re-entrancy issues when msg.value \u003e 0 and recipient != address(this)\n function _pullToken(address recipient, address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token != UniversalTokenLib.ETH_ADDRESS) {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(recipient);\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, recipient, amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(recipient) - amountPulled;\n } else {\n // Otherwise, we need to check that ETH amount matches msg.value\n if (amount != msg.value) revert MsgValueIncorrect();\n // Transfer value to recipient if not this address\n if (recipient != address(this)) token.universalTransfer(recipient, amount);\n // We will forward msg.value in the external call later, if recipient is not this contract\n amountPulled = msg.value;\n }\n }\n\n /// @inheritdoc IFastBridge\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n // check bridge params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\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\n // transfer tokens to bridge contract\n // @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(address(this), 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 BridgeTransaction({\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 sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n\n // check haven't exceeded deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n\n // mark bridge transaction as relayed\n if (bridgeRelays[transactionId]) revert TransactionRelayed();\n bridgeRelays[transactionId] = true;\n\n // transfer tokens to recipient on destination chain and gas rebate if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n uint256 rebate = chainGasAmount;\n if (!transaction.sendChainGas) {\n // forward erc20\n rebate = 0;\n _pullToken(to, token, amount);\n } else if (token == UniversalTokenLib.ETH_ADDRESS) {\n // lump in gas rebate into amount in native gas token\n _pullToken(to, token, amount + rebate);\n } else {\n // forward erc20 then forward gas rebate in native gas token\n _pullToken(to, token, amount);\n _pullToken(to, UniversalTokenLib.ETH_ADDRESS, rebate);\n }\n\n emit BridgeRelayed(\n transactionId,\n msg.sender,\n to,\n transaction.originChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n rebate\n );\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n // update bridge tx status given proof provided\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = BridgeStatus.RELAYER_PROVED;\n bridgeProofs[transactionId] = BridgeProof({timestamp: uint96(block.timestamp), relayer: msg.sender}); // overflow ok\n\n emit BridgeProofProvided(transactionId, msg.sender, destTxHash);\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint96(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint96).max but\n /// proof.timestamp \u003c type(uint96).max via unchecked statement\n /// @param proof The bridge proof\n /// @return delta Time delta since proof submitted\n function _timeSince(BridgeProof memory proof) internal view returns (uint256 delta) {\n unchecked {\n delta = uint96(block.timestamp) - proof.timestamp;\n }\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != relayer) revert SenderIncorrect();\n return _timeSince(proof) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != msg.sender) revert SenderIncorrect();\n if (_timeSince(proof) \u003c= DISPUTE_PERIOD) revert DisputePeriodNotPassed();\n\n bridgeStatuses[transactionId] = 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, msg.sender, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeProofs[transactionId]) \u003e DISPUTE_PERIOD) revert DisputePeriodPassed();\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n delete bridgeProofs[transactionId];\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 BridgeTransaction memory transaction = getBridgeTransaction(request);\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 // set status to refunded if still in requested state\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = 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\n// test/FastBridgeMock.sol\n\ncontract FastBridgeMock is IFastBridge, Admin {\n // @dev 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 /// @dev to prevent replays\n uint256 public nonce;\n\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n // used for testing in go.\n // see: https://ethereum.stackexchange.com/questions/21155/how-to-expose-enum-in-solidity-contract\n // make sure to update fastbridge/status.go if this changes\n // or underliyng enum changes.\n //\n // TODO: a foundry test should be added to ensure this is always in sync.\n function getEnumKeyByValue(FastBridge.BridgeStatus keyValue) public pure returns (string memory) {\n if (FastBridge.BridgeStatus.NULL == keyValue) return \"NULL\";\n if (FastBridge.BridgeStatus.REQUESTED == keyValue) return \"REQUESTED\";\n if (FastBridge.BridgeStatus.RELAYER_PROVED == keyValue) return \"RELAYER_PROVED\";\n if (FastBridge.BridgeStatus.RELAYER_CLAIMED == keyValue) return \"RELAYER_CLAIMED\";\n if (FastBridge.BridgeStatus.REFUNDED == keyValue) return \"REFUNDED\";\n return \"\";\n }\n\n function mockBridgeRequest(bytes32 transactionId, address sender, BridgeParams memory params) external {\n uint256 originFeeAmount = (params.originAmount * protocolFeeRate) / FEE_BPS;\n params.originAmount -= originFeeAmount;\n\n bytes memory request = abi.encode(\n BridgeTransaction({\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: params.originAmount, // includes relayer fee\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n params.originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n function mockBridgeRequestRaw(bytes32 transactionId, address sender, bytes memory request) external {\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n emit BridgeRequested(\n transactionId,\n transaction.originSender,\n request,\n transaction.destChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n transaction.sendChainGas\n );\n }\n\n function mockBridgeRelayer(\n bytes32 transactionId,\n address relayer,\n address to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n )\n external\n {\n emit BridgeRelayed(\n transactionId, relayer, to, originChainId, originToken, destToken, originAmount, destAmount, chainGasAmount\n );\n }\n\n function bridge(BridgeParams memory params) external payable {\n revert(\"not implemented\");\n }\n\n function relay(bytes memory request) external payable {\n revert(\"not implemented\");\n }\n\n function prove(bytes memory request, bytes32 destTxHash) external {\n revert(\"not implemented\");\n }\n\n function canClaim(bytes32 transactionid, address relayer) external view returns (bool) {\n revert(\"not implemented\");\n }\n\n function claim(bytes memory request, address to) external {\n revert(\"not implemented\");\n }\n\n function dispute(bytes32 transactionId) external {\n revert(\"not implemented\");\n }\n\n function refund(bytes memory request) external {\n revert(\"not implemented\");\n }\n}\n","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","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.20+commit.a1b79de6\"},\"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/FastBridgeMock.sol\":\"Context\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeMock.sol\":{\"keccak256\":\"0x4fff59c4cd271340f4a824126cbe4ebe7c8dc20639e268edf42ff873af31f862\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://4d33ef4f98d2abd98b4bbcb403b27495c37843b37000bea9f48e533078144d84\",\"dweb:/ipfs/QmTMkQhtNJPVgpxiLnEG45Ww7xfXHMEoVQ5JdbEbaFXwwS\"]}},\"version\":1}"},"hashes":{}},"solidity/FastBridgeMock.sol:ERC165":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.20 ^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 pure 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/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// lib/openzeppelin-contracts/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 ERC-165 detection.\n */\ninterface IAccessControl {\n /**\n * @dev The `account` is missing a role.\n */\n error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);\n\n /**\n * @dev The caller of a function is not the expected one.\n *\n * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.\n */\n error AccessControlBadConfirmation();\n\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted 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// lib/openzeppelin-contracts/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 ERC-20 standard as defined in the ERC.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the value of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the value of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 value) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n * caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 value) external returns (bool);\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\n * allowance mechanism. `value` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n\n// lib/openzeppelin-contracts/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 ERC-20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[ERC-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC-20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n *\n * ==== Security Considerations\n *\n * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\n * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\n * considered as an intention to spend the allowance in any specific way. The second is that because permits have\n * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\n * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\n * generally recommended is:\n *\n * ```solidity\n * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\n * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\n * doThing(..., value);\n * }\n *\n * function doThing(..., uint256 value) public {\n * token.safeTransferFrom(msg.sender, address(this), value);\n * ...\n * }\n * ```\n *\n * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\n * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\n * {SafeERC20-safeTransferFrom}).\n *\n * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\n * contracts should have entry points that don't rely on permit.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also 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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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 ERC-165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[ERC].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n\n// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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 ERC-165 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// lib/openzeppelin-contracts/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 ERC-165 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// lib/openzeppelin-contracts/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 ERC-20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n /**\n * @dev An operation with an ERC-20 token failed.\n */\n error SafeERC20FailedOperation(address token);\n\n /**\n * @dev Indicates a failed `decreaseAllowance` request.\n */\n error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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/FastBridge.sol\n\ncontract FastBridge is IFastBridge, Admin {\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 enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeStatus) public bridgeStatuses;\n /// @notice Proof of relayed bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeProof) public bridgeProofs;\n /// @notice Whether bridge has been relayed on destination chain\n mapping(bytes32 =\u003e bool) public bridgeRelays;\n\n /// @dev to prevent replays\n uint256 public nonce;\n // @dev 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 /// @notice Pulls a requested token from the user to the requested recipient.\n /// @dev Be careful of re-entrancy issues when msg.value \u003e 0 and recipient != address(this)\n function _pullToken(address recipient, address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token != UniversalTokenLib.ETH_ADDRESS) {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(recipient);\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, recipient, amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(recipient) - amountPulled;\n } else {\n // Otherwise, we need to check that ETH amount matches msg.value\n if (amount != msg.value) revert MsgValueIncorrect();\n // Transfer value to recipient if not this address\n if (recipient != address(this)) token.universalTransfer(recipient, amount);\n // We will forward msg.value in the external call later, if recipient is not this contract\n amountPulled = msg.value;\n }\n }\n\n /// @inheritdoc IFastBridge\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n // check bridge params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\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\n // transfer tokens to bridge contract\n // @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(address(this), 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 BridgeTransaction({\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 sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n\n // check haven't exceeded deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n\n // mark bridge transaction as relayed\n if (bridgeRelays[transactionId]) revert TransactionRelayed();\n bridgeRelays[transactionId] = true;\n\n // transfer tokens to recipient on destination chain and gas rebate if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n uint256 rebate = chainGasAmount;\n if (!transaction.sendChainGas) {\n // forward erc20\n rebate = 0;\n _pullToken(to, token, amount);\n } else if (token == UniversalTokenLib.ETH_ADDRESS) {\n // lump in gas rebate into amount in native gas token\n _pullToken(to, token, amount + rebate);\n } else {\n // forward erc20 then forward gas rebate in native gas token\n _pullToken(to, token, amount);\n _pullToken(to, UniversalTokenLib.ETH_ADDRESS, rebate);\n }\n\n emit BridgeRelayed(\n transactionId,\n msg.sender,\n to,\n transaction.originChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n rebate\n );\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n // update bridge tx status given proof provided\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = BridgeStatus.RELAYER_PROVED;\n bridgeProofs[transactionId] = BridgeProof({timestamp: uint96(block.timestamp), relayer: msg.sender}); // overflow ok\n\n emit BridgeProofProvided(transactionId, msg.sender, destTxHash);\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint96(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint96).max but\n /// proof.timestamp \u003c type(uint96).max via unchecked statement\n /// @param proof The bridge proof\n /// @return delta Time delta since proof submitted\n function _timeSince(BridgeProof memory proof) internal view returns (uint256 delta) {\n unchecked {\n delta = uint96(block.timestamp) - proof.timestamp;\n }\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != relayer) revert SenderIncorrect();\n return _timeSince(proof) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != msg.sender) revert SenderIncorrect();\n if (_timeSince(proof) \u003c= DISPUTE_PERIOD) revert DisputePeriodNotPassed();\n\n bridgeStatuses[transactionId] = 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, msg.sender, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeProofs[transactionId]) \u003e DISPUTE_PERIOD) revert DisputePeriodPassed();\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n delete bridgeProofs[transactionId];\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 BridgeTransaction memory transaction = getBridgeTransaction(request);\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 // set status to refunded if still in requested state\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = 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\n// test/FastBridgeMock.sol\n\ncontract FastBridgeMock is IFastBridge, Admin {\n // @dev 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 /// @dev to prevent replays\n uint256 public nonce;\n\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n // used for testing in go.\n // see: https://ethereum.stackexchange.com/questions/21155/how-to-expose-enum-in-solidity-contract\n // make sure to update fastbridge/status.go if this changes\n // or underliyng enum changes.\n //\n // TODO: a foundry test should be added to ensure this is always in sync.\n function getEnumKeyByValue(FastBridge.BridgeStatus keyValue) public pure returns (string memory) {\n if (FastBridge.BridgeStatus.NULL == keyValue) return \"NULL\";\n if (FastBridge.BridgeStatus.REQUESTED == keyValue) return \"REQUESTED\";\n if (FastBridge.BridgeStatus.RELAYER_PROVED == keyValue) return \"RELAYER_PROVED\";\n if (FastBridge.BridgeStatus.RELAYER_CLAIMED == keyValue) return \"RELAYER_CLAIMED\";\n if (FastBridge.BridgeStatus.REFUNDED == keyValue) return \"REFUNDED\";\n return \"\";\n }\n\n function mockBridgeRequest(bytes32 transactionId, address sender, BridgeParams memory params) external {\n uint256 originFeeAmount = (params.originAmount * protocolFeeRate) / FEE_BPS;\n params.originAmount -= originFeeAmount;\n\n bytes memory request = abi.encode(\n BridgeTransaction({\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: params.originAmount, // includes relayer fee\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n params.originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n function mockBridgeRequestRaw(bytes32 transactionId, address sender, bytes memory request) external {\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n emit BridgeRequested(\n transactionId,\n transaction.originSender,\n request,\n transaction.destChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n transaction.sendChainGas\n );\n }\n\n function mockBridgeRelayer(\n bytes32 transactionId,\n address relayer,\n address to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n )\n external\n {\n emit BridgeRelayed(\n transactionId, relayer, to, originChainId, originToken, destToken, originAmount, destAmount, chainGasAmount\n );\n }\n\n function bridge(BridgeParams memory params) external payable {\n revert(\"not implemented\");\n }\n\n function relay(bytes memory request) external payable {\n revert(\"not implemented\");\n }\n\n function prove(bytes memory request, bytes32 destTxHash) external {\n revert(\"not implemented\");\n }\n\n function canClaim(bytes32 transactionid, address relayer) external view returns (bool) {\n revert(\"not implemented\");\n }\n\n function claim(bytes memory request, address to) external {\n revert(\"not implemented\");\n }\n\n function dispute(bytes32 transactionId) external {\n revert(\"not implemented\");\n }\n\n function refund(bytes memory request) external {\n revert(\"not implemented\");\n }\n}\n","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","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 ERC-165 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.20+commit.a1b79de6\"},\"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 ERC-165 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/FastBridgeMock.sol\":\"ERC165\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeMock.sol\":{\"keccak256\":\"0x4fff59c4cd271340f4a824126cbe4ebe7c8dc20639e268edf42ff873af31f862\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://4d33ef4f98d2abd98b4bbcb403b27495c37843b37000bea9f48e533078144d84\",\"dweb:/ipfs/QmTMkQhtNJPVgpxiLnEG45Ww7xfXHMEoVQ5JdbEbaFXwwS\"]}},\"version\":1}"},"hashes":{"supportsInterface(bytes4)":"01ffc9a7"}},"solidity/FastBridgeMock.sol:EnumerableSet":{"code":"0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212200d8618a82dfc0c2e00136a6baf933d53111fd9bd0c5433b637ac80498bb32ba464736f6c63430008140033","runtime-code":"0x73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212200d8618a82dfc0c2e00136a6baf933d53111fd9bd0c5433b637ac80498bb32ba464736f6c63430008140033","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.20 ^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 pure 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/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// lib/openzeppelin-contracts/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 ERC-165 detection.\n */\ninterface IAccessControl {\n /**\n * @dev The `account` is missing a role.\n */\n error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);\n\n /**\n * @dev The caller of a function is not the expected one.\n *\n * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.\n */\n error AccessControlBadConfirmation();\n\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted 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// lib/openzeppelin-contracts/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 ERC-20 standard as defined in the ERC.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the value of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the value of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 value) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n * caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 value) external returns (bool);\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\n * allowance mechanism. `value` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n\n// lib/openzeppelin-contracts/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 ERC-20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[ERC-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC-20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n *\n * ==== Security Considerations\n *\n * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\n * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\n * considered as an intention to spend the allowance in any specific way. The second is that because permits have\n * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\n * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\n * generally recommended is:\n *\n * ```solidity\n * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\n * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\n * doThing(..., value);\n * }\n *\n * function doThing(..., uint256 value) public {\n * token.safeTransferFrom(msg.sender, address(this), value);\n * ...\n * }\n * ```\n *\n * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\n * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\n * {SafeERC20-safeTransferFrom}).\n *\n * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\n * contracts should have entry points that don't rely on permit.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also 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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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 ERC-165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[ERC].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n\n// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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 ERC-165 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// lib/openzeppelin-contracts/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 ERC-165 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// lib/openzeppelin-contracts/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 ERC-20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n /**\n * @dev An operation with an ERC-20 token failed.\n */\n error SafeERC20FailedOperation(address token);\n\n /**\n * @dev Indicates a failed `decreaseAllowance` request.\n */\n error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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/FastBridge.sol\n\ncontract FastBridge is IFastBridge, Admin {\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 enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeStatus) public bridgeStatuses;\n /// @notice Proof of relayed bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeProof) public bridgeProofs;\n /// @notice Whether bridge has been relayed on destination chain\n mapping(bytes32 =\u003e bool) public bridgeRelays;\n\n /// @dev to prevent replays\n uint256 public nonce;\n // @dev 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 /// @notice Pulls a requested token from the user to the requested recipient.\n /// @dev Be careful of re-entrancy issues when msg.value \u003e 0 and recipient != address(this)\n function _pullToken(address recipient, address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token != UniversalTokenLib.ETH_ADDRESS) {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(recipient);\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, recipient, amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(recipient) - amountPulled;\n } else {\n // Otherwise, we need to check that ETH amount matches msg.value\n if (amount != msg.value) revert MsgValueIncorrect();\n // Transfer value to recipient if not this address\n if (recipient != address(this)) token.universalTransfer(recipient, amount);\n // We will forward msg.value in the external call later, if recipient is not this contract\n amountPulled = msg.value;\n }\n }\n\n /// @inheritdoc IFastBridge\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n // check bridge params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\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\n // transfer tokens to bridge contract\n // @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(address(this), 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 BridgeTransaction({\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 sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n\n // check haven't exceeded deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n\n // mark bridge transaction as relayed\n if (bridgeRelays[transactionId]) revert TransactionRelayed();\n bridgeRelays[transactionId] = true;\n\n // transfer tokens to recipient on destination chain and gas rebate if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n uint256 rebate = chainGasAmount;\n if (!transaction.sendChainGas) {\n // forward erc20\n rebate = 0;\n _pullToken(to, token, amount);\n } else if (token == UniversalTokenLib.ETH_ADDRESS) {\n // lump in gas rebate into amount in native gas token\n _pullToken(to, token, amount + rebate);\n } else {\n // forward erc20 then forward gas rebate in native gas token\n _pullToken(to, token, amount);\n _pullToken(to, UniversalTokenLib.ETH_ADDRESS, rebate);\n }\n\n emit BridgeRelayed(\n transactionId,\n msg.sender,\n to,\n transaction.originChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n rebate\n );\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n // update bridge tx status given proof provided\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = BridgeStatus.RELAYER_PROVED;\n bridgeProofs[transactionId] = BridgeProof({timestamp: uint96(block.timestamp), relayer: msg.sender}); // overflow ok\n\n emit BridgeProofProvided(transactionId, msg.sender, destTxHash);\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint96(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint96).max but\n /// proof.timestamp \u003c type(uint96).max via unchecked statement\n /// @param proof The bridge proof\n /// @return delta Time delta since proof submitted\n function _timeSince(BridgeProof memory proof) internal view returns (uint256 delta) {\n unchecked {\n delta = uint96(block.timestamp) - proof.timestamp;\n }\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != relayer) revert SenderIncorrect();\n return _timeSince(proof) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != msg.sender) revert SenderIncorrect();\n if (_timeSince(proof) \u003c= DISPUTE_PERIOD) revert DisputePeriodNotPassed();\n\n bridgeStatuses[transactionId] = 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, msg.sender, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeProofs[transactionId]) \u003e DISPUTE_PERIOD) revert DisputePeriodPassed();\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n delete bridgeProofs[transactionId];\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 BridgeTransaction memory transaction = getBridgeTransaction(request);\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 // set status to refunded if still in requested state\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = 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\n// test/FastBridgeMock.sol\n\ncontract FastBridgeMock is IFastBridge, Admin {\n // @dev 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 /// @dev to prevent replays\n uint256 public nonce;\n\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n // used for testing in go.\n // see: https://ethereum.stackexchange.com/questions/21155/how-to-expose-enum-in-solidity-contract\n // make sure to update fastbridge/status.go if this changes\n // or underliyng enum changes.\n //\n // TODO: a foundry test should be added to ensure this is always in sync.\n function getEnumKeyByValue(FastBridge.BridgeStatus keyValue) public pure returns (string memory) {\n if (FastBridge.BridgeStatus.NULL == keyValue) return \"NULL\";\n if (FastBridge.BridgeStatus.REQUESTED == keyValue) return \"REQUESTED\";\n if (FastBridge.BridgeStatus.RELAYER_PROVED == keyValue) return \"RELAYER_PROVED\";\n if (FastBridge.BridgeStatus.RELAYER_CLAIMED == keyValue) return \"RELAYER_CLAIMED\";\n if (FastBridge.BridgeStatus.REFUNDED == keyValue) return \"REFUNDED\";\n return \"\";\n }\n\n function mockBridgeRequest(bytes32 transactionId, address sender, BridgeParams memory params) external {\n uint256 originFeeAmount = (params.originAmount * protocolFeeRate) / FEE_BPS;\n params.originAmount -= originFeeAmount;\n\n bytes memory request = abi.encode(\n BridgeTransaction({\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: params.originAmount, // includes relayer fee\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n params.originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n function mockBridgeRequestRaw(bytes32 transactionId, address sender, bytes memory request) external {\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n emit BridgeRequested(\n transactionId,\n transaction.originSender,\n request,\n transaction.destChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n transaction.sendChainGas\n );\n }\n\n function mockBridgeRelayer(\n bytes32 transactionId,\n address relayer,\n address to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n )\n external\n {\n emit BridgeRelayed(\n transactionId, relayer, to, originChainId, originToken, destToken, originAmount, destAmount, chainGasAmount\n );\n }\n\n function bridge(BridgeParams memory params) external payable {\n revert(\"not implemented\");\n }\n\n function relay(bytes memory request) external payable {\n revert(\"not implemented\");\n }\n\n function prove(bytes memory request, bytes32 destTxHash) external {\n revert(\"not implemented\");\n }\n\n function canClaim(bytes32 transactionid, address relayer) external view returns (bool) {\n revert(\"not implemented\");\n }\n\n function claim(bytes memory request, address to) external {\n revert(\"not implemented\");\n }\n\n function dispute(bytes32 transactionId) external {\n revert(\"not implemented\");\n }\n\n function refund(bytes memory request) external {\n revert(\"not implemented\");\n }\n}\n","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","compilerOptions":"--combined-json bin,bin-runtime,srcmap,srcmap-runtime,abi,userdoc,devdoc,metadata,hashes --optimize --optimize-runs 10000 --allow-paths ., ./, ../ --evm-version=istanbul","srcMap":"24866:11640:0:-:0;;;;;;;;;;;;;;;-1:-1:-1;;;24866:11640:0;;;;;;;;;;;;;;;;;","srcMapRuntime":"24866: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.20+commit.a1b79de6\"},\"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/FastBridgeMock.sol\":\"EnumerableSet\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeMock.sol\":{\"keccak256\":\"0x4fff59c4cd271340f4a824126cbe4ebe7c8dc20639e268edf42ff873af31f862\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://4d33ef4f98d2abd98b4bbcb403b27495c37843b37000bea9f48e533078144d84\",\"dweb:/ipfs/QmTMkQhtNJPVgpxiLnEG45Ww7xfXHMEoVQ5JdbEbaFXwwS\"]}},\"version\":1}"},"hashes":{}},"solidity/FastBridgeMock.sol:FastBridge":{"code":"0x60a06040523480156200001157600080fd5b5060405162002d7a38038062002d7a833981016040819052620000349162000194565b80620000426000826200004f565b50504360805250620001bf565b6000806200005e84846200008c565b90508015620000835760008481526001602052604090206200008190846200013a565b505b90505b92915050565b6000828152602081815260408083206001600160a01b038516845290915281205460ff1662000131576000838152602081815260408083206001600160a01b03861684529091529020805460ff19166001179055620000e83390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a450600162000086565b50600062000086565b600062000083836001600160a01b0384166000818152600183016020526040812054620001315750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915562000086565b600060208284031215620001a757600080fd5b81516001600160a01b03811681146200008357600080fd5b608051612b9f620001db60003960006106510152612b9f6000f3fe60806040526004361061026a5760003560e01c80639010d07c11610153578063add98c70116100cb578063ca15c8731161007f578063d547741f11610064578063d547741f146107a1578063dcf844a7146107c1578063e00a83e0146107ee57600080fd5b8063ca15c8731461074d578063ccc574901461076d57600080fd5b8063b13aa2d6116100b0578063b13aa2d6146106f6578063b250fe6b14610716578063bf333f2c1461073657600080fd5b8063add98c70146106c0578063affed0e0146106e057600080fd5b8063a217fddf11610122578063a5bbe22b11610107578063a5bbe22b1461047f578063aa9641ab14610673578063ac11fb1a1461069357600080fd5b8063a217fddf1461062a578063a3ec191a1461063f57600080fd5b80639010d07c146104f857806391ad50391461053057806391d14854146105b2578063926d7d7f146105f657600080fd5b806341fcb612116101e65780635eb7d946116101b55780638379a24f1161019a5780638379a24f14610495578063886d36ff146104c55780638f0d6f17146104e557600080fd5b80635eb7d9461461045f578063820688d51461047f57600080fd5b806341fcb612146103e2578063458516941461040257806358f85880146104155780635960ccf21461042b57600080fd5b80630f5f6ed71161023d578063248a9ca311610222578063248a9ca3146103725780632f2ff15d146103a257806336568abe146103c257600080fd5b80630f5f6ed714610345578063190da5951461035b57600080fd5b806301ffc9a71461026f57806303ed0ee5146102a4578063051287bc146102e657806306f333f214610323575b600080fd5b34801561027b57600080fd5b5061028f61028a3660046122fc565b610804565b60405190151581526020015b60405180910390f35b3480156102b057600080fd5b506102d87f043c983c49d46f0e102151eaf8085d4a2e6571d5df2d47b013f39bddfd4a639d81565b60405190815260200161029b565b3480156102f257600080fd5b5061031661030136600461233e565b60056020526000908152604090205460ff1681565b60405161029b9190612386565b34801561032f57600080fd5b5061034361033e3660046123ec565b610860565b005b34801561035157600080fd5b506102d861271081565b34801561036757600080fd5b506102d862093a8081565b34801561037e57600080fd5b506102d861038d36600461233e565b60009081526020819052604090206001015490565b3480156103ae57600080fd5b506103436103bd366004612425565b610927565b3480156103ce57600080fd5b506103436103dd366004612425565b610952565b3480156103ee57600080fd5b506103436103fd366004612572565b61099e565b6103436104103660046125ef565b610bd7565b34801561042157600080fd5b506102d860025481565b34801561043757600080fd5b506102d87fdb9556138406326f00296e13ea2ad7db24ba82381212d816b1a40c23b466b32781565b34801561046b57600080fd5b5061034361047a366004612692565b610ee5565b34801561048b57600080fd5b506102d861070881565b3480156104a157600080fd5b5061028f6104b036600461233e565b60076020526000908152604090205460ff1681565b3480156104d157600080fd5b506103436104e03660046126cf565b6110bd565b6103436104f3366004612692565b6111f0565b34801561050457600080fd5b50610518610513366004612714565b611437565b6040516001600160a01b03909116815260200161029b565b34801561053c57600080fd5b5061058661054b36600461233e565b6006602052600090815260409020546bffffffffffffffffffffffff8116906c0100000000000000000000000090046001600160a01b031682565b604080516bffffffffffffffffffffffff90931683526001600160a01b0390911660208301520161029b565b3480156105be57600080fd5b5061028f6105cd366004612425565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b34801561060257600080fd5b506102d87fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc481565b34801561063657600080fd5b506102d8600081565b34801561064b57600080fd5b506102d87f000000000000000000000000000000000000000000000000000000000000000081565b34801561067f57600080fd5b5061028f61068e366004612425565b611456565b34801561069f57600080fd5b506106b36106ae366004612692565b611559565b60405161029b9190612736565b3480156106cc57600080fd5b506103436106db36600461233e565b6115cc565b3480156106ec57600080fd5b506102d860085481565b34801561070257600080fd5b5061034361071136600461233e565b611735565b34801561072257600080fd5b5061034361073136600461233e565b611817565b34801561074257600080fd5b506102d8620f424081565b34801561075957600080fd5b506102d861076836600461233e565b61187f565b34801561077957600080fd5b506102d87f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5581565b3480156107ad57600080fd5b506103436107bc366004612425565b611896565b3480156107cd57600080fd5b506102d86107dc36600461281c565b60036020526000908152604090205481565b3480156107fa57600080fd5b506102d860045481565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f5a05180f00000000000000000000000000000000000000000000000000000000148061085a575061085a826118bb565b92915050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5561088a81611952565b6001600160a01b038316600090815260036020526040812054908190036108b15750505050565b6001600160a01b0384166000818152600360205260408120556108d590848361195f565b604080516001600160a01b038087168252851660208201529081018290527f244e51bc38c1452fa8aaf487bcb4bca36c2baa3a5fbdb776b1eabd8dc6d277cd9060600160405180910390a1505b505050565b60008281526020819052604090206001015461094281611952565b61094c8383611a82565b50505050565b6001600160a01b0381163314610994576040517f6697b23200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6109228282611ab7565b7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc46109c881611952565b8251602084012060006109da85611559565b9050600260008381526005602052604090205460ff166004811115610a0157610a01612357565b14610a38576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000828152600660209081526040918290208251808401909352546bffffffffffffffffffffffff811683526c0100000000000000000000000090046001600160a01b03169082018190523314610abb576040517f4af43a9000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80516107089042036bffffffffffffffffffffffff1611610b08576040517f1992d0bd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000838152600560205260409020805460ff1916600317905561010082015115610b645761010082015160808301516001600160a01b031660009081526003602052604081208054909190610b5e908490612868565b90915550505b608082015160c0830151610b826001600160a01b038316888361195f565b604080516001600160a01b03848116825260208201849052891691339188917f582211c35a2139ac3bbaac74663c6a1f56c6cbb658b41fe11fd45a82074ac67891015b60405180910390a45050505050505050565b46816000015163ffffffff1603610c1a576040517f7029fdf900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60a08101511580610c2d575060c0810151155b15610c64576040517fe38820c800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60608101516001600160a01b03161580610c89575060808101516001600160a01b0316155b15610cc0576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610ccc61070842612868565b8161010001511015610d0a576040517f04b7fcc800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000610d1f3083606001518460a00151611ae4565b90506000806002541115610d4c57620f424060025483610d3f919061287b565b610d499190612892565b90505b610d5681836128cd565b915060006040518061018001604052804663ffffffff168152602001856000015163ffffffff16815260200185602001516001600160a01b0316815260200185604001516001600160a01b0316815260200185606001516001600160a01b0316815260200185608001516001600160a01b031681526020018481526020018560c0015181526020018381526020018560e0015115158152602001856101000151815260200160086000815480929190610e0e906128e0565b909155509052604051610e249190602001612736565b604080518083037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0018152828252805160208083019190912060008181526005835293909320805460ff191660011790558701518751606089015160808a015160c08b015160e08c015195985095966001600160a01b039094169587957f120ea0364f36cdac7983bcfdd55270ca09d7f9b314a2ebc425a3b01ab1d6403a95610ed6958b959094909390928e9261293c565b60405180910390a35050505050565b805160208201206000610ef783611559565b3360009081527fd2043bf65931af3dbecf60d0db8f40e4160406d7beb00522f4200cf4944a1eb8602052604090205490915060ff1615610f74578061014001514211610f6f576040517fe15ff9ea00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610fc0565b62093a80816101400151610f889190612868565b4211610fc0576040517fe15ff9ea00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600160008381526005602052604090205460ff166004811115610fe557610fe5612357565b1461101c576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600082815260056020526040808220805460ff19166004179055820151608083015161010084015160c0850151929391926110579190612868565b905061106d6001600160a01b038316848361195f565b604080516001600160a01b0384811682526020820184905285169187917fb4c55c0c9bc613519b920e88748090150b890a875d307f21bea7d4fb2e8bc958910160405180910390a3505050505050565b7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc46110e781611952565b82516020840120600160008281526005602052604090205460ff16600481111561111357611113612357565b1461114a576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008181526005602090815260408083208054600260ff19909116179055805180820182526bffffffffffffffffffffffff4281168252338285018181528787526006865295849020925195516001600160a01b03166c0100000000000000000000000002959091169490941790555185815283917f4ac8af8a2cd87193d64dfc7a3b8d9923b714ec528b18725d080aa1299be0c5e4910160405180910390a350505050565b7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc461121a81611952565b81516020830120600061122c84611559565b90504663ffffffff16816020015163ffffffff1614611277576040517f7029fdf900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8061014001514211156112b6576040517f559895a300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008281526007602052604090205460ff16156112ff576040517fbef7bb7d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000828152600760205260409020805460ff19166001179055606081015160a082015160e083015160045461012085015161134857506000611342848484611ae4565b506113b9565b7fffffffffffffffffffffffff11111111111111111111111111111111111111126001600160a01b0384160161138c5761134284846113878486612868565b611ae4565b611397848484611ae4565b506113b78473eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee83611ae4565b505b845160808087015160a08089015160c0808b015160e08c01516040805163ffffffff90991689526001600160a01b0396871660208a0152938616938801939093526060870152938501528301849052861691339189917ff8ae392d784b1ea5e8881bfa586d81abf07ef4f1e2fc75f7fe51c90f05199a5c9101610bc5565b600082815260016020526040812061144f9083611cb3565b9392505050565b6000600260008481526005602052604090205460ff16600481111561147d5761147d612357565b146114b4576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000838152600660209081526040918290208251808401909352546bffffffffffffffffffffffff811683526001600160a01b036c01000000000000000000000000909104811691830182905284161461153a576040517f4af43a9000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80516107089042036bffffffffffffffffffffffff1611949350505050565b604080516101808101825260008082526020808301829052928201819052606082018190526080820181905260a0820181905260c0820181905260e082018190526101008201819052610120820181905261014082018190526101608201528251909161085a91840181019084016129ed565b7f043c983c49d46f0e102151eaf8085d4a2e6571d5df2d47b013f39bddfd4a639d6115f681611952565b600260008381526005602052604090205460ff16600481111561161b5761161b612357565b14611652576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000828152600660209081526040918290208251808401909352546bffffffffffffffffffffffff8082168085526c010000000000000000000000009092046001600160a01b031693909201929092526107089142031611156116e1576040517f3e908aac00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000828152600560209081526040808320805460ff19166001179055600690915280822082905551339184917f0695cf1d39b3055dcd0fe02d8b47eaf0d5a13e1996de925de59d0ef9b7f7fad49190a35050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5561175f81611952565b6127108211156117d0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f6e657746656552617465203e206d61780000000000000000000000000000000060448201526064015b60405180910390fd5b600280549083905560408051828152602081018590527f14914da2bf76024616fbe1859783fcd4dbddcb179b1f3a854949fbf920dcb95791015b60405180910390a1505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5561184181611952565b600480549083905560408051828152602081018590527f5cf09b12f3f56b4c564d51b25b40360af6d795198adb61ae0806a36c294323fa910161180a565b600081815260016020526040812061085a90611cbf565b6000828152602081905260409020600101546118b181611952565b61094c8383611ab7565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061085a57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff0000000000000000000000000000000000000000000000000000000083161461085a565b61195c8133611cc9565b50565b306001600160a01b0383160361197457505050565b8060000361198157505050565b7fffffffffffffffffffffffff11111111111111111111111111111111111111126001600160a01b03841601611a6e576000826001600160a01b03168260405160006040518083038185875af1925050503d80600081146119fe576040519150601f19603f3d011682016040523d82523d6000602084013e611a03565b606091505b505090508061094c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f455448207472616e73666572206661696c65640000000000000000000000000060448201526064016117c7565b6109226001600160a01b0384168383611d39565b600080611a8f8484611dad565b9050801561144f576000848152600160205260409020611aaf9084611e57565b509392505050565b600080611ac48484611e6c565b9050801561144f576000848152600160205260409020611aaf9084611eef565b60006001600160a01b03831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14611c4d57611b1c836001600160a01b0316611f04565b6040517f70a082310000000000000000000000000000000000000000000000000000000081526001600160a01b0385811660048301528416906370a0823190602401602060405180830381865afa158015611b7b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b9f9190612ab9565b9050611bb66001600160a01b038416338685611faa565b6040517f70a082310000000000000000000000000000000000000000000000000000000081526001600160a01b0385811660048301528291908516906370a0823190602401602060405180830381865afa158015611c18573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c3c9190612ab9565b611c4691906128cd565b905061144f565b348214611c86576040517f81de0bf300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b0384163014611caa57611caa6001600160a01b038416858461195f565b50349392505050565b600061144f8383611fe3565b600061085a825490565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16611d35576040517fe2517d3f0000000000000000000000000000000000000000000000000000000081526001600160a01b0382166004820152602481018390526044016117c7565b5050565b6040516001600160a01b0383811660248301526044820183905261092291859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505061200d565b6000828152602081815260408083206001600160a01b038516845290915281205460ff16611e4f576000838152602081815260408083206001600160a01b03861684529091529020805460ff19166001179055611e073390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a450600161085a565b50600061085a565b600061144f836001600160a01b038416612089565b6000828152602081815260408083206001600160a01b038516845290915281205460ff1615611e4f576000838152602081815260408083206001600160a01b0386168085529252808320805460ff1916905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a450600161085a565b600061144f836001600160a01b0384166120d0565b7fffffffffffffffffffffffff11111111111111111111111111111111111111126001600160a01b03821601611f66576040517f7f523fe800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b806001600160a01b03163b60000361195c576040517f7f523fe800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040516001600160a01b03848116602483015283811660448301526064820183905261094c9186918216906323b872dd90608401611d66565b6000826000018281548110611ffa57611ffa612ad2565b9060005260206000200154905092915050565b60006120226001600160a01b038416836121c3565b905080516000141580156120475750808060200190518101906120459190612b01565b155b15610922576040517f5274afe70000000000000000000000000000000000000000000000000000000081526001600160a01b03841660048201526024016117c7565b6000818152600183016020526040812054611e4f5750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561085a565b600081815260018301602052604081205480156121b95760006120f46001836128cd565b8554909150600090612108906001906128cd565b905080821461216d57600086600001828154811061212857612128612ad2565b906000526020600020015490508087600001848154811061214b5761214b612ad2565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061217e5761217e612b1e565b60019003818190600052602060002001600090559055856001016000868152602001908152602001600020600090556001935050505061085a565b600091505061085a565b606061144f8383600084600080856001600160a01b031684866040516121e99190612b4d565b60006040518083038185875af1925050503d8060008114612226576040519150601f19603f3d011682016040523d82523d6000602084013e61222b565b606091505b509150915061223b868383612245565b9695505050505050565b60608261225a57612255826122ba565b61144f565b815115801561227157506001600160a01b0384163b155b156122b3576040517f9996b3150000000000000000000000000000000000000000000000000000000081526001600160a01b03851660048201526024016117c7565b508061144f565b8051156122ca5780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006020828403121561230e57600080fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811461144f57600080fd5b60006020828403121561235057600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b60208101600583106123c1577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b91905290565b6001600160a01b038116811461195c57600080fd5b80356123e7816123c7565b919050565b600080604083850312156123ff57600080fd5b823561240a816123c7565b9150602083013561241a816123c7565b809150509250929050565b6000806040838503121561243857600080fd5b82359150602083013561241a816123c7565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051610120810167ffffffffffffffff8111828210171561249d5761249d61244a565b60405290565b604051610180810167ffffffffffffffff8111828210171561249d5761249d61244a565b600082601f8301126124d857600080fd5b813567ffffffffffffffff808211156124f3576124f361244a565b604051601f83017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f011681019082821181831017156125395761253961244a565b8160405283815286602085880101111561255257600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000806040838503121561258557600080fd5b823567ffffffffffffffff81111561259c57600080fd5b6125a8858286016124c7565b925050602083013561241a816123c7565b63ffffffff8116811461195c57600080fd5b80356123e7816125b9565b801515811461195c57600080fd5b80356123e7816125d6565b6000610120828403121561260257600080fd5b61260a612479565b612613836125cb565b8152612621602084016123dc565b6020820152612632604084016123dc565b6040820152612643606084016123dc565b6060820152612654608084016123dc565b608082015260a083013560a082015260c083013560c082015261267960e084016125e4565b60e0820152610100928301359281019290925250919050565b6000602082840312156126a457600080fd5b813567ffffffffffffffff8111156126bb57600080fd5b6126c7848285016124c7565b949350505050565b600080604083850312156126e257600080fd5b823567ffffffffffffffff8111156126f957600080fd5b612705858286016124c7565b95602094909401359450505050565b6000806040838503121561272757600080fd5b50508035926020909101359150565b815163ffffffff1681526101808101602083015161275c602084018263ffffffff169052565b50604083015161277760408401826001600160a01b03169052565b50606083015161279260608401826001600160a01b03169052565b5060808301516127ad60808401826001600160a01b03169052565b5060a08301516127c860a08401826001600160a01b03169052565b5060c083015160c083015260e083015160e0830152610100808401518184015250610120808401516127fd8285018215159052565b5050610140838101519083015261016092830151929091019190915290565b60006020828403121561282e57600080fd5b813561144f816123c7565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8082018082111561085a5761085a612839565b808202811582820484141761085a5761085a612839565b6000826128c8577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b8181038181111561085a5761085a612839565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361291157612911612839565b5060010190565b60005b8381101561293357818101518382015260200161291b565b50506000910152565b60e08152600088518060e084015261010061295d8282860160208e01612918565b63ffffffff9990991660208401526001600160a01b039788166040840152959096166060820152608081019390935260a0830191909152151560c0820152601f9091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0160190910192915050565b80516123e7816125b9565b80516123e7816123c7565b80516123e7816125d6565b60006101808284031215612a0057600080fd5b612a086124a3565b612a11836129cc565b8152612a1f602084016129cc565b6020820152612a30604084016129d7565b6040820152612a41606084016129d7565b6060820152612a52608084016129d7565b6080820152612a6360a084016129d7565b60a082015260c083015160c082015260e083015160e0820152610100808401518183015250610120612a968185016129e2565b908201526101408381015190820152610160928301519281019290925250919050565b600060208284031215612acb57600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600060208284031215612b1357600080fd5b815161144f816125d6565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b60008251612b5f818460208701612918565b919091019291505056fea26469706673582212203bd946d03327296505c829a4894b0a06df193475064ebb0445d9c80a5699ab3164736f6c63430008140033","runtime-code":"0x60806040526004361061026a5760003560e01c80639010d07c11610153578063add98c70116100cb578063ca15c8731161007f578063d547741f11610064578063d547741f146107a1578063dcf844a7146107c1578063e00a83e0146107ee57600080fd5b8063ca15c8731461074d578063ccc574901461076d57600080fd5b8063b13aa2d6116100b0578063b13aa2d6146106f6578063b250fe6b14610716578063bf333f2c1461073657600080fd5b8063add98c70146106c0578063affed0e0146106e057600080fd5b8063a217fddf11610122578063a5bbe22b11610107578063a5bbe22b1461047f578063aa9641ab14610673578063ac11fb1a1461069357600080fd5b8063a217fddf1461062a578063a3ec191a1461063f57600080fd5b80639010d07c146104f857806391ad50391461053057806391d14854146105b2578063926d7d7f146105f657600080fd5b806341fcb612116101e65780635eb7d946116101b55780638379a24f1161019a5780638379a24f14610495578063886d36ff146104c55780638f0d6f17146104e557600080fd5b80635eb7d9461461045f578063820688d51461047f57600080fd5b806341fcb612146103e2578063458516941461040257806358f85880146104155780635960ccf21461042b57600080fd5b80630f5f6ed71161023d578063248a9ca311610222578063248a9ca3146103725780632f2ff15d146103a257806336568abe146103c257600080fd5b80630f5f6ed714610345578063190da5951461035b57600080fd5b806301ffc9a71461026f57806303ed0ee5146102a4578063051287bc146102e657806306f333f214610323575b600080fd5b34801561027b57600080fd5b5061028f61028a3660046122fc565b610804565b60405190151581526020015b60405180910390f35b3480156102b057600080fd5b506102d87f043c983c49d46f0e102151eaf8085d4a2e6571d5df2d47b013f39bddfd4a639d81565b60405190815260200161029b565b3480156102f257600080fd5b5061031661030136600461233e565b60056020526000908152604090205460ff1681565b60405161029b9190612386565b34801561032f57600080fd5b5061034361033e3660046123ec565b610860565b005b34801561035157600080fd5b506102d861271081565b34801561036757600080fd5b506102d862093a8081565b34801561037e57600080fd5b506102d861038d36600461233e565b60009081526020819052604090206001015490565b3480156103ae57600080fd5b506103436103bd366004612425565b610927565b3480156103ce57600080fd5b506103436103dd366004612425565b610952565b3480156103ee57600080fd5b506103436103fd366004612572565b61099e565b6103436104103660046125ef565b610bd7565b34801561042157600080fd5b506102d860025481565b34801561043757600080fd5b506102d87fdb9556138406326f00296e13ea2ad7db24ba82381212d816b1a40c23b466b32781565b34801561046b57600080fd5b5061034361047a366004612692565b610ee5565b34801561048b57600080fd5b506102d861070881565b3480156104a157600080fd5b5061028f6104b036600461233e565b60076020526000908152604090205460ff1681565b3480156104d157600080fd5b506103436104e03660046126cf565b6110bd565b6103436104f3366004612692565b6111f0565b34801561050457600080fd5b50610518610513366004612714565b611437565b6040516001600160a01b03909116815260200161029b565b34801561053c57600080fd5b5061058661054b36600461233e565b6006602052600090815260409020546bffffffffffffffffffffffff8116906c0100000000000000000000000090046001600160a01b031682565b604080516bffffffffffffffffffffffff90931683526001600160a01b0390911660208301520161029b565b3480156105be57600080fd5b5061028f6105cd366004612425565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b34801561060257600080fd5b506102d87fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc481565b34801561063657600080fd5b506102d8600081565b34801561064b57600080fd5b506102d87f000000000000000000000000000000000000000000000000000000000000000081565b34801561067f57600080fd5b5061028f61068e366004612425565b611456565b34801561069f57600080fd5b506106b36106ae366004612692565b611559565b60405161029b9190612736565b3480156106cc57600080fd5b506103436106db36600461233e565b6115cc565b3480156106ec57600080fd5b506102d860085481565b34801561070257600080fd5b5061034361071136600461233e565b611735565b34801561072257600080fd5b5061034361073136600461233e565b611817565b34801561074257600080fd5b506102d8620f424081565b34801561075957600080fd5b506102d861076836600461233e565b61187f565b34801561077957600080fd5b506102d87f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5581565b3480156107ad57600080fd5b506103436107bc366004612425565b611896565b3480156107cd57600080fd5b506102d86107dc36600461281c565b60036020526000908152604090205481565b3480156107fa57600080fd5b506102d860045481565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f5a05180f00000000000000000000000000000000000000000000000000000000148061085a575061085a826118bb565b92915050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5561088a81611952565b6001600160a01b038316600090815260036020526040812054908190036108b15750505050565b6001600160a01b0384166000818152600360205260408120556108d590848361195f565b604080516001600160a01b038087168252851660208201529081018290527f244e51bc38c1452fa8aaf487bcb4bca36c2baa3a5fbdb776b1eabd8dc6d277cd9060600160405180910390a1505b505050565b60008281526020819052604090206001015461094281611952565b61094c8383611a82565b50505050565b6001600160a01b0381163314610994576040517f6697b23200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6109228282611ab7565b7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc46109c881611952565b8251602084012060006109da85611559565b9050600260008381526005602052604090205460ff166004811115610a0157610a01612357565b14610a38576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000828152600660209081526040918290208251808401909352546bffffffffffffffffffffffff811683526c0100000000000000000000000090046001600160a01b03169082018190523314610abb576040517f4af43a9000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80516107089042036bffffffffffffffffffffffff1611610b08576040517f1992d0bd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000838152600560205260409020805460ff1916600317905561010082015115610b645761010082015160808301516001600160a01b031660009081526003602052604081208054909190610b5e908490612868565b90915550505b608082015160c0830151610b826001600160a01b038316888361195f565b604080516001600160a01b03848116825260208201849052891691339188917f582211c35a2139ac3bbaac74663c6a1f56c6cbb658b41fe11fd45a82074ac67891015b60405180910390a45050505050505050565b46816000015163ffffffff1603610c1a576040517f7029fdf900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60a08101511580610c2d575060c0810151155b15610c64576040517fe38820c800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60608101516001600160a01b03161580610c89575060808101516001600160a01b0316155b15610cc0576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610ccc61070842612868565b8161010001511015610d0a576040517f04b7fcc800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000610d1f3083606001518460a00151611ae4565b90506000806002541115610d4c57620f424060025483610d3f919061287b565b610d499190612892565b90505b610d5681836128cd565b915060006040518061018001604052804663ffffffff168152602001856000015163ffffffff16815260200185602001516001600160a01b0316815260200185604001516001600160a01b0316815260200185606001516001600160a01b0316815260200185608001516001600160a01b031681526020018481526020018560c0015181526020018381526020018560e0015115158152602001856101000151815260200160086000815480929190610e0e906128e0565b909155509052604051610e249190602001612736565b604080518083037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0018152828252805160208083019190912060008181526005835293909320805460ff191660011790558701518751606089015160808a015160c08b015160e08c015195985095966001600160a01b039094169587957f120ea0364f36cdac7983bcfdd55270ca09d7f9b314a2ebc425a3b01ab1d6403a95610ed6958b959094909390928e9261293c565b60405180910390a35050505050565b805160208201206000610ef783611559565b3360009081527fd2043bf65931af3dbecf60d0db8f40e4160406d7beb00522f4200cf4944a1eb8602052604090205490915060ff1615610f74578061014001514211610f6f576040517fe15ff9ea00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610fc0565b62093a80816101400151610f889190612868565b4211610fc0576040517fe15ff9ea00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600160008381526005602052604090205460ff166004811115610fe557610fe5612357565b1461101c576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600082815260056020526040808220805460ff19166004179055820151608083015161010084015160c0850151929391926110579190612868565b905061106d6001600160a01b038316848361195f565b604080516001600160a01b0384811682526020820184905285169187917fb4c55c0c9bc613519b920e88748090150b890a875d307f21bea7d4fb2e8bc958910160405180910390a3505050505050565b7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc46110e781611952565b82516020840120600160008281526005602052604090205460ff16600481111561111357611113612357565b1461114a576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008181526005602090815260408083208054600260ff19909116179055805180820182526bffffffffffffffffffffffff4281168252338285018181528787526006865295849020925195516001600160a01b03166c0100000000000000000000000002959091169490941790555185815283917f4ac8af8a2cd87193d64dfc7a3b8d9923b714ec528b18725d080aa1299be0c5e4910160405180910390a350505050565b7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc461121a81611952565b81516020830120600061122c84611559565b90504663ffffffff16816020015163ffffffff1614611277576040517f7029fdf900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8061014001514211156112b6576040517f559895a300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008281526007602052604090205460ff16156112ff576040517fbef7bb7d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000828152600760205260409020805460ff19166001179055606081015160a082015160e083015160045461012085015161134857506000611342848484611ae4565b506113b9565b7fffffffffffffffffffffffff11111111111111111111111111111111111111126001600160a01b0384160161138c5761134284846113878486612868565b611ae4565b611397848484611ae4565b506113b78473eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee83611ae4565b505b845160808087015160a08089015160c0808b015160e08c01516040805163ffffffff90991689526001600160a01b0396871660208a0152938616938801939093526060870152938501528301849052861691339189917ff8ae392d784b1ea5e8881bfa586d81abf07ef4f1e2fc75f7fe51c90f05199a5c9101610bc5565b600082815260016020526040812061144f9083611cb3565b9392505050565b6000600260008481526005602052604090205460ff16600481111561147d5761147d612357565b146114b4576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000838152600660209081526040918290208251808401909352546bffffffffffffffffffffffff811683526001600160a01b036c01000000000000000000000000909104811691830182905284161461153a576040517f4af43a9000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80516107089042036bffffffffffffffffffffffff1611949350505050565b604080516101808101825260008082526020808301829052928201819052606082018190526080820181905260a0820181905260c0820181905260e082018190526101008201819052610120820181905261014082018190526101608201528251909161085a91840181019084016129ed565b7f043c983c49d46f0e102151eaf8085d4a2e6571d5df2d47b013f39bddfd4a639d6115f681611952565b600260008381526005602052604090205460ff16600481111561161b5761161b612357565b14611652576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000828152600660209081526040918290208251808401909352546bffffffffffffffffffffffff8082168085526c010000000000000000000000009092046001600160a01b031693909201929092526107089142031611156116e1576040517f3e908aac00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000828152600560209081526040808320805460ff19166001179055600690915280822082905551339184917f0695cf1d39b3055dcd0fe02d8b47eaf0d5a13e1996de925de59d0ef9b7f7fad49190a35050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5561175f81611952565b6127108211156117d0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f6e657746656552617465203e206d61780000000000000000000000000000000060448201526064015b60405180910390fd5b600280549083905560408051828152602081018590527f14914da2bf76024616fbe1859783fcd4dbddcb179b1f3a854949fbf920dcb95791015b60405180910390a1505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5561184181611952565b600480549083905560408051828152602081018590527f5cf09b12f3f56b4c564d51b25b40360af6d795198adb61ae0806a36c294323fa910161180a565b600081815260016020526040812061085a90611cbf565b6000828152602081905260409020600101546118b181611952565b61094c8383611ab7565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061085a57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff0000000000000000000000000000000000000000000000000000000083161461085a565b61195c8133611cc9565b50565b306001600160a01b0383160361197457505050565b8060000361198157505050565b7fffffffffffffffffffffffff11111111111111111111111111111111111111126001600160a01b03841601611a6e576000826001600160a01b03168260405160006040518083038185875af1925050503d80600081146119fe576040519150601f19603f3d011682016040523d82523d6000602084013e611a03565b606091505b505090508061094c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f455448207472616e73666572206661696c65640000000000000000000000000060448201526064016117c7565b6109226001600160a01b0384168383611d39565b600080611a8f8484611dad565b9050801561144f576000848152600160205260409020611aaf9084611e57565b509392505050565b600080611ac48484611e6c565b9050801561144f576000848152600160205260409020611aaf9084611eef565b60006001600160a01b03831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14611c4d57611b1c836001600160a01b0316611f04565b6040517f70a082310000000000000000000000000000000000000000000000000000000081526001600160a01b0385811660048301528416906370a0823190602401602060405180830381865afa158015611b7b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b9f9190612ab9565b9050611bb66001600160a01b038416338685611faa565b6040517f70a082310000000000000000000000000000000000000000000000000000000081526001600160a01b0385811660048301528291908516906370a0823190602401602060405180830381865afa158015611c18573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c3c9190612ab9565b611c4691906128cd565b905061144f565b348214611c86576040517f81de0bf300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b0384163014611caa57611caa6001600160a01b038416858461195f565b50349392505050565b600061144f8383611fe3565b600061085a825490565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16611d35576040517fe2517d3f0000000000000000000000000000000000000000000000000000000081526001600160a01b0382166004820152602481018390526044016117c7565b5050565b6040516001600160a01b0383811660248301526044820183905261092291859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505061200d565b6000828152602081815260408083206001600160a01b038516845290915281205460ff16611e4f576000838152602081815260408083206001600160a01b03861684529091529020805460ff19166001179055611e073390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a450600161085a565b50600061085a565b600061144f836001600160a01b038416612089565b6000828152602081815260408083206001600160a01b038516845290915281205460ff1615611e4f576000838152602081815260408083206001600160a01b0386168085529252808320805460ff1916905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a450600161085a565b600061144f836001600160a01b0384166120d0565b7fffffffffffffffffffffffff11111111111111111111111111111111111111126001600160a01b03821601611f66576040517f7f523fe800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b806001600160a01b03163b60000361195c576040517f7f523fe800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040516001600160a01b03848116602483015283811660448301526064820183905261094c9186918216906323b872dd90608401611d66565b6000826000018281548110611ffa57611ffa612ad2565b9060005260206000200154905092915050565b60006120226001600160a01b038416836121c3565b905080516000141580156120475750808060200190518101906120459190612b01565b155b15610922576040517f5274afe70000000000000000000000000000000000000000000000000000000081526001600160a01b03841660048201526024016117c7565b6000818152600183016020526040812054611e4f5750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561085a565b600081815260018301602052604081205480156121b95760006120f46001836128cd565b8554909150600090612108906001906128cd565b905080821461216d57600086600001828154811061212857612128612ad2565b906000526020600020015490508087600001848154811061214b5761214b612ad2565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061217e5761217e612b1e565b60019003818190600052602060002001600090559055856001016000868152602001908152602001600020600090556001935050505061085a565b600091505061085a565b606061144f8383600084600080856001600160a01b031684866040516121e99190612b4d565b60006040518083038185875af1925050503d8060008114612226576040519150601f19603f3d011682016040523d82523d6000602084013e61222b565b606091505b509150915061223b868383612245565b9695505050505050565b60608261225a57612255826122ba565b61144f565b815115801561227157506001600160a01b0384163b155b156122b3576040517f9996b3150000000000000000000000000000000000000000000000000000000081526001600160a01b03851660048201526024016117c7565b508061144f565b8051156122ca5780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006020828403121561230e57600080fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811461144f57600080fd5b60006020828403121561235057600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b60208101600583106123c1577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b91905290565b6001600160a01b038116811461195c57600080fd5b80356123e7816123c7565b919050565b600080604083850312156123ff57600080fd5b823561240a816123c7565b9150602083013561241a816123c7565b809150509250929050565b6000806040838503121561243857600080fd5b82359150602083013561241a816123c7565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051610120810167ffffffffffffffff8111828210171561249d5761249d61244a565b60405290565b604051610180810167ffffffffffffffff8111828210171561249d5761249d61244a565b600082601f8301126124d857600080fd5b813567ffffffffffffffff808211156124f3576124f361244a565b604051601f83017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f011681019082821181831017156125395761253961244a565b8160405283815286602085880101111561255257600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000806040838503121561258557600080fd5b823567ffffffffffffffff81111561259c57600080fd5b6125a8858286016124c7565b925050602083013561241a816123c7565b63ffffffff8116811461195c57600080fd5b80356123e7816125b9565b801515811461195c57600080fd5b80356123e7816125d6565b6000610120828403121561260257600080fd5b61260a612479565b612613836125cb565b8152612621602084016123dc565b6020820152612632604084016123dc565b6040820152612643606084016123dc565b6060820152612654608084016123dc565b608082015260a083013560a082015260c083013560c082015261267960e084016125e4565b60e0820152610100928301359281019290925250919050565b6000602082840312156126a457600080fd5b813567ffffffffffffffff8111156126bb57600080fd5b6126c7848285016124c7565b949350505050565b600080604083850312156126e257600080fd5b823567ffffffffffffffff8111156126f957600080fd5b612705858286016124c7565b95602094909401359450505050565b6000806040838503121561272757600080fd5b50508035926020909101359150565b815163ffffffff1681526101808101602083015161275c602084018263ffffffff169052565b50604083015161277760408401826001600160a01b03169052565b50606083015161279260608401826001600160a01b03169052565b5060808301516127ad60808401826001600160a01b03169052565b5060a08301516127c860a08401826001600160a01b03169052565b5060c083015160c083015260e083015160e0830152610100808401518184015250610120808401516127fd8285018215159052565b5050610140838101519083015261016092830151929091019190915290565b60006020828403121561282e57600080fd5b813561144f816123c7565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8082018082111561085a5761085a612839565b808202811582820484141761085a5761085a612839565b6000826128c8577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b8181038181111561085a5761085a612839565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361291157612911612839565b5060010190565b60005b8381101561293357818101518382015260200161291b565b50506000910152565b60e08152600088518060e084015261010061295d8282860160208e01612918565b63ffffffff9990991660208401526001600160a01b039788166040840152959096166060820152608081019390935260a0830191909152151560c0820152601f9091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0160190910192915050565b80516123e7816125b9565b80516123e7816123c7565b80516123e7816125d6565b60006101808284031215612a0057600080fd5b612a086124a3565b612a11836129cc565b8152612a1f602084016129cc565b6020820152612a30604084016129d7565b6040820152612a41606084016129d7565b6060820152612a52608084016129d7565b6080820152612a6360a084016129d7565b60a082015260c083015160c082015260e083015160e0820152610100808401518183015250610120612a968185016129e2565b908201526101408381015190820152610160928301519281019290925250919050565b600060208284031215612acb57600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600060208284031215612b1357600080fd5b815161144f816125d6565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b60008251612b5f818460208701612918565b919091019291505056fea26469706673582212203bd946d03327296505c829a4894b0a06df193475064ebb0445d9c80a5699ab3164736f6c63430008140033","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.20 ^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 pure 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/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// lib/openzeppelin-contracts/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 ERC-165 detection.\n */\ninterface IAccessControl {\n /**\n * @dev The `account` is missing a role.\n */\n error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);\n\n /**\n * @dev The caller of a function is not the expected one.\n *\n * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.\n */\n error AccessControlBadConfirmation();\n\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted 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// lib/openzeppelin-contracts/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 ERC-20 standard as defined in the ERC.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the value of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the value of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 value) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n * caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 value) external returns (bool);\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\n * allowance mechanism. `value` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n\n// lib/openzeppelin-contracts/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 ERC-20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[ERC-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC-20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n *\n * ==== Security Considerations\n *\n * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\n * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\n * considered as an intention to spend the allowance in any specific way. The second is that because permits have\n * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\n * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\n * generally recommended is:\n *\n * ```solidity\n * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\n * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\n * doThing(..., value);\n * }\n *\n * function doThing(..., uint256 value) public {\n * token.safeTransferFrom(msg.sender, address(this), value);\n * ...\n * }\n * ```\n *\n * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\n * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\n * {SafeERC20-safeTransferFrom}).\n *\n * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\n * contracts should have entry points that don't rely on permit.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also 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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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 ERC-165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[ERC].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n\n// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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 ERC-165 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// lib/openzeppelin-contracts/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 ERC-165 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// lib/openzeppelin-contracts/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 ERC-20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n /**\n * @dev An operation with an ERC-20 token failed.\n */\n error SafeERC20FailedOperation(address token);\n\n /**\n * @dev Indicates a failed `decreaseAllowance` request.\n */\n error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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/FastBridge.sol\n\ncontract FastBridge is IFastBridge, Admin {\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 enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeStatus) public bridgeStatuses;\n /// @notice Proof of relayed bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeProof) public bridgeProofs;\n /// @notice Whether bridge has been relayed on destination chain\n mapping(bytes32 =\u003e bool) public bridgeRelays;\n\n /// @dev to prevent replays\n uint256 public nonce;\n // @dev 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 /// @notice Pulls a requested token from the user to the requested recipient.\n /// @dev Be careful of re-entrancy issues when msg.value \u003e 0 and recipient != address(this)\n function _pullToken(address recipient, address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token != UniversalTokenLib.ETH_ADDRESS) {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(recipient);\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, recipient, amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(recipient) - amountPulled;\n } else {\n // Otherwise, we need to check that ETH amount matches msg.value\n if (amount != msg.value) revert MsgValueIncorrect();\n // Transfer value to recipient if not this address\n if (recipient != address(this)) token.universalTransfer(recipient, amount);\n // We will forward msg.value in the external call later, if recipient is not this contract\n amountPulled = msg.value;\n }\n }\n\n /// @inheritdoc IFastBridge\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n // check bridge params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\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\n // transfer tokens to bridge contract\n // @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(address(this), 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 BridgeTransaction({\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 sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n\n // check haven't exceeded deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n\n // mark bridge transaction as relayed\n if (bridgeRelays[transactionId]) revert TransactionRelayed();\n bridgeRelays[transactionId] = true;\n\n // transfer tokens to recipient on destination chain and gas rebate if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n uint256 rebate = chainGasAmount;\n if (!transaction.sendChainGas) {\n // forward erc20\n rebate = 0;\n _pullToken(to, token, amount);\n } else if (token == UniversalTokenLib.ETH_ADDRESS) {\n // lump in gas rebate into amount in native gas token\n _pullToken(to, token, amount + rebate);\n } else {\n // forward erc20 then forward gas rebate in native gas token\n _pullToken(to, token, amount);\n _pullToken(to, UniversalTokenLib.ETH_ADDRESS, rebate);\n }\n\n emit BridgeRelayed(\n transactionId,\n msg.sender,\n to,\n transaction.originChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n rebate\n );\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n // update bridge tx status given proof provided\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = BridgeStatus.RELAYER_PROVED;\n bridgeProofs[transactionId] = BridgeProof({timestamp: uint96(block.timestamp), relayer: msg.sender}); // overflow ok\n\n emit BridgeProofProvided(transactionId, msg.sender, destTxHash);\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint96(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint96).max but\n /// proof.timestamp \u003c type(uint96).max via unchecked statement\n /// @param proof The bridge proof\n /// @return delta Time delta since proof submitted\n function _timeSince(BridgeProof memory proof) internal view returns (uint256 delta) {\n unchecked {\n delta = uint96(block.timestamp) - proof.timestamp;\n }\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != relayer) revert SenderIncorrect();\n return _timeSince(proof) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != msg.sender) revert SenderIncorrect();\n if (_timeSince(proof) \u003c= DISPUTE_PERIOD) revert DisputePeriodNotPassed();\n\n bridgeStatuses[transactionId] = 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, msg.sender, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeProofs[transactionId]) \u003e DISPUTE_PERIOD) revert DisputePeriodPassed();\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n delete bridgeProofs[transactionId];\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 BridgeTransaction memory transaction = getBridgeTransaction(request);\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 // set status to refunded if still in requested state\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = 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\n// test/FastBridgeMock.sol\n\ncontract FastBridgeMock is IFastBridge, Admin {\n // @dev 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 /// @dev to prevent replays\n uint256 public nonce;\n\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n // used for testing in go.\n // see: https://ethereum.stackexchange.com/questions/21155/how-to-expose-enum-in-solidity-contract\n // make sure to update fastbridge/status.go if this changes\n // or underliyng enum changes.\n //\n // TODO: a foundry test should be added to ensure this is always in sync.\n function getEnumKeyByValue(FastBridge.BridgeStatus keyValue) public pure returns (string memory) {\n if (FastBridge.BridgeStatus.NULL == keyValue) return \"NULL\";\n if (FastBridge.BridgeStatus.REQUESTED == keyValue) return \"REQUESTED\";\n if (FastBridge.BridgeStatus.RELAYER_PROVED == keyValue) return \"RELAYER_PROVED\";\n if (FastBridge.BridgeStatus.RELAYER_CLAIMED == keyValue) return \"RELAYER_CLAIMED\";\n if (FastBridge.BridgeStatus.REFUNDED == keyValue) return \"REFUNDED\";\n return \"\";\n }\n\n function mockBridgeRequest(bytes32 transactionId, address sender, BridgeParams memory params) external {\n uint256 originFeeAmount = (params.originAmount * protocolFeeRate) / FEE_BPS;\n params.originAmount -= originFeeAmount;\n\n bytes memory request = abi.encode(\n BridgeTransaction({\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: params.originAmount, // includes relayer fee\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n params.originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n function mockBridgeRequestRaw(bytes32 transactionId, address sender, bytes memory request) external {\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n emit BridgeRequested(\n transactionId,\n transaction.originSender,\n request,\n transaction.destChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n transaction.sendChainGas\n );\n }\n\n function mockBridgeRelayer(\n bytes32 transactionId,\n address relayer,\n address to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n )\n external\n {\n emit BridgeRelayed(\n transactionId, relayer, to, originChainId, originToken, destToken, originAmount, destAmount, chainGasAmount\n );\n }\n\n function bridge(BridgeParams memory params) external payable {\n revert(\"not implemented\");\n }\n\n function relay(bytes memory request) external payable {\n revert(\"not implemented\");\n }\n\n function prove(bytes memory request, bytes32 destTxHash) external {\n revert(\"not implemented\");\n }\n\n function canClaim(bytes32 transactionid, address relayer) external view returns (bool) {\n revert(\"not implemented\");\n }\n\n function claim(bytes memory request, address to) external {\n revert(\"not implemented\");\n }\n\n function dispute(bytes32 transactionId) external {\n revert(\"not implemented\");\n }\n\n function refund(bytes memory request) external {\n revert(\"not implemented\");\n }\n}\n","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","compilerOptions":"--combined-json bin,bin-runtime,srcmap,srcmap-runtime,abi,userdoc,devdoc,metadata,hashes --optimize --optimize-runs 10000 --allow-paths ., ./, ../ --evm-version=istanbul","srcMap":"58205:11304:0:-:0;;;59380:85;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;59414:6;57196:38;46368:4;59414:6;57196:10;:38::i;:::-;-1:-1:-1;;59446:12:0::1;59432:26;::::0;-1:-1:-1;58205:11304:0;;55681:257;55767:4;;55798:31;55815:4;55821:7;55798:16;:31::i;:::-;55783:46;;55843:7;55839:69;;;55866:18;;;;:12;:18;;;;;:31;;55889:7;55866:22;:31::i;:::-;;55839:69;55924:7;-1:-1:-1;55681:257:0;;;;;:::o;50315:316::-;50392:4;47090:12;;;;;;;;;;;-1:-1:-1;;;;;47090:29:0;;;;;;;;;;;;50408:217;;50451:6;:12;;;;;;;;;;;-1:-1:-1;;;;;50451:29:0;;;;;;;;;:36;;-1:-1:-1;;50451:36:0;50483:4;50451:36;;;50533:12;22406:10;;22327:96;50533:12;-1:-1:-1;;;;;50506:40:0;50524:7;-1:-1:-1;;;;;50506:40:0;50518:4;50506:40;;;;;;;;;;-1:-1:-1;50567:4:0;50560:11;;50408:217;-1:-1:-1;50609:5:0;50602:12;;31852:150;31922:4;31945:50;31950:3;-1:-1:-1;;;;;31970:23:0;;25840:4;27896:21;;;:14;;;:21;;;;;;25856:321;;-1:-1:-1;25898:23:0;;;;;;;;:11;:23;;;;;;;;;;;;;26080:18;;26056:21;;;:14;;;:21;;;;;;:42;;;;26112: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;58205:11304:0;;;;;;;;;;;;","srcMapRuntime":"58205:11304:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;54341:212;;;;;;;;;;-1:-1:-1;54341:212:0;;;;;:::i;:::-;;:::i;:::-;;;612:14:1;;605:22;587:41;;575:2;560:18;54341:212:0;;;;;;;;56571:60;;;;;;;;;;;;56608:23;56571:60;;;;;785:25:1;;;773:2;758:18;56571:60:0;639:177:1;58932:54:0;;;;;;;;;;-1:-1:-1;58932:54:0;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;:::i;57543:359::-;;;;;;;;;;-1:-1:-1;57543:359:0;;;;;:::i;:::-;;:::i;:::-;;56753:45;;;;;;;;;;;;56792:6;56753:45;;58530;;;;;;;;;;;;58569:6;58530:45;;47946:120;;;;;;;;;;-1:-1:-1;47946:120:0;;;;;:::i;:::-;48011:7;48037:12;;;;;;;;;;:22;;;;47946:120;48362:136;;;;;;;;;;-1:-1:-1;48362:136:0;;;;;:::i;:::-;;:::i;49464:245::-;;;;;;;;;;-1:-1:-1;49464:245:0;;;;;:::i;:::-;;:::i;66607:1146::-;;;;;;;;;;-1:-1:-1;66607:1146:0;;;;;:::i;:::-;;:::i;61065:2114::-;;;;;;:::i;:::-;;:::i;56915:30::-;;;;;;;;;;;;;;;;56499:66;;;;;;;;;;;;56539:26;56499:66;;68354:1153;;;;;;;;;;-1:-1:-1;68354:1153:0;;;;;:::i;:::-;;:::i;58662:56::-;;;;;;;;;;;;58708:10;58662:56;;59177:44;;;;;;;;;;-1:-1:-1;59177:44:0;;;;;:::i;:::-;;;;;;;;;;;;;;;;64973:567;;;;;;;;;;-1:-1:-1;64973:567:0;;;;;:::i;:::-;;:::i;63217:1718::-;;;;;;:::i;:::-;;:::i;55138:142::-;;;;;;;;;;-1:-1:-1;55138:142:0;;;;;:::i;:::-;;:::i;:::-;;;-1:-1:-1;;;;;7391:55:1;;;7373:74;;7361:2;7346:18;55138:142:0;7227:226:1;59051:51:0;;;;;;;;;;-1:-1:-1;59051:51:0;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;59051:51:0;;;;;;;7660:26:1;7648:39;;;7630:58;;-1:-1:-1;;;;;7724:55:1;;;7719:2;7704:18;;7697:83;7603:18;59051:51:0;7458:328:1;46990:136:0;;;;;;;;;;-1:-1:-1;46990:136:0;;;;;:::i;:::-;47067:4;47090:12;;;;;;;;;;;-1:-1:-1;;;;;47090:29:0;;;;;;;;;;;;;;;46990:136;56429:64;;;;;;;;;;;;56468:25;56429:64;;46323:49;;;;;;;;;;-1:-1:-1;46323:49:0;46368:4;46323:49;;59337:36;;;;;;;;;;;;;;;66196:373;;;;;;;;;;-1:-1:-1;66196:373:0;;;;;:::i;:::-;;:::i;60864:163::-;;;;;;;;;;-1:-1:-1;60864:163:0;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;67791:525::-;;;;;;;;;;-1:-1:-1;67791:525:0;;;;;:::i;:::-;;:::i;59260:20::-;;;;;;;;;;;;;;;;57247:290;;;;;;;;;;-1:-1:-1;57247:290:0;;;;;:::i;:::-;;:::i;57908:264::-;;;;;;;;;;-1:-1:-1;57908:264:0;;;;;:::i;:::-;;:::i;56710:37::-;;;;;;;;;;;;56744:3;56710:37;;55448:131;;;;;;;;;;-1:-1:-1;55448:131:0;;;;;:::i;:::-;;:::i;56637:66::-;;;;;;;;;;;;56677:26;56637:66;;48778:138;;;;;;;;;;-1:-1:-1;48778:138:0;;;;;:::i;:::-;;:::i;57001:47::-;;;;;;;;;;-1:-1:-1;57001:47:0;;;;;:::i;:::-;;;;;;;;;;;;;;57122:29;;;;;;;;;;;;;;;;54341:212;54426:4;54449:57;;;54464:42;54449:57;;:97;;;54510:36;54534:11;54510:23;:36::i;:::-;54442:104;54341:212;-1:-1:-1;;54341:212:0:o;57543:359::-;56677:26;46600:16;46611:4;46600:10;:16::i;:::-;-1:-1:-1;;;;;57667:19:0;::::1;57647:17;57667:19:::0;;;:12:::1;:19;::::0;;;;;;57700:14;;;57696:27:::1;;57716:7;57543:359:::0;;;:::o;57696:27::-:1;-1:-1:-1::0;;;;;57764:19:0;::::1;57786:1;57764:19:::0;;;:12:::1;:19;::::0;;;;:23;57797:45:::1;::::0;57821:9;57832;57797:23:::1;:45::i;:::-;57857:38;::::0;;-1:-1:-1;;;;;9986:15:1;;;9968:34;;10038:15;;10033:2;10018:18;;10011:43;10070:18;;;10063:34;;;57857:38:0::1;::::0;9895:2:1;9880:18;57857:38:0::1;;;;;;;57637:265;46626:1;57543:359:::0;;;:::o;48362:136::-;48011:7;48037:12;;;;;;;;;;:22;;;46600:16;46611:4;46600:10;:16::i;:::-;48466:25:::1;48477:4;48483:7;48466:10;:25::i;:::-;;48362:136:::0;;;:::o;49464:245::-;-1:-1:-1;;;;;49557:34:0;;22406:10;49557:34;49553:102;;49614:30;;;;;;;;;;;;;;49553:102;49665:37;49677:4;49683:18;49665:11;:37::i;66607:1146::-;56468:25;46600:16;46611:4;46600:10;:16::i;:::-;66722:18;;::::1;::::0;::::1;::::0;66698:21:::1;66789:29;66732:7:::0;66789:20:::1;:29::i;:::-;66750:68:::0;-1:-1:-1;66936:27:0::1;66903:29;::::0;;;:14:::1;:29;::::0;;;;;::::1;;:60;::::0;::::1;;;;;;:::i;:::-;;66899:90;;66972:17;;;;;;;;;;;;;;66899:90;67000:24;67027:27:::0;;;:12:::1;:27;::::0;;;;;;;;67000:54;;;;::::1;::::0;;;;::::1;::::0;::::1;::::0;;;;::::1;-1:-1:-1::0;;;;;67000:54:0::1;::::0;;::::1;::::0;;;67085:10:::1;67068:27;67064:57;;67104:17;;;;;;;;;;;;;;67064:57;66126:15:::0;;58424:10:::1;::::0;66107:15;66100:41;66092:49;;67135:35:::1;67131:72;;67179:24;;;;;;;;;;;;;;67131:72;67214:29;::::0;;;:14:::1;:29;::::0;;;;:60;;-1:-1:-1;;67214:60:0::1;67246:28;67214:60;::::0;;67349:27:::1;::::0;::::1;::::0;:31;67345:105:::1;;67423:27;::::0;::::1;::::0;67395:23:::1;::::0;::::1;::::0;-1:-1:-1;;;;;67382:37:0::1;;::::0;;;:12:::1;:37;::::0;;;;:68;;:37;;;:68:::1;::::0;67423:27;;67382:68:::1;:::i;:::-;::::0;;;-1:-1:-1;;67345:105:0::1;67545:23;::::0;::::1;::::0;67595:24:::1;::::0;::::1;::::0;67629:35:::1;-1:-1:-1::0;;;;;67629:23:0;::::1;67653:2:::0;67595:24;67629:23:::1;:35::i;:::-;67680:66;::::0;;-1:-1:-1;;;;;10619:55:1;;;10601:74;;10706:2;10691:18;;10684:34;;;67680:66:0;::::1;::::0;67716:10:::1;::::0;67701:13;;67680:66:::1;::::0;10574:18:1;67680:66:0::1;;;;;;;;66688:1065;;;;;66607:1146:::0;;;:::o;61065:2114::-;61192:13;61171:6;:17;;;:34;;;61167:63;;61214:16;;;;;;;;;;;;;;61167:63;61244:19;;;;:24;;:50;;-1:-1:-1;61272:17:0;;;;:22;61244:50;61240:80;;;61303:17;;;;;;;;;;;;;;61240:80;61334:18;;;;-1:-1:-1;;;;;61334:32:0;;;:66;;-1:-1:-1;61370:16:0;;;;-1:-1:-1;;;;;61370:30:0;;61334:66;61330:92;;;61409:13;;;;;;;;;;;;;;61330:92;61454:37;58708:10;61454:15;:37;:::i;:::-;61436:6;:15;;;:55;61432:86;;;61500:18;;;;;;;;;;;;;;61432:86;61653:20;61676:66;61695:4;61702:6;:18;;;61722:6;:19;;;61676:10;:66::i;:::-;61653:89;;61810:23;61865:1;61847:15;;:19;61843:85;;;56744:3;61902:15;;61887:12;:30;;;;:::i;:::-;61886:42;;;;:::i;:::-;61868:60;;61843:85;61938:31;61954:15;61938:31;;:::i;:::-;;;62082:20;62129:618;;;;;;;;62187:13;62129:618;;;;;;62232:6;:17;;;62129:618;;;;;;62281:6;:13;;;-1:-1:-1;;;;;62129:618:0;;;;;62327:6;:9;;;-1:-1:-1;;;;;62129:618:0;;;;;62367:6;:18;;;-1:-1:-1;;;;;62129:618:0;;;;;62414:6;:16;;;-1:-1:-1;;;;;62129:618:0;;;;;62462:12;62129:618;;;;62504:6;:17;;;62129:618;;;;62556:15;62129:618;;;;62603:6;:19;;;62129:618;;;;;;62650:6;:15;;;62129:618;;;;62690:5;;:7;;;;;;;;;:::i;:::-;;;;-1:-1:-1;62129:618:0;;62105:652;;;;;;;;:::i;:::-;;;;;;;;;;;;;;62791:18;;62105:652;62791:18;;;;;;;62767:21;62819:29;;;:14;:29;;;;;;:54;;-1:-1:-1;;62819:54:0;62851:22;62819:54;;;62945:13;;;62993:17;;63024:18;;;;63056:16;;;;63112:17;;;;63143:19;;;;62105:652;;-1:-1:-1;62791:18:0;;-1:-1:-1;;;;;62889:283:0;;;;62791:18;;62889:283;;;;62105:652;;62993:17;;63024:18;;63056:16;;63086:12;;62889:283;:::i;:::-;;;;;;;;61126:2053;;;;61065:2114;:::o;68354:1153::-;68435:18;;;;;;68411:21;68502:29;68445:7;68502:20;:29::i;:::-;68569:10;47067:4;47090:29;;;:12;;:29;:12;:29;;;68463:68;;-1:-1:-1;47090:29:0;;68542:382;;;68677:11;:20;;;68658:15;:39;68654:73;;68706:21;;;;;;;;;;;;;;68654:73;68542:382;;;58569:6;68848:11;:20;;;:35;;;;:::i;:::-;68829:15;:54;68825:88;;68892:21;;;;;;;;;;;;;;68825:88;69033:22;69000:29;;;;:14;:29;;;;;;;;:55;;;;;;;;:::i;:::-;;68996:85;;69064:17;;;;;;;;;;;;;;68996:85;69091:29;;;;:14;:29;;;;;;:53;;-1:-1:-1;;69091:53:0;69123:21;69091:53;;;69230:24;;;69280:23;;;;69357:27;;;;69330:24;;;;69230;;69280:23;;69330:54;;69357:27;69330:54;:::i;:::-;69313:71;-1:-1:-1;69394:35:0;-1:-1:-1;;;;;69394:23:0;;69418:2;69313:71;69394:23;:35::i;:::-;69445:55;;;-1:-1:-1;;;;;10619:55:1;;;10601:74;;10706:2;10691:18;;10684:34;;;69445:55:0;;;69467:13;;69445:55;;10574:18:1;69445:55:0;;;;;;;68401:1106;;;;;68354:1153;:::o;64973:567::-;56468:25;46600:16;46611:4;46600:10;:16::i;:::-;65096:18;;::::1;::::0;::::1;::::0;65217:22:::1;65184:29;::::0;;;:14:::1;:29;::::0;;;;;::::1;;:55;::::0;::::1;;;;;;:::i;:::-;;65180:85;;65248:17;;;;;;;;;;;;;;65180:85;65275:29;::::0;;;:14:::1;:29;::::0;;;;;;;:59;;65307:27:::1;-1:-1:-1::0;;65275:59:0;;::::1;;::::0;;65374:70;;;;::::1;::::0;;::::1;65405:15;65374:70:::0;::::1;::::0;;65432:10:::1;65374:70:::0;;::::1;::::0;;;65344:27;;;:12:::1;:27:::0;;;;;;:100;;;;-1:-1:-1;;;;;65344:100:0::1;::::0;::::1;::::0;;;::::1;::::0;;;::::1;::::0;;65475:58;785:25:1;;;65275:29:0;;65475:58:::1;::::0;758:18:1;65475:58:0::1;;;;;;;65062:478;64973:567:::0;;;:::o;63217:1718::-;56468:25;46600:16;46611:4;46600:10;:16::i;:::-;63328:18;;::::1;::::0;::::1;::::0;63304:21:::1;63395:29;63338:7:::0;63395:20:::1;:29::i;:::-;63356:68;;63472:13;63438:48;;:11;:23;;;:48;;;63434:77;;63495:16;;;;;;;;;;;;;;63434:77;63607:11;:20;;;63589:15;:38;63585:69;;;63636:18;;;;;;;;;;;;;;63585:69;63715:27;::::0;;;:12:::1;:27;::::0;;;;;::::1;;63711:60;;;63751:20;;;;;;;;;;;;;;63711:60;63781:27;::::0;;;:12:::1;:27;::::0;;;;:34;;-1:-1:-1;;63781:34:0::1;63811:4;63781:34;::::0;;63928:25:::1;::::0;::::1;::::0;63979:21:::1;::::0;::::1;::::0;64027:22:::1;::::0;::::1;::::0;64077:14:::1;::::0;64106:24:::1;::::0;::::1;::::0;64101:517:::1;;-1:-1:-1::0;64184:1:0::1;64199:29;64210:2:::0;64214:5;64221:6;64199:10:::1;:29::i;:::-;;64101:517;;;64249:38:::0;-1:-1:-1;;;;;64249:38:0;::::1;::::0;64245:373:::1;;64369:38;64380:2:::0;64384:5;64391:15:::1;64400:6:::0;64391;:15:::1;:::i;:::-;64369:10;:38::i;64245:373::-;64511:29;64522:2;64526:5;64533:6;64511:10;:29::i;:::-;;64554:53;64565:2;51330:42;64600:6;64554:10;:53::i;:::-;;64245:373;64727:25:::0;;64766:23:::1;::::0;;::::1;::::0;64803:21:::1;::::0;;::::1;::::0;64838:24:::1;::::0;;::::1;::::0;64876:22:::1;::::0;::::1;::::0;64633:295:::1;::::0;;13103:10:1;13091:23;;;13073:42;;-1:-1:-1;;;;;13212:15:1;;;13207:2;13192:18;;13185:43;13264:15;;;13244:18;;;13237:43;;;;13311:2;13296:18;;13289:34;13339:19;;;13332:35;13383:19;;13376:35;;;64633:295:0;::::1;::::0;64687:10:::1;::::0;64660:13;;64633:295:::1;::::0;13045:19:1;64633:295:0::1;12788:629:1::0;55138:142:0;55219:7;55245:18;;;:12;:18;;;;;:28;;55267:5;55245:21;:28::i;:::-;55238:35;55138:142;-1:-1:-1;;;55138:142:0:o;66196:373::-;66277:4;66330:27;66297:29;;;;:14;:29;;;;;;;;:60;;;;;;;;:::i;:::-;;66293:90;;66366:17;;;;;;;;;;;;;;66293:90;66393:24;66420:27;;;:12;:27;;;;;;;;;66393:54;;;;;;;;;;;;;;-1:-1:-1;;;;;66393:54:0;;;;;;;;;;;;66461:24;;;66457:54;;66494:17;;;;;;;;;;;;;;66457:54;66126:15;;58424:10;;66107:15;66100:41;66092:49;;66528:34;;66196:373;-1:-1:-1;;;;66196:373:0:o;60864:163::-;-1:-1:-1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;60980:40:0;;-1:-1:-1;;60980:40:0;;;;;;;;;;:::i;67791:525::-;56608:23;46600:16;46611:4;46600:10;:16::i;:::-;67908:27:::1;67875:29;::::0;;;:14:::1;:29;::::0;;;;;::::1;;:60;::::0;::::1;;;;;;:::i;:::-;;67871:90;;67944:17;;;;;;;;;;;;;;67871:90;67986:27;::::0;;;:12:::1;:27;::::0;;;;;;;;67975:39;;;;::::1;::::0;;;;::::1;::::0;;::::1;::::0;;;;;;::::1;-1:-1:-1::0;;;;;67975:39:0::1;::::0;;;::::1;::::0;;;;58424:10:::1;::::0;66107:15;66100:41;66092:49;67975:56:::1;67971:90;;;68040:21;;;;;;;;;;;;;;67971:90;68149:29;::::0;;;:14:::1;:29;::::0;;;;;;;:54;;-1:-1:-1;;68149:54:0::1;68181:22;68149:54;::::0;;68220:12:::1;:27:::0;;;;;;68213:34;;;68263:46;68298:10:::1;::::0;68149:29;;68263:46:::1;::::0;68149:29;68263:46:::1;67791:525:::0;;:::o;57247:290::-;56677:26;46600:16;46611:4;46600:10;:16::i;:::-;56792:6:::1;57346:10;:26;;57338:55;;;::::0;::::1;::::0;;15233:2:1;57338:55:0::1;::::0;::::1;15215:21:1::0;15272:2;15252:18;;;15245:30;15311:18;15291;;;15284:46;15347:18;;57338:55:0::1;;;;;;;;;57424:15;::::0;;57449:28;;;;57492:38:::1;::::0;;15550:25:1;;;15606:2;15591:18;;15584:34;;;57492:38:0::1;::::0;15523:18:1;57492:38:0::1;;;;;;;;57328:209;57247:290:::0;;:::o;57908:264::-;56677:26;46600:16;46611:4;46600:10;:16::i;:::-;58033:14:::1;::::0;;58057:34;;;;58106:59:::1;::::0;;15550:25:1;;;15606:2;15591:18;;15584:34;;;58106:59:0::1;::::0;15523:18:1;58106:59:0::1;15376:248:1::0;55448:131:0;55519:7;55545:18;;;:12;:18;;;;;:27;;:25;:27::i;48778:138::-;48011:7;48037:12;;;;;;;;;;:22;;;46600:16;46611:4;46600:10;:16::i;:::-;48883:26:::1;48895:4;48901:7;48883:11;:26::i;46701:202::-:0;46786:4;46809:47;;;46824:32;46809:47;;:87;;-1:-1:-1;38614:25:0;38599:40;;;;46860:36;38500:146;47335:103;47401:30;47412:4;22406:10;47401;:30::i;:::-;47335:103;:::o;51613:653::-;51788:4;-1:-1:-1;;;;;51774:19:0;;;51770:32;;51613:653;;;:::o;51770:32::-;51874:5;51883:1;51874:10;51870:23;;51613:653;;;:::o;51870:23::-;51906:20;-1:-1:-1;;;;;51906:20:0;;;51902:358;;52086:12;52103:2;-1:-1:-1;;;;;52103:7:0;52118:5;52103:25;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;52085:43;;;52150:7;52142:39;;;;;;;16041:2:1;52142:39:0;;;16023:21:1;16080:2;16060:18;;;16053:30;16119:21;16099:18;;;16092:49;16158:18;;52142:39:0;15839:343:1;51902:358:0;52212:37;-1:-1:-1;;;;;52212:26:0;;52239:2;52243:5;52212:26;:37::i;55681:257::-;55767:4;55783:12;55798:31;55815:4;55821:7;55798:16;:31::i;:::-;55783:46;;55843:7;55839:69;;;55866:18;;;;:12;:18;;;;;:31;;55889:7;55866:22;:31::i;:::-;;55924:7;55681:257;-1:-1:-1;;;55681:257:0:o;56041:262::-;56128:4;56144:12;56159:32;56177:4;56183:7;56159:17;:32::i;:::-;56144:47;;56205:7;56201:72;;;56228:18;;;;:12;:18;;;;;:34;;56254:7;56228:25;:34::i;59649:1177::-;59737:20;-1:-1:-1;;;;;59773:38:0;;51330:42;59773:38;59769:1051;;59827:24;:5;-1:-1:-1;;;;;59827:22:0;;:24::i;:::-;59932:34;;;;;-1:-1:-1;;;;;7391:55:1;;;59932:34:0;;;7373:74:1;59932:23:0;;;;;7346:18:1;;59932:34:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;59917:49;-1:-1:-1;60112:61:0;-1:-1:-1;;;;;60112:30:0;;60143:10;60155:9;60166:6;60112:30;:61::i;:::-;60309:34;;;;;-1:-1:-1;;;;;7391:55:1;;;60309:34:0;;;7373:74:1;60346:12:0;;60309:23;;;;;;7346:18:1;;60309:34:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;:49;;;;:::i;:::-;60294:64;;59769:1051;;;60480:9;60470:6;:19;60466:51;;60498:19;;;;;;;;;;;;;;60466:51;-1:-1:-1;;;;;60598:26:0;;60619:4;60598:26;60594:74;;60626:42;-1:-1:-1;;;;;60626:23:0;;60650:9;60661:6;60626:23;:42::i;:::-;-1:-1:-1;60800:9:0;59649:1177;;;;;:::o;33110:156::-;33184:7;33234:22;33238:3;33250:5;33234:3;:22::i;32653:115::-;32716:7;32742:19;32750:3;28092:18;;28010:107;47568:197;47067:4;47090:12;;;;;;;;;;;-1:-1:-1;;;;;47090:29:0;;;;;;;;;;;;47651:108;;47701:47;;;;;-1:-1:-1;;;;;10619:55:1;;47701:47:0;;;10601:74:1;10691:18;;;10684:34;;;10574:18;;47701:47:0;10427:297:1;47651:108:0;47568:197;;:::o;39818:160::-;39927:43;;-1:-1:-1;;;;;10619:55:1;;;39927:43:0;;;10601:74:1;10691:18;;;10684:34;;;39900:71:0;;39920:5;;39942:14;;;;;10574:18:1;;39927:43:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;39900:19;:71::i;50315:316::-;50392:4;47090:12;;;;;;;;;;;-1:-1:-1;;;;;47090:29:0;;;;;;;;;;;;50408:217;;50451:6;:12;;;;;;;;;;;-1:-1:-1;;;;;50451:29:0;;;;;;;;;:36;;-1:-1:-1;;50451:36:0;50483:4;50451:36;;;50533:12;22406:10;;22327:96;50533:12;-1:-1:-1;;;;;50506:40:0;50524:7;-1:-1:-1;;;;;50506:40:0;50518:4;50506:40;;;;;;;;;;-1:-1:-1;50567:4:0;50560:11;;50408:217;-1:-1:-1;50609:5:0;50602:12;;31852:150;31922:4;31945:50;31950:3;-1:-1:-1;;;;;31970:23:0;;31945:4;:50::i;50866:317::-;50944:4;47090:12;;;;;;;;;;;-1:-1:-1;;;;;47090:29:0;;;;;;;;;;;;50960:217;;;51034:5;51002:12;;;;;;;;;;;-1:-1:-1;;;;;51002:29:0;;;;;;;;;;:37;;-1:-1:-1;;51002:37:0;;;51058:40;22406:10;;51002:12;;51058:40;;51034:5;51058:40;-1:-1:-1;51119:4:0;51112:11;;32170:156;32243:4;32266:53;32274:3;-1:-1:-1;;;;;32294:23:0;;32266:7;:53::i;53430:344::-;53597:38;-1:-1:-1;;;;;53597:38:0;;;53593:69;;53644:18;;;;;;;;;;;;;;53593:69;53718:5;-1:-1:-1;;;;;53718:17:0;;53739:1;53718:22;53714:53;;53749:18;;;;;;;;;;;;;;40217:188;40344:53;;-1:-1:-1;;;;;9986:15:1;;;40344:53:0;;;9968:34:1;10038:15;;;10018:18;;;10011:43;10070:18;;;10063:34;;;40317:81:0;;40337:5;;40359:18;;;;;9880::1;;40344:53:0;9705:398:1;28459:118:0;28526:7;28552:3;:11;;28564:5;28552:18;;;;;;;;:::i;:::-;;;;;;;;;28545:25;;28459:118;;;;:::o;42574:629::-;42993:23;43019:33;-1:-1:-1;;;;;43019:27:0;;43047:4;43019:27;:33::i;:::-;42993:59;;43066:10;:17;43087:1;43066:22;;:57;;;;;43104:10;43093:30;;;;;;;;;;;;:::i;:::-;43092:31;43066:57;43062:135;;;43146:40;;;;;-1:-1:-1;;;;;7391:55:1;;43146:40:0;;;7373:74:1;7346:18;;43146:40:0;7227:226:1;25777:406:0;25840:4;27896:21;;;:14;;;:21;;;;;;25856:321;;-1:-1:-1;25898:23:0;;;;;;;;:11;:23;;;;;;;;;;;;;26080:18;;26056:21;;;:14;;;:21;;;;;;:42;;;;26112:11;;26351:1368;26417:4;26546:21;;;:14;;;:21;;;;;;26582:13;;26578:1135;;26949:18;26970:12;26981:1;26970:8;:12;:::i;:::-;27016:18;;26949:33;;-1:-1:-1;26996:17:0;;27016:22;;27037:1;;27016:22;:::i;:::-;26996:42;;27071:9;27057:10;:23;27053:378;;27100:17;27120:3;:11;;27132:9;27120:22;;;;;;;;:::i;:::-;;;;;;;;;27100:42;;27267:9;27241:3;:11;;27253:10;27241:23;;;;;;;;:::i;:::-;;;;;;;;;;;;:35;;;;27380:25;;;:14;;;:25;;;;;:36;;;27053:378;27509:17;;:3;;:17;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;27612:3;:14;;:21;27627:5;27612:21;;;;;;;;;;;27605:28;;;27655:4;27648:11;;;;;;;26578:1135;27697:5;27690:12;;;;;18112:151;18187:12;18218:38;18240:6;18248:4;18254:1;18187:12;18828;18842:23;18869:6;-1:-1:-1;;;;;18869:11:0;18888:5;18895:4;18869:31;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;18827:73;;;;18917:55;18944:6;18952:7;18961:10;18917:26;:55::i;:::-;18910:62;18587:392;-1:-1:-1;;;;;;18587:392:0:o;20032:582::-;20176:12;20205:7;20200:408;;20228:19;20236:10;20228:7;:19::i;:::-;20200:408;;;20452:17;;:22;:49;;;;-1:-1:-1;;;;;;20478:18:0;;;:23;20452:49;20448:119;;;20528:24;;;;;-1:-1:-1;;;;;7391:55:1;;20528:24:0;;;7373:74:1;7346:18;;20528:24:0;7227:226:1;20448:119:0;-1:-1:-1;20587:10:0;20580:17;;21150:516;21281:17;;:21;21277:383;;21509:10;21503:17;21565:15;21552:10;21548:2;21544:19;21537:44;21277:383;21632: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:402;1344:2;1329:18;;1377:1;1366:13;;1356:201;;1413:77;1410:1;1403:88;1514:4;1511:1;1504:15;1542:4;1539:1;1532:15;1356:201;1566:25;;;1195:402;:::o;1602:154::-;-1:-1:-1;;;;;1681:5:1;1677:54;1670:5;1667:65;1657:93;;1746:1;1743;1736:12;1761:134;1829:20;;1858:31;1829:20;1858:31;:::i;:::-;1761:134;;;:::o;1900:388::-;1968:6;1976;2029:2;2017:9;2008:7;2004:23;2000:32;1997:52;;;2045:1;2042;2035:12;1997:52;2084:9;2071:23;2103:31;2128:5;2103:31;:::i;:::-;2153:5;-1:-1:-1;2210:2:1;2195:18;;2182:32;2223:33;2182:32;2223:33;:::i;:::-;2275:7;2265:17;;;1900:388;;;;;:::o;2475:315::-;2543:6;2551;2604:2;2592:9;2583:7;2579:23;2575:32;2572:52;;;2620:1;2617;2610:12;2572:52;2656:9;2643:23;2633:33;;2716:2;2705:9;2701:18;2688:32;2729:31;2754:5;2729:31;:::i;2795:184::-;2847:77;2844:1;2837:88;2944:4;2941:1;2934:15;2968:4;2965:1;2958:15;2984:252;3056:2;3050:9;3098:3;3086:16;;3132:18;3117:34;;3153:22;;;3114:62;3111:88;;;3179:18;;:::i;:::-;3215:2;3208:22;2984:252;:::o;3241:247::-;3308:2;3302:9;3350:3;3338:16;;3384:18;3369:34;;3405:22;;;3366:62;3363:88;;;3431:18;;:::i;3493:777::-;3535:5;3588:3;3581:4;3573:6;3569:17;3565:27;3555:55;;3606:1;3603;3596:12;3555:55;3642:6;3629:20;3668:18;3705:2;3701;3698:10;3695:36;;;3711:18;;:::i;:::-;3845:2;3839:9;3907:4;3899:13;;3750:66;3895:22;;;3919:2;3891:31;3887:40;3875:53;;;3943:18;;;3963:22;;;3940:46;3937:72;;;3989:18;;:::i;:::-;4029:10;4025:2;4018:22;4064:2;4056:6;4049:18;4110:3;4103:4;4098:2;4090:6;4086:15;4082:26;4079:35;4076:55;;;4127:1;4124;4117:12;4076:55;4191:2;4184:4;4176:6;4172:17;4165:4;4157:6;4153:17;4140:54;4238:1;4231:4;4226:2;4218:6;4214:15;4210:26;4203:37;4258:6;4249:15;;;;;;3493:777;;;;:::o;4275:455::-;4352:6;4360;4413:2;4401:9;4392:7;4388:23;4384:32;4381:52;;;4429:1;4426;4419:12;4381:52;4469:9;4456:23;4502:18;4494:6;4491:30;4488:50;;;4534:1;4531;4524:12;4488:50;4557:49;4598:7;4589:6;4578:9;4574:22;4557:49;:::i;:::-;4547:59;;;4656:2;4645:9;4641:18;4628:32;4669:31;4694:5;4669:31;:::i;4735:121::-;4820:10;4813:5;4809:22;4802:5;4799:33;4789:61;;4846:1;4843;4836:12;4861:132;4928:20;;4957:30;4928:20;4957:30;:::i;4998:118::-;5084:5;5077:13;5070:21;5063:5;5060:32;5050:60;;5106:1;5103;5096:12;5121:128;5186:20;;5215:28;5186:20;5215:28;:::i;5254:865::-;5342:6;5395:3;5383:9;5374:7;5370:23;5366:33;5363:53;;;5412:1;5409;5402:12;5363:53;5438:22;;:::i;:::-;5483:28;5501:9;5483:28;:::i;:::-;5476:5;5469:43;5544:38;5578:2;5567:9;5563:18;5544:38;:::i;:::-;5539:2;5532:5;5528:14;5521:62;5615:38;5649:2;5638:9;5634:18;5615:38;:::i;:::-;5610:2;5603:5;5599:14;5592:62;5686:38;5720:2;5709:9;5705:18;5686:38;:::i;:::-;5681:2;5674:5;5670:14;5663:62;5758:39;5792:3;5781:9;5777:19;5758:39;:::i;:::-;5752:3;5745:5;5741:15;5734:64;5859:3;5848:9;5844:19;5831:33;5825:3;5818:5;5814:15;5807:58;5926:3;5915:9;5911:19;5898:33;5892:3;5885:5;5881:15;5874:58;5965:36;5996:3;5985:9;5981:19;5965:36;:::i;:::-;5959:3;5948:15;;5941:61;6021:3;6069:18;;;6056:32;6040:14;;;6033:56;;;;-1:-1:-1;5952:5:1;5254:865;-1:-1:-1;5254:865:1:o;6124:320::-;6192:6;6245:2;6233:9;6224:7;6220:23;6216:32;6213:52;;;6261:1;6258;6251:12;6213:52;6301:9;6288:23;6334:18;6326:6;6323:30;6320:50;;;6366:1;6363;6356:12;6320:50;6389:49;6430:7;6421:6;6410:9;6406:22;6389:49;:::i;:::-;6379:59;6124:320;-1:-1:-1;;;;6124:320:1:o;6449:388::-;6526:6;6534;6587:2;6575:9;6566:7;6562:23;6558:32;6555:52;;;6603:1;6600;6593:12;6555:52;6643:9;6630:23;6676:18;6668:6;6665:30;6662:50;;;6708:1;6705;6698:12;6662:50;6731:49;6772:7;6763:6;6752:9;6748:22;6731:49;:::i;:::-;6721:59;6827:2;6812:18;;;;6799:32;;-1:-1:-1;;;;6449:388:1:o;6842:248::-;6910:6;6918;6971:2;6959:9;6950:7;6946:23;6942:32;6939:52;;;6987:1;6984;6977:12;6939:52;-1:-1:-1;;7010:23:1;;;7080:2;7065:18;;;7052:32;;-1:-1:-1;6842:248:1:o;7890:1373::-;8121:13;;7867:10;7856:22;7844:35;;8090:3;8075:19;;8193:4;8185:6;8181:17;8175:24;8208:53;8255:4;8244:9;8240:20;8226:12;7867:10;7856:22;7844:35;;7791:94;8208:53;;8310:4;8302:6;8298:17;8292:24;8325:56;8375:4;8364:9;8360:20;8344:14;-1:-1:-1;;;;;7161:54:1;7149:67;;7095:127;8325:56;;8430:4;8422:6;8418:17;8412:24;8445:56;8495:4;8484:9;8480:20;8464:14;-1:-1:-1;;;;;7161:54:1;7149:67;;7095:127;8445:56;;8550:4;8542:6;8538:17;8532:24;8565:56;8615:4;8604:9;8600:20;8584:14;-1:-1:-1;;;;;7161:54:1;7149:67;;7095:127;8565:56;;8670:4;8662:6;8658:17;8652:24;8685:56;8735:4;8724:9;8720:20;8704:14;-1:-1:-1;;;;;7161:54:1;7149:67;;7095:127;8685:56;;8797:4;8789:6;8785:17;8779:24;8772:4;8761:9;8757:20;8750:54;8860:4;8852:6;8848:17;8842:24;8835:4;8824:9;8820:20;8813:54;8886:6;8946:2;8938:6;8934:15;8928:22;8923:2;8912:9;8908:18;8901:50;;8970:6;9025:2;9017:6;9013:15;9007:22;9038:51;9085:2;9074:9;9070:18;9054:14;421:13;414:21;402:34;;351:91;9038:51;-1:-1:-1;;9108:6:1;9156:15;;;9150:22;9130:18;;;9123:50;9192:6;9240:15;;;9234:22;9214:18;;;;9207:50;;;;7890:1373;:::o;9453:247::-;9512:6;9565:2;9553:9;9544:7;9540:23;9536:32;9533:52;;;9581:1;9578;9571:12;9533:52;9620:9;9607:23;9639:31;9664:5;9639:31;:::i;10108:184::-;10160:77;10157:1;10150:88;10257:4;10254:1;10247:15;10281:4;10278:1;10271:15;10297:125;10362:9;;;10383:10;;;10380:36;;;10396:18;;:::i;10729:168::-;10802:9;;;10833;;10850:15;;;10844:22;;10830:37;10820:71;;10871:18;;:::i;10902:274::-;10942:1;10968;10958:189;;11003:77;11000:1;10993:88;11104:4;11101:1;11094:15;11132:4;11129:1;11122:15;10958:189;-1:-1:-1;11161:9:1;;10902:274::o;11181:128::-;11248:9;;;11269:11;;;11266:37;;;11283:18;;:::i;11314:195::-;11353:3;11384:66;11377:5;11374:77;11371:103;;11454:18;;:::i;:::-;-1:-1:-1;11501:1:1;11490:13;;11314:195::o;11514:250::-;11599:1;11609:113;11623:6;11620:1;11617:13;11609:113;;;11699:11;;;11693:18;11680:11;;;11673:39;11645:2;11638:10;11609:113;;;-1:-1:-1;;11756:1:1;11738:16;;11731:27;11514:250::o;11769:1014::-;12076:3;12065:9;12058:22;12039:4;12109:6;12103:13;12153:6;12147:3;12136:9;12132:19;12125:35;12179:3;12191:81;12265:6;12260:2;12249:9;12245:18;12238:4;12230:6;12226:17;12191:81;:::i;:::-;12452:10;12440:23;;;;12433:4;12418:20;;12411:53;-1:-1:-1;;;;;12561:15:1;;;12556:2;12541:18;;12534:43;12613:15;;;;12608:2;12593:18;;12586:43;12660:3;12645:19;;12638:35;;;;12704:3;12689:19;;12682:35;;;;12761:14;12754:22;12748:3;12733:19;;12726:51;12324:2;12312:15;;;-1:-1:-1;12308:88:1;12293:104;12289:113;;;;;-1:-1:-1;;11769:1014:1:o;13422:136::-;13500:13;;13522:30;13500:13;13522:30;:::i;13563:138::-;13642:13;;13664:31;13642:13;13664:31;:::i;13706:132::-;13782:13;;13804:28;13782:13;13804:28;:::i;13843:1183::-;13946:6;13999:3;13987:9;13978:7;13974:23;13970:33;13967:53;;;14016:1;14013;14006:12;13967:53;14042:17;;:::i;:::-;14082:39;14111:9;14082:39;:::i;:::-;14075:5;14068:54;14154:48;14198:2;14187:9;14183:18;14154:48;:::i;:::-;14149:2;14142:5;14138:14;14131:72;14235:49;14280:2;14269:9;14265:18;14235:49;:::i;:::-;14230:2;14223:5;14219:14;14212:73;14317:49;14362:2;14351:9;14347:18;14317:49;:::i;:::-;14312:2;14305:5;14301:14;14294:73;14400:50;14445:3;14434:9;14430:19;14400:50;:::i;:::-;14394:3;14387:5;14383:15;14376:75;14484:50;14529:3;14518:9;14514:19;14484:50;:::i;:::-;14478:3;14471:5;14467:15;14460:75;14589:3;14578:9;14574:19;14568:26;14562:3;14555:5;14551:15;14544:51;14649:3;14638:9;14634:19;14628:26;14622:3;14615:5;14611:15;14604:51;14674:3;14730:2;14719:9;14715:18;14709:25;14704:2;14697:5;14693:14;14686:49;;14754:3;14789:46;14831:2;14820:9;14816:18;14789:46;:::i;:::-;14773:14;;;14766:70;14855:3;14896:18;;;14890:25;14874:14;;;14867:49;14935:3;14976:18;;;14970:25;14954:14;;;14947:49;;;;-1:-1:-1;14777:5:1;13843:1183;-1:-1:-1;13843:1183:1:o;16187:184::-;16257:6;16310:2;16298:9;16289:7;16285:23;16281:32;16278:52;;;16326:1;16323;16316:12;16278:52;-1:-1:-1;16349:16:1;;16187:184;-1:-1:-1;16187:184:1:o;16678:::-;16730:77;16727:1;16720:88;16827:4;16824:1;16817:15;16851:4;16848:1;16841:15;16867:245;16934:6;16987:2;16975:9;16966:7;16962:23;16958:32;16955:52;;;17003:1;17000;16993:12;16955:52;17035:9;17029:16;17054:28;17076:5;17054:28;:::i;17117:184::-;17169:77;17166:1;17159:88;17266:4;17263:1;17256:15;17290:4;17287:1;17280:15;17306:287;17435:3;17473:6;17467:13;17489:66;17548:6;17543:3;17536:4;17528:6;17524:17;17489:66;:::i;:::-;17571:16;;;;;17306:287;-1:-1:-1;;17306:287: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":"AmountIncorrect","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":"FailedInnerCall","type":"error"},{"inputs":[],"name":"MsgValueIncorrect","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":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":"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":[{"internalType":"bytes32","name":"","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":"bridgeRelays","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"bridgeStatuses","outputs":[{"internalType":"enum FastBridge.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":[],"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":[],"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":"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":"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":"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":{"DISPUTE_PERIOD()":{"notice":"Dispute period for relayed transactions"},"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"},"bridgeProofs(bytes32)":{"notice":"Proof of relayed bridge tx on origin chain"},"bridgeRelays(bytes32)":{"notice":"Whether bridge has been relayed on destination chain"},"bridgeStatuses(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,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"},"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"},"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":{"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 ERC-20 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"}},"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"}},"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"}},"refund(bytes)":{"params":{"request":"The encoded bridge transaction to refund"}},"relay(bytes)":{"params":{"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":"to prevent replays"}},"version":1},"metadata":"{\"compiler\":{\"version\":\"0.8.20+commit.a1b79de6\"},\"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\":\"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\":\"FailedInnerCall\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MsgValueIncorrect\",\"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\":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\":\"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\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"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\":\"bridgeRelays\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"bridgeStatuses\",\"outputs\":[{\"internalType\":\"enum FastBridge.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\":[],\"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\":[],\"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\":\"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\":\"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\":\"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 ERC-20 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\"}},\"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\"}},\"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\"}},\"refund(bytes)\":{\"params\":{\"request\":\"The encoded bridge transaction to refund\"}},\"relay(bytes)\":{\"params\":{\"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\":\"to prevent replays\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"DISPUTE_PERIOD()\":{\"notice\":\"Dispute period for relayed transactions\"},\"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\"},\"bridgeProofs(bytes32)\":{\"notice\":\"Proof of relayed bridge tx on origin chain\"},\"bridgeRelays(bytes32)\":{\"notice\":\"Whether bridge has been relayed on destination chain\"},\"bridgeStatuses(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,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\"},\"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\"},\"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/FastBridgeMock.sol\":\"FastBridge\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeMock.sol\":{\"keccak256\":\"0x4fff59c4cd271340f4a824126cbe4ebe7c8dc20639e268edf42ff873af31f862\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://4d33ef4f98d2abd98b4bbcb403b27495c37843b37000bea9f48e533078144d84\",\"dweb:/ipfs/QmTMkQhtNJPVgpxiLnEG45Ww7xfXHMEoVQ5JdbEbaFXwwS\"]}},\"version\":1}"},"hashes":{"DEFAULT_ADMIN_ROLE()":"a217fddf","DISPUTE_PERIOD()":"a5bbe22b","FEE_BPS()":"bf333f2c","FEE_RATE_MAX()":"0f5f6ed7","GOVERNOR_ROLE()":"ccc57490","GUARD_ROLE()":"03ed0ee5","MIN_DEADLINE_PERIOD()":"820688d5","REFUNDER_ROLE()":"5960ccf2","REFUND_DELAY()":"190da595","RELAYER_ROLE()":"926d7d7f","bridge((uint32,address,address,address,address,uint256,uint256,bool,uint256))":"45851694","bridgeProofs(bytes32)":"91ad5039","bridgeRelays(bytes32)":"8379a24f","bridgeStatuses(bytes32)":"051287bc","canClaim(bytes32,address)":"aa9641ab","chainGasAmount()":"e00a83e0","claim(bytes,address)":"41fcb612","deployBlock()":"a3ec191a","dispute(bytes32)":"add98c70","getBridgeTransaction(bytes)":"ac11fb1a","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","refund(bytes)":"5eb7d946","relay(bytes)":"8f0d6f17","renounceRole(bytes32,address)":"36568abe","revokeRole(bytes32,address)":"d547741f","setChainGasAmount(uint256)":"b250fe6b","setProtocolFeeRate(uint256)":"b13aa2d6","supportsInterface(bytes4)":"01ffc9a7","sweepProtocolFees(address,address)":"06f333f2"}},"solidity/FastBridgeMock.sol:FastBridgeMock":{"code":"0x60a06040523480156200001157600080fd5b506040516200254e3803806200254e833981016040819052620000349162000194565b80620000426000826200004f565b50504360805250620001bf565b6000806200005e84846200008c565b90508015620000835760008481526001602052604090206200008190846200013a565b505b90505b92915050565b6000828152602081815260408083206001600160a01b038516845290915281205460ff1662000131576000838152602081815260408083206001600160a01b03861684529091529020805460ff19166001179055620000e83390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a450600162000086565b50600062000086565b600062000083836001600160a01b0384166000818152600183016020526040812054620001315750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915562000086565b600060208284031215620001a757600080fd5b81516001600160a01b03811681146200008357600080fd5b608051612373620001db600039600061053201526123736000f3fe6080604052600436106102345760003560e01c8063926d7d7f11610138578063b13aa2d6116100b0578063ca15c8731161007f578063d547741f11610064578063d547741f146106dd578063dcf844a7146106fd578063e00a83e01461072a57600080fd5b8063ca15c87314610689578063ccc57490146106a957600080fd5b8063b13aa2d614610612578063b250fe6b14610632578063bf333f2c14610652578063c72870cc1461066957600080fd5b8063ac11fb1a11610107578063add98c70116100ec578063add98c70146105c1578063aedf009d146105dc578063affed0e0146105fc57600080fd5b8063ac11fb1a14610574578063acaebbf1146105a157600080fd5b8063926d7d7f146104d7578063a217fddf1461050b578063a3ec191a14610520578063aa9641ab1461055457600080fd5b806345851694116101cb57806385ad903d1161019a5780638f0d6f171161017f5780638f0d6f17146104335780639010d07c1461044157806391d148541461048657600080fd5b806385ad903d146103eb578063886d36ff1461041857600080fd5b8063458516941461037857806358f85880146103865780635960ccf21461039c5780635eb7d946146103d057600080fd5b8063248a9ca311610207578063248a9ca3146102e85780632f2ff15d1461031857806336568abe1461033857806341fcb6121461035857600080fd5b806301ffc9a71461023957806303ed0ee51461026e57806306f333f2146102b05780630f5f6ed7146102d2575b600080fd5b34801561024557600080fd5b5061025961025436600461195d565b610740565b60405190151581526020015b60405180910390f35b34801561027a57600080fd5b506102a27f043c983c49d46f0e102151eaf8085d4a2e6571d5df2d47b013f39bddfd4a639d81565b604051908152602001610265565b3480156102bc57600080fd5b506102d06102cb3660046119d1565b61079c565b005b3480156102de57600080fd5b506102a261271081565b3480156102f457600080fd5b506102a2610303366004611a0a565b60009081526020819052604090206001015490565b34801561032457600080fd5b506102d0610333366004611a23565b61088a565b34801561034457600080fd5b506102d0610353366004611a23565b6108b5565b34801561036457600080fd5b506102d0610373366004611b70565b61090e565b6102d0610373366004611c90565b34801561039257600080fd5b506102a260025481565b3480156103a857600080fd5b506102a27fdb9556138406326f00296e13ea2ad7db24ba82381212d816b1a40c23b466b32781565b3480156103dc57600080fd5b506102d0610373366004611cad565b3480156103f757600080fd5b5061040b610406366004611cea565b610975565b6040516102659190611d79565b34801561042457600080fd5b506102d0610373366004611d8c565b6102d0610373366004611cad565b34801561044d57600080fd5b5061046161045c366004611dd1565b610b25565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610265565b34801561049257600080fd5b506102596104a1366004611a23565b60009182526020828152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b3480156104e357600080fd5b506102a27fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc481565b34801561051757600080fd5b506102a2600081565b34801561052c57600080fd5b506102a27f000000000000000000000000000000000000000000000000000000000000000081565b34801561056057600080fd5b5061025961056f366004611a23565b610b44565b34801561058057600080fd5b5061059461058f366004611cad565b610ba9565b6040516102659190611df3565b3480156105ad57600080fd5b506102d06105bc366004611f0d565b610c1c565b3480156105cd57600080fd5b506102d0610373366004611a0a565b3480156105e857600080fd5b506102d06105f7366004611f4d565b610dec565b34801561060857600080fd5b506102a260055481565b34801561061e57600080fd5b506102d061062d366004611a0a565b610e77565b34801561063e57600080fd5b506102d061064d366004611a0a565b610f54565b34801561065e57600080fd5b506102a2620f424081565b34801561067557600080fd5b506102d0610684366004611fa6565b610fbc565b34801561069557600080fd5b506102a26106a4366004611a0a565b611042565b3480156106b557600080fd5b506102a27f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5581565b3480156106e957600080fd5b506102d06106f8366004611a23565b611059565b34801561070957600080fd5b506102a261071836600461203e565b60036020526000908152604090205481565b34801561073657600080fd5b506102a260045481565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f5a05180f00000000000000000000000000000000000000000000000000000000148061079657506107968261107e565b92915050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f556107c681611115565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260036020526040812054908190036107fa5750505050565b73ffffffffffffffffffffffffffffffffffffffff841660008181526003602052604081205561082b908483611122565b6040805173ffffffffffffffffffffffffffffffffffffffff8087168252851660208201529081018290527f244e51bc38c1452fa8aaf487bcb4bca36c2baa3a5fbdb776b1eabd8dc6d277cd9060600160405180910390a1505b505050565b6000828152602081905260409020600101546108a581611115565b6108af8383611279565b50505050565b73ffffffffffffffffffffffffffffffffffffffff81163314610904576040517f6697b23200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61088582826112ae565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f6e6f7420696d706c656d656e746564000000000000000000000000000000000060448201526064015b60405180910390fd5b60608160048111156109895761098961205b565b6000036109c957505060408051808201909152600481527f4e554c4c00000000000000000000000000000000000000000000000000000000602082015290565b8160048111156109db576109db61205b565b600103610a1b57505060408051808201909152600981527f5245515545535445440000000000000000000000000000000000000000000000602082015290565b816004811115610a2d57610a2d61205b565b600203610a6d57505060408051808201909152600e81527f52454c415945525f50524f564544000000000000000000000000000000000000602082015290565b816004811115610a7f57610a7f61205b565b600303610abf57505060408051808201909152600f81527f52454c415945525f434c41494d45440000000000000000000000000000000000602082015290565b816004811115610ad157610ad161205b565b600403610b1157505060408051808201909152600881527f524546554e444544000000000000000000000000000000000000000000000000602082015290565b505060408051602081019091526000815290565b6000828152600160205260408120610b3d90836112db565b9392505050565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f6e6f7420696d706c656d656e7465640000000000000000000000000000000000604482015260009060640161096c565b604080516101808101825260008082526020808301829052928201819052606082018190526080820181905260a0820181905260c0820181905260e082018190526101008201819052610120820181905261014082018190526101608201528251909161079691840181019084016120ab565b6000620f42406002548360a00151610c3491906121a6565b610c3e91906121bd565b9050808260a001818151610c5291906121f8565b9150818152505060006040518061018001604052804663ffffffff168152602001846000015163ffffffff168152602001846020015173ffffffffffffffffffffffffffffffffffffffff168152602001846040015173ffffffffffffffffffffffffffffffffffffffff168152602001846060015173ffffffffffffffffffffffffffffffffffffffff168152602001846080015173ffffffffffffffffffffffffffffffffffffffff1681526020018460a0015181526020018460c0015181526020018381526020018460e0015115158152602001846101000151815260200160056000815480929190610d479061220b565b909155509052604051610d5d9190602001611df3565b6040516020818303038152906040529050826020015173ffffffffffffffffffffffffffffffffffffffff16857f120ea0364f36cdac7983bcfdd55270ca09d7f9b314a2ebc425a3b01ab1d6403a838660000151876060015188608001518960a001518a60c001518b60e00151604051610ddd9796959493929190612243565b60405180910390a35050505050565b6000610df782610ba9565b9050806040015173ffffffffffffffffffffffffffffffffffffffff16847f120ea0364f36cdac7983bcfdd55270ca09d7f9b314a2ebc425a3b01ab1d6403a84846020015185608001518660a001518760c001518860e00151896101200151604051610e699796959493929190612243565b60405180910390a350505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f55610ea181611115565b612710821115610f0d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f6e657746656552617465203e206d617800000000000000000000000000000000604482015260640161096c565b600280549083905560408051828152602081018590527f14914da2bf76024616fbe1859783fcd4dbddcb179b1f3a854949fbf920dcb95791015b60405180910390a1505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f55610f7e81611115565b600480549083905560408051828152602081018590527f5cf09b12f3f56b4c564d51b25b40360af6d795198adb61ae0806a36c294323fa9101610f47565b6040805163ffffffff8816815273ffffffffffffffffffffffffffffffffffffffff878116602083015286811682840152606082018690526080820185905260a082018490529151898316928b16918c917ff8ae392d784b1ea5e8881bfa586d81abf07ef4f1e2fc75f7fe51c90f05199a5c9181900360c00190a4505050505050505050565b6000818152600160205260408120610796906112e7565b60008281526020819052604090206001015461107481611115565b6108af83836112ae565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061079657507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614610796565b61111f81336112f1565b50565b3073ffffffffffffffffffffffffffffffffffffffff83160361114457505050565b8060000361115157505050565b7fffffffffffffffffffffffff111111111111111111111111111111111111111273ffffffffffffffffffffffffffffffffffffffff8416016112585760008273ffffffffffffffffffffffffffffffffffffffff168260405160006040518083038185875af1925050503d80600081146111e8576040519150601f19603f3d011682016040523d82523d6000602084013e6111ed565b606091505b50509050806108af576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f455448207472616e73666572206661696c656400000000000000000000000000604482015260640161096c565b61088573ffffffffffffffffffffffffffffffffffffffff8416838361137b565b6000806112868484611408565b90508015610b3d5760008481526001602052604090206112a69084611504565b509392505050565b6000806112bb8484611526565b90508015610b3d5760008481526001602052604090206112a690846115e1565b6000610b3d8383611603565b6000610796825490565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16611377576040517fe2517d3f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff821660048201526024810183905260440161096c565b5050565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb0000000000000000000000000000000000000000000000000000000017905261088590849061162d565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915281205460ff166114fc5760008381526020818152604080832073ffffffffffffffffffffffffffffffffffffffff86168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905561149a3390565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a4506001610796565b506000610796565b6000610b3d8373ffffffffffffffffffffffffffffffffffffffff84166116c3565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915281205460ff16156114fc5760008381526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8616808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a4506001610796565b6000610b3d8373ffffffffffffffffffffffffffffffffffffffff841661170a565b600082600001828154811061161a5761161a6122a6565b9060005260206000200154905092915050565b600061164f73ffffffffffffffffffffffffffffffffffffffff8416836117fd565b9050805160001415801561167457508080602001905181019061167291906122d5565b155b15610885576040517f5274afe700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8416600482015260240161096c565b60008181526001830160205260408120546114fc57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610796565b600081815260018301602052604081205480156117f357600061172e6001836121f8565b8554909150600090611742906001906121f8565b90508082146117a7576000866000018281548110611762576117626122a6565b9060005260206000200154905080876000018481548110611785576117856122a6565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806117b8576117b86122f2565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610796565b6000915050610796565b6060610b3d83836000846000808573ffffffffffffffffffffffffffffffffffffffff1684866040516118309190612321565b60006040518083038185875af1925050503d806000811461186d576040519150601f19603f3d011682016040523d82523d6000602084013e611872565b606091505b509150915061188286838361188c565b9695505050505050565b6060826118a15761189c8261191b565b610b3d565b81511580156118c5575073ffffffffffffffffffffffffffffffffffffffff84163b155b15611914576040517f9996b31500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8516600482015260240161096c565b5080610b3d565b80511561192b5780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006020828403121561196f57600080fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114610b3d57600080fd5b73ffffffffffffffffffffffffffffffffffffffff8116811461111f57600080fd5b80356119cc8161199f565b919050565b600080604083850312156119e457600080fd5b82356119ef8161199f565b915060208301356119ff8161199f565b809150509250929050565b600060208284031215611a1c57600080fd5b5035919050565b60008060408385031215611a3657600080fd5b8235915060208301356119ff8161199f565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051610120810167ffffffffffffffff81118282101715611a9b57611a9b611a48565b60405290565b604051610180810167ffffffffffffffff81118282101715611a9b57611a9b611a48565b600082601f830112611ad657600080fd5b813567ffffffffffffffff80821115611af157611af1611a48565b604051601f83017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908282118183101715611b3757611b37611a48565b81604052838152866020858801011115611b5057600080fd5b836020870160208301376000602085830101528094505050505092915050565b60008060408385031215611b8357600080fd5b823567ffffffffffffffff811115611b9a57600080fd5b611ba685828601611ac5565b92505060208301356119ff8161199f565b63ffffffff8116811461111f57600080fd5b80356119cc81611bb7565b801515811461111f57600080fd5b80356119cc81611bd4565b60006101208284031215611c0057600080fd5b611c08611a77565b9050611c1382611bc9565b8152611c21602083016119c1565b6020820152611c32604083016119c1565b6040820152611c43606083016119c1565b6060820152611c54608083016119c1565b608082015260a082013560a082015260c082013560c0820152611c7960e08301611be2565b60e082015261010080830135818301525092915050565b60006101208284031215611ca357600080fd5b610b3d8383611bed565b600060208284031215611cbf57600080fd5b813567ffffffffffffffff811115611cd657600080fd5b611ce284828501611ac5565b949350505050565b600060208284031215611cfc57600080fd5b813560058110610b3d57600080fd5b60005b83811015611d26578181015183820152602001611d0e565b50506000910152565b60008151808452611d47816020860160208601611d0b565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b602081526000610b3d6020830184611d2f565b60008060408385031215611d9f57600080fd5b823567ffffffffffffffff811115611db657600080fd5b611dc285828601611ac5565b95602094909401359450505050565b60008060408385031215611de457600080fd5b50508035926020909101359150565b815163ffffffff16815261018081016020830151611e19602084018263ffffffff169052565b506040830151611e41604084018273ffffffffffffffffffffffffffffffffffffffff169052565b506060830151611e69606084018273ffffffffffffffffffffffffffffffffffffffff169052565b506080830151611e91608084018273ffffffffffffffffffffffffffffffffffffffff169052565b5060a0830151611eb960a084018273ffffffffffffffffffffffffffffffffffffffff169052565b5060c083015160c083015260e083015160e083015261010080840151818401525061012080840151611eee8285018215159052565b5050610140838101519083015261016092830151929091019190915290565b60008060006101608486031215611f2357600080fd5b833592506020840135611f358161199f565b9150611f448560408601611bed565b90509250925092565b600080600060608486031215611f6257600080fd5b833592506020840135611f748161199f565b9150604084013567ffffffffffffffff811115611f9057600080fd5b611f9c86828701611ac5565b9150509250925092565b60008060008060008060008060006101208a8c031215611fc557600080fd5b8935985060208a0135611fd78161199f565b975060408a0135611fe78161199f565b965060608a0135611ff781611bb7565b955060808a01356120078161199f565b945060a08a01356120178161199f565b8094505060c08a0135925060e08a013591506101008a013590509295985092959850929598565b60006020828403121561205057600080fd5b8135610b3d8161199f565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b80516119cc81611bb7565b80516119cc8161199f565b80516119cc81611bd4565b600061018082840312156120be57600080fd5b6120c6611aa1565b6120cf8361208a565b81526120dd6020840161208a565b60208201526120ee60408401612095565b60408201526120ff60608401612095565b606082015261211060808401612095565b608082015261212160a08401612095565b60a082015260c083015160c082015260e083015160e08201526101008084015181830152506101206121548185016120a0565b908201526101408381015190820152610160928301519281019290925250919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b808202811582820484141761079657610796612177565b6000826121f3577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b8181038181111561079657610796612177565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361223c5761223c612177565b5060010190565b60e08152600061225660e083018a611d2f565b63ffffffff9890981660208301525073ffffffffffffffffffffffffffffffffffffffff9586166040820152939094166060840152608083019190915260a082015290151560c090910152919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000602082840312156122e757600080fd5b8151610b3d81611bd4565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b60008251612333818460208701611d0b565b919091019291505056fea264697066735822122033e24b6f39317f0eea840aab6ee071e2b648a79ea7849efa62c112cddf55815d64736f6c63430008140033","runtime-code":"0x6080604052600436106102345760003560e01c8063926d7d7f11610138578063b13aa2d6116100b0578063ca15c8731161007f578063d547741f11610064578063d547741f146106dd578063dcf844a7146106fd578063e00a83e01461072a57600080fd5b8063ca15c87314610689578063ccc57490146106a957600080fd5b8063b13aa2d614610612578063b250fe6b14610632578063bf333f2c14610652578063c72870cc1461066957600080fd5b8063ac11fb1a11610107578063add98c70116100ec578063add98c70146105c1578063aedf009d146105dc578063affed0e0146105fc57600080fd5b8063ac11fb1a14610574578063acaebbf1146105a157600080fd5b8063926d7d7f146104d7578063a217fddf1461050b578063a3ec191a14610520578063aa9641ab1461055457600080fd5b806345851694116101cb57806385ad903d1161019a5780638f0d6f171161017f5780638f0d6f17146104335780639010d07c1461044157806391d148541461048657600080fd5b806385ad903d146103eb578063886d36ff1461041857600080fd5b8063458516941461037857806358f85880146103865780635960ccf21461039c5780635eb7d946146103d057600080fd5b8063248a9ca311610207578063248a9ca3146102e85780632f2ff15d1461031857806336568abe1461033857806341fcb6121461035857600080fd5b806301ffc9a71461023957806303ed0ee51461026e57806306f333f2146102b05780630f5f6ed7146102d2575b600080fd5b34801561024557600080fd5b5061025961025436600461195d565b610740565b60405190151581526020015b60405180910390f35b34801561027a57600080fd5b506102a27f043c983c49d46f0e102151eaf8085d4a2e6571d5df2d47b013f39bddfd4a639d81565b604051908152602001610265565b3480156102bc57600080fd5b506102d06102cb3660046119d1565b61079c565b005b3480156102de57600080fd5b506102a261271081565b3480156102f457600080fd5b506102a2610303366004611a0a565b60009081526020819052604090206001015490565b34801561032457600080fd5b506102d0610333366004611a23565b61088a565b34801561034457600080fd5b506102d0610353366004611a23565b6108b5565b34801561036457600080fd5b506102d0610373366004611b70565b61090e565b6102d0610373366004611c90565b34801561039257600080fd5b506102a260025481565b3480156103a857600080fd5b506102a27fdb9556138406326f00296e13ea2ad7db24ba82381212d816b1a40c23b466b32781565b3480156103dc57600080fd5b506102d0610373366004611cad565b3480156103f757600080fd5b5061040b610406366004611cea565b610975565b6040516102659190611d79565b34801561042457600080fd5b506102d0610373366004611d8c565b6102d0610373366004611cad565b34801561044d57600080fd5b5061046161045c366004611dd1565b610b25565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610265565b34801561049257600080fd5b506102596104a1366004611a23565b60009182526020828152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b3480156104e357600080fd5b506102a27fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc481565b34801561051757600080fd5b506102a2600081565b34801561052c57600080fd5b506102a27f000000000000000000000000000000000000000000000000000000000000000081565b34801561056057600080fd5b5061025961056f366004611a23565b610b44565b34801561058057600080fd5b5061059461058f366004611cad565b610ba9565b6040516102659190611df3565b3480156105ad57600080fd5b506102d06105bc366004611f0d565b610c1c565b3480156105cd57600080fd5b506102d0610373366004611a0a565b3480156105e857600080fd5b506102d06105f7366004611f4d565b610dec565b34801561060857600080fd5b506102a260055481565b34801561061e57600080fd5b506102d061062d366004611a0a565b610e77565b34801561063e57600080fd5b506102d061064d366004611a0a565b610f54565b34801561065e57600080fd5b506102a2620f424081565b34801561067557600080fd5b506102d0610684366004611fa6565b610fbc565b34801561069557600080fd5b506102a26106a4366004611a0a565b611042565b3480156106b557600080fd5b506102a27f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5581565b3480156106e957600080fd5b506102d06106f8366004611a23565b611059565b34801561070957600080fd5b506102a261071836600461203e565b60036020526000908152604090205481565b34801561073657600080fd5b506102a260045481565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f5a05180f00000000000000000000000000000000000000000000000000000000148061079657506107968261107e565b92915050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f556107c681611115565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260036020526040812054908190036107fa5750505050565b73ffffffffffffffffffffffffffffffffffffffff841660008181526003602052604081205561082b908483611122565b6040805173ffffffffffffffffffffffffffffffffffffffff8087168252851660208201529081018290527f244e51bc38c1452fa8aaf487bcb4bca36c2baa3a5fbdb776b1eabd8dc6d277cd9060600160405180910390a1505b505050565b6000828152602081905260409020600101546108a581611115565b6108af8383611279565b50505050565b73ffffffffffffffffffffffffffffffffffffffff81163314610904576040517f6697b23200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61088582826112ae565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f6e6f7420696d706c656d656e746564000000000000000000000000000000000060448201526064015b60405180910390fd5b60608160048111156109895761098961205b565b6000036109c957505060408051808201909152600481527f4e554c4c00000000000000000000000000000000000000000000000000000000602082015290565b8160048111156109db576109db61205b565b600103610a1b57505060408051808201909152600981527f5245515545535445440000000000000000000000000000000000000000000000602082015290565b816004811115610a2d57610a2d61205b565b600203610a6d57505060408051808201909152600e81527f52454c415945525f50524f564544000000000000000000000000000000000000602082015290565b816004811115610a7f57610a7f61205b565b600303610abf57505060408051808201909152600f81527f52454c415945525f434c41494d45440000000000000000000000000000000000602082015290565b816004811115610ad157610ad161205b565b600403610b1157505060408051808201909152600881527f524546554e444544000000000000000000000000000000000000000000000000602082015290565b505060408051602081019091526000815290565b6000828152600160205260408120610b3d90836112db565b9392505050565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f6e6f7420696d706c656d656e7465640000000000000000000000000000000000604482015260009060640161096c565b604080516101808101825260008082526020808301829052928201819052606082018190526080820181905260a0820181905260c0820181905260e082018190526101008201819052610120820181905261014082018190526101608201528251909161079691840181019084016120ab565b6000620f42406002548360a00151610c3491906121a6565b610c3e91906121bd565b9050808260a001818151610c5291906121f8565b9150818152505060006040518061018001604052804663ffffffff168152602001846000015163ffffffff168152602001846020015173ffffffffffffffffffffffffffffffffffffffff168152602001846040015173ffffffffffffffffffffffffffffffffffffffff168152602001846060015173ffffffffffffffffffffffffffffffffffffffff168152602001846080015173ffffffffffffffffffffffffffffffffffffffff1681526020018460a0015181526020018460c0015181526020018381526020018460e0015115158152602001846101000151815260200160056000815480929190610d479061220b565b909155509052604051610d5d9190602001611df3565b6040516020818303038152906040529050826020015173ffffffffffffffffffffffffffffffffffffffff16857f120ea0364f36cdac7983bcfdd55270ca09d7f9b314a2ebc425a3b01ab1d6403a838660000151876060015188608001518960a001518a60c001518b60e00151604051610ddd9796959493929190612243565b60405180910390a35050505050565b6000610df782610ba9565b9050806040015173ffffffffffffffffffffffffffffffffffffffff16847f120ea0364f36cdac7983bcfdd55270ca09d7f9b314a2ebc425a3b01ab1d6403a84846020015185608001518660a001518760c001518860e00151896101200151604051610e699796959493929190612243565b60405180910390a350505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f55610ea181611115565b612710821115610f0d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f6e657746656552617465203e206d617800000000000000000000000000000000604482015260640161096c565b600280549083905560408051828152602081018590527f14914da2bf76024616fbe1859783fcd4dbddcb179b1f3a854949fbf920dcb95791015b60405180910390a1505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f55610f7e81611115565b600480549083905560408051828152602081018590527f5cf09b12f3f56b4c564d51b25b40360af6d795198adb61ae0806a36c294323fa9101610f47565b6040805163ffffffff8816815273ffffffffffffffffffffffffffffffffffffffff878116602083015286811682840152606082018690526080820185905260a082018490529151898316928b16918c917ff8ae392d784b1ea5e8881bfa586d81abf07ef4f1e2fc75f7fe51c90f05199a5c9181900360c00190a4505050505050505050565b6000818152600160205260408120610796906112e7565b60008281526020819052604090206001015461107481611115565b6108af83836112ae565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061079657507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614610796565b61111f81336112f1565b50565b3073ffffffffffffffffffffffffffffffffffffffff83160361114457505050565b8060000361115157505050565b7fffffffffffffffffffffffff111111111111111111111111111111111111111273ffffffffffffffffffffffffffffffffffffffff8416016112585760008273ffffffffffffffffffffffffffffffffffffffff168260405160006040518083038185875af1925050503d80600081146111e8576040519150601f19603f3d011682016040523d82523d6000602084013e6111ed565b606091505b50509050806108af576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f455448207472616e73666572206661696c656400000000000000000000000000604482015260640161096c565b61088573ffffffffffffffffffffffffffffffffffffffff8416838361137b565b6000806112868484611408565b90508015610b3d5760008481526001602052604090206112a69084611504565b509392505050565b6000806112bb8484611526565b90508015610b3d5760008481526001602052604090206112a690846115e1565b6000610b3d8383611603565b6000610796825490565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16611377576040517fe2517d3f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff821660048201526024810183905260440161096c565b5050565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb0000000000000000000000000000000000000000000000000000000017905261088590849061162d565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915281205460ff166114fc5760008381526020818152604080832073ffffffffffffffffffffffffffffffffffffffff86168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905561149a3390565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a4506001610796565b506000610796565b6000610b3d8373ffffffffffffffffffffffffffffffffffffffff84166116c3565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915281205460ff16156114fc5760008381526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8616808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a4506001610796565b6000610b3d8373ffffffffffffffffffffffffffffffffffffffff841661170a565b600082600001828154811061161a5761161a6122a6565b9060005260206000200154905092915050565b600061164f73ffffffffffffffffffffffffffffffffffffffff8416836117fd565b9050805160001415801561167457508080602001905181019061167291906122d5565b155b15610885576040517f5274afe700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8416600482015260240161096c565b60008181526001830160205260408120546114fc57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610796565b600081815260018301602052604081205480156117f357600061172e6001836121f8565b8554909150600090611742906001906121f8565b90508082146117a7576000866000018281548110611762576117626122a6565b9060005260206000200154905080876000018481548110611785576117856122a6565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806117b8576117b86122f2565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610796565b6000915050610796565b6060610b3d83836000846000808573ffffffffffffffffffffffffffffffffffffffff1684866040516118309190612321565b60006040518083038185875af1925050503d806000811461186d576040519150601f19603f3d011682016040523d82523d6000602084013e611872565b606091505b509150915061188286838361188c565b9695505050505050565b6060826118a15761189c8261191b565b610b3d565b81511580156118c5575073ffffffffffffffffffffffffffffffffffffffff84163b155b15611914576040517f9996b31500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8516600482015260240161096c565b5080610b3d565b80511561192b5780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006020828403121561196f57600080fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114610b3d57600080fd5b73ffffffffffffffffffffffffffffffffffffffff8116811461111f57600080fd5b80356119cc8161199f565b919050565b600080604083850312156119e457600080fd5b82356119ef8161199f565b915060208301356119ff8161199f565b809150509250929050565b600060208284031215611a1c57600080fd5b5035919050565b60008060408385031215611a3657600080fd5b8235915060208301356119ff8161199f565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051610120810167ffffffffffffffff81118282101715611a9b57611a9b611a48565b60405290565b604051610180810167ffffffffffffffff81118282101715611a9b57611a9b611a48565b600082601f830112611ad657600080fd5b813567ffffffffffffffff80821115611af157611af1611a48565b604051601f83017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908282118183101715611b3757611b37611a48565b81604052838152866020858801011115611b5057600080fd5b836020870160208301376000602085830101528094505050505092915050565b60008060408385031215611b8357600080fd5b823567ffffffffffffffff811115611b9a57600080fd5b611ba685828601611ac5565b92505060208301356119ff8161199f565b63ffffffff8116811461111f57600080fd5b80356119cc81611bb7565b801515811461111f57600080fd5b80356119cc81611bd4565b60006101208284031215611c0057600080fd5b611c08611a77565b9050611c1382611bc9565b8152611c21602083016119c1565b6020820152611c32604083016119c1565b6040820152611c43606083016119c1565b6060820152611c54608083016119c1565b608082015260a082013560a082015260c082013560c0820152611c7960e08301611be2565b60e082015261010080830135818301525092915050565b60006101208284031215611ca357600080fd5b610b3d8383611bed565b600060208284031215611cbf57600080fd5b813567ffffffffffffffff811115611cd657600080fd5b611ce284828501611ac5565b949350505050565b600060208284031215611cfc57600080fd5b813560058110610b3d57600080fd5b60005b83811015611d26578181015183820152602001611d0e565b50506000910152565b60008151808452611d47816020860160208601611d0b565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b602081526000610b3d6020830184611d2f565b60008060408385031215611d9f57600080fd5b823567ffffffffffffffff811115611db657600080fd5b611dc285828601611ac5565b95602094909401359450505050565b60008060408385031215611de457600080fd5b50508035926020909101359150565b815163ffffffff16815261018081016020830151611e19602084018263ffffffff169052565b506040830151611e41604084018273ffffffffffffffffffffffffffffffffffffffff169052565b506060830151611e69606084018273ffffffffffffffffffffffffffffffffffffffff169052565b506080830151611e91608084018273ffffffffffffffffffffffffffffffffffffffff169052565b5060a0830151611eb960a084018273ffffffffffffffffffffffffffffffffffffffff169052565b5060c083015160c083015260e083015160e083015261010080840151818401525061012080840151611eee8285018215159052565b5050610140838101519083015261016092830151929091019190915290565b60008060006101608486031215611f2357600080fd5b833592506020840135611f358161199f565b9150611f448560408601611bed565b90509250925092565b600080600060608486031215611f6257600080fd5b833592506020840135611f748161199f565b9150604084013567ffffffffffffffff811115611f9057600080fd5b611f9c86828701611ac5565b9150509250925092565b60008060008060008060008060006101208a8c031215611fc557600080fd5b8935985060208a0135611fd78161199f565b975060408a0135611fe78161199f565b965060608a0135611ff781611bb7565b955060808a01356120078161199f565b945060a08a01356120178161199f565b8094505060c08a0135925060e08a013591506101008a013590509295985092959850929598565b60006020828403121561205057600080fd5b8135610b3d8161199f565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b80516119cc81611bb7565b80516119cc8161199f565b80516119cc81611bd4565b600061018082840312156120be57600080fd5b6120c6611aa1565b6120cf8361208a565b81526120dd6020840161208a565b60208201526120ee60408401612095565b60408201526120ff60608401612095565b606082015261211060808401612095565b608082015261212160a08401612095565b60a082015260c083015160c082015260e083015160e08201526101008084015181830152506101206121548185016120a0565b908201526101408381015190820152610160928301519281019290925250919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b808202811582820484141761079657610796612177565b6000826121f3577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b8181038181111561079657610796612177565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361223c5761223c612177565b5060010190565b60e08152600061225660e083018a611d2f565b63ffffffff9890981660208301525073ffffffffffffffffffffffffffffffffffffffff9586166040820152939094166060840152608083019190915260a082015290151560c090910152919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000602082840312156122e757600080fd5b8151610b3d81611bd4565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b60008251612333818460208701611d0b565b919091019291505056fea264697066735822122033e24b6f39317f0eea840aab6ee071e2b648a79ea7849efa62c112cddf55815d64736f6c63430008140033","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.20 ^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 pure 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/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// lib/openzeppelin-contracts/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 ERC-165 detection.\n */\ninterface IAccessControl {\n /**\n * @dev The `account` is missing a role.\n */\n error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);\n\n /**\n * @dev The caller of a function is not the expected one.\n *\n * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.\n */\n error AccessControlBadConfirmation();\n\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted 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// lib/openzeppelin-contracts/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 ERC-20 standard as defined in the ERC.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the value of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the value of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 value) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n * caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 value) external returns (bool);\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\n * allowance mechanism. `value` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n\n// lib/openzeppelin-contracts/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 ERC-20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[ERC-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC-20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n *\n * ==== Security Considerations\n *\n * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\n * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\n * considered as an intention to spend the allowance in any specific way. The second is that because permits have\n * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\n * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\n * generally recommended is:\n *\n * ```solidity\n * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\n * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\n * doThing(..., value);\n * }\n *\n * function doThing(..., uint256 value) public {\n * token.safeTransferFrom(msg.sender, address(this), value);\n * ...\n * }\n * ```\n *\n * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\n * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\n * {SafeERC20-safeTransferFrom}).\n *\n * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\n * contracts should have entry points that don't rely on permit.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also 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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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 ERC-165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[ERC].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n\n// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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 ERC-165 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// lib/openzeppelin-contracts/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 ERC-165 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// lib/openzeppelin-contracts/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 ERC-20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n /**\n * @dev An operation with an ERC-20 token failed.\n */\n error SafeERC20FailedOperation(address token);\n\n /**\n * @dev Indicates a failed `decreaseAllowance` request.\n */\n error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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/FastBridge.sol\n\ncontract FastBridge is IFastBridge, Admin {\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 enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeStatus) public bridgeStatuses;\n /// @notice Proof of relayed bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeProof) public bridgeProofs;\n /// @notice Whether bridge has been relayed on destination chain\n mapping(bytes32 =\u003e bool) public bridgeRelays;\n\n /// @dev to prevent replays\n uint256 public nonce;\n // @dev 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 /// @notice Pulls a requested token from the user to the requested recipient.\n /// @dev Be careful of re-entrancy issues when msg.value \u003e 0 and recipient != address(this)\n function _pullToken(address recipient, address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token != UniversalTokenLib.ETH_ADDRESS) {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(recipient);\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, recipient, amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(recipient) - amountPulled;\n } else {\n // Otherwise, we need to check that ETH amount matches msg.value\n if (amount != msg.value) revert MsgValueIncorrect();\n // Transfer value to recipient if not this address\n if (recipient != address(this)) token.universalTransfer(recipient, amount);\n // We will forward msg.value in the external call later, if recipient is not this contract\n amountPulled = msg.value;\n }\n }\n\n /// @inheritdoc IFastBridge\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n // check bridge params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\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\n // transfer tokens to bridge contract\n // @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(address(this), 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 BridgeTransaction({\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 sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n\n // check haven't exceeded deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n\n // mark bridge transaction as relayed\n if (bridgeRelays[transactionId]) revert TransactionRelayed();\n bridgeRelays[transactionId] = true;\n\n // transfer tokens to recipient on destination chain and gas rebate if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n uint256 rebate = chainGasAmount;\n if (!transaction.sendChainGas) {\n // forward erc20\n rebate = 0;\n _pullToken(to, token, amount);\n } else if (token == UniversalTokenLib.ETH_ADDRESS) {\n // lump in gas rebate into amount in native gas token\n _pullToken(to, token, amount + rebate);\n } else {\n // forward erc20 then forward gas rebate in native gas token\n _pullToken(to, token, amount);\n _pullToken(to, UniversalTokenLib.ETH_ADDRESS, rebate);\n }\n\n emit BridgeRelayed(\n transactionId,\n msg.sender,\n to,\n transaction.originChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n rebate\n );\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n // update bridge tx status given proof provided\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = BridgeStatus.RELAYER_PROVED;\n bridgeProofs[transactionId] = BridgeProof({timestamp: uint96(block.timestamp), relayer: msg.sender}); // overflow ok\n\n emit BridgeProofProvided(transactionId, msg.sender, destTxHash);\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint96(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint96).max but\n /// proof.timestamp \u003c type(uint96).max via unchecked statement\n /// @param proof The bridge proof\n /// @return delta Time delta since proof submitted\n function _timeSince(BridgeProof memory proof) internal view returns (uint256 delta) {\n unchecked {\n delta = uint96(block.timestamp) - proof.timestamp;\n }\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != relayer) revert SenderIncorrect();\n return _timeSince(proof) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != msg.sender) revert SenderIncorrect();\n if (_timeSince(proof) \u003c= DISPUTE_PERIOD) revert DisputePeriodNotPassed();\n\n bridgeStatuses[transactionId] = 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, msg.sender, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeProofs[transactionId]) \u003e DISPUTE_PERIOD) revert DisputePeriodPassed();\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n delete bridgeProofs[transactionId];\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 BridgeTransaction memory transaction = getBridgeTransaction(request);\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 // set status to refunded if still in requested state\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = 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\n// test/FastBridgeMock.sol\n\ncontract FastBridgeMock is IFastBridge, Admin {\n // @dev 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 /// @dev to prevent replays\n uint256 public nonce;\n\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n // used for testing in go.\n // see: https://ethereum.stackexchange.com/questions/21155/how-to-expose-enum-in-solidity-contract\n // make sure to update fastbridge/status.go if this changes\n // or underliyng enum changes.\n //\n // TODO: a foundry test should be added to ensure this is always in sync.\n function getEnumKeyByValue(FastBridge.BridgeStatus keyValue) public pure returns (string memory) {\n if (FastBridge.BridgeStatus.NULL == keyValue) return \"NULL\";\n if (FastBridge.BridgeStatus.REQUESTED == keyValue) return \"REQUESTED\";\n if (FastBridge.BridgeStatus.RELAYER_PROVED == keyValue) return \"RELAYER_PROVED\";\n if (FastBridge.BridgeStatus.RELAYER_CLAIMED == keyValue) return \"RELAYER_CLAIMED\";\n if (FastBridge.BridgeStatus.REFUNDED == keyValue) return \"REFUNDED\";\n return \"\";\n }\n\n function mockBridgeRequest(bytes32 transactionId, address sender, BridgeParams memory params) external {\n uint256 originFeeAmount = (params.originAmount * protocolFeeRate) / FEE_BPS;\n params.originAmount -= originFeeAmount;\n\n bytes memory request = abi.encode(\n BridgeTransaction({\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: params.originAmount, // includes relayer fee\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n params.originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n function mockBridgeRequestRaw(bytes32 transactionId, address sender, bytes memory request) external {\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n emit BridgeRequested(\n transactionId,\n transaction.originSender,\n request,\n transaction.destChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n transaction.sendChainGas\n );\n }\n\n function mockBridgeRelayer(\n bytes32 transactionId,\n address relayer,\n address to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n )\n external\n {\n emit BridgeRelayed(\n transactionId, relayer, to, originChainId, originToken, destToken, originAmount, destAmount, chainGasAmount\n );\n }\n\n function bridge(BridgeParams memory params) external payable {\n revert(\"not implemented\");\n }\n\n function relay(bytes memory request) external payable {\n revert(\"not implemented\");\n }\n\n function prove(bytes memory request, bytes32 destTxHash) external {\n revert(\"not implemented\");\n }\n\n function canClaim(bytes32 transactionid, address relayer) external view returns (bool) {\n revert(\"not implemented\");\n }\n\n function claim(bytes memory request, address to) external {\n revert(\"not implemented\");\n }\n\n function dispute(bytes32 transactionId) external {\n revert(\"not implemented\");\n }\n\n function refund(bytes memory request) external {\n revert(\"not implemented\");\n }\n}\n","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","compilerOptions":"--combined-json bin,bin-runtime,srcmap,srcmap-runtime,abi,userdoc,devdoc,metadata,hashes --optimize --optimize-runs 10000 --allow-paths ., ./, ../ --evm-version=istanbul","srcMap":"69539:4359:0:-:0;;;69685:85;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;69719:6;57196:38;46368:4;69719:6;57196:10;:38::i;:::-;-1:-1:-1;;69751:12:0::1;69737:26;::::0;-1:-1:-1;69539:4359:0;;55681:257;55767:4;;55798:31;55815:4;55821:7;55798:16;:31::i;:::-;55783:46;;55843:7;55839:69;;;55866:18;;;;:12;:18;;;;;:31;;55889:7;55866:22;:31::i;:::-;;55839:69;55924:7;-1:-1:-1;55681:257:0;;;;;:::o;50315:316::-;50392:4;47090:12;;;;;;;;;;;-1:-1:-1;;;;;47090:29:0;;;;;;;;;;;;50408:217;;50451:6;:12;;;;;;;;;;;-1:-1:-1;;;;;50451:29:0;;;;;;;;;:36;;-1:-1:-1;;50451:36:0;50483:4;50451:36;;;50533:12;22406:10;;22327:96;50533:12;-1:-1:-1;;;;;50506:40:0;50524:7;-1:-1:-1;;;;;50506:40:0;50518:4;50506:40;;;;;;;;;;-1:-1:-1;50567:4:0;50560:11;;50408:217;-1:-1:-1;50609:5:0;50602:12;;31852:150;31922:4;31945:50;31950:3;-1:-1:-1;;;;;31970:23:0;;25840:4;27896:21;;;:14;;;:21;;;;;;25856:321;;-1:-1:-1;25898:23:0;;;;;;;;:11;:23;;;;;;;;;;;;;26080:18;;26056:21;;;:14;;;:21;;;;;;:42;;;;26112: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;69539:4359:0;;;;;;;;;;;;","srcMapRuntime":"69539:4359:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;54341:212;;;;;;;;;;-1:-1:-1;54341:212:0;;;;;:::i;:::-;;:::i;:::-;;;612:14:1;;605:22;587:41;;575:2;560:18;54341:212:0;;;;;;;;56571:60;;;;;;;;;;;;56608:23;56571:60;;;;;785:25:1;;;773:2;758:18;56571:60:0;639:177:1;57543:359:0;;;;;;;;;;-1:-1:-1;57543:359:0;;;;;:::i;:::-;;:::i;:::-;;56753:45;;;;;;;;;;;;56792:6;56753:45;;47946:120;;;;;;;;;;-1:-1:-1;47946:120:0;;;;;:::i;:::-;48011:7;48037:12;;;;;;;;;;:22;;;;47946:120;48362:136;;;;;;;;;;-1:-1:-1;48362:136:0;;;;;:::i;:::-;;:::i;49464:245::-;;;;;;;;;;-1:-1:-1;49464:245:0;;;;;:::i;:::-;;:::i;73604:100::-;;;;;;;;;;-1:-1:-1;73604:100:0;;;;;:::i;:::-;;:::i;73144:103::-;;;;;;:::i;56915:30::-;;;;;;;;;;;;;;;;56499:66;;;;;;;;;;;;56539:26;56499:66;;73807:89;;;;;;;;;;-1:-1:-1;73807:89:0;;;;;:::i;70322:528::-;;;;;;;;;;-1:-1:-1;70322:528:0;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;73355:108::-;;;;;;;;;;-1:-1:-1;73355:108:0;;;;;:::i;73253:96::-;;;;;;:::i;55138:142::-;;;;;;;;;;-1:-1:-1;55138:142:0;;;;;:::i;:::-;;:::i;:::-;;;8086:42:1;8074:55;;;8056:74;;8044:2;8029:18;55138:142:0;7910:226:1;46990:136:0;;;;;;;;;;-1:-1:-1;46990:136:0;;;;;:::i;:::-;47067:4;47090:12;;;;;;;;;;;:29;;;;;;;;;;;;;;;;46990:136;56429:64;;;;;;;;;;;;56468:25;56429:64;;46323:49;;;;;;;;;;-1:-1:-1;46323:49:0;46368:4;46323:49;;69642:36;;;;;;;;;;;;;;;73469:129;;;;;;;;;;-1:-1:-1;73469:129:0;;;;;:::i;:::-;;:::i;69835:163::-;;;;;;;;;;-1:-1:-1;69835:163:0;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;70856:1266::-;;;;;;;;;;-1:-1:-1;70856:1266:0;;;;;:::i;:::-;;:::i;73710:91::-;;;;;;;;;;-1:-1:-1;73710:91:0;;;;;:::i;72128:532::-;;;;;;;;;;-1:-1:-1;72128:532:0;;;;;:::i;:::-;;:::i;69808:20::-;;;;;;;;;;;;;;;;57247:290;;;;;;;;;;-1:-1:-1;57247:290:0;;;;;:::i;:::-;;:::i;57908:264::-;;;;;;;;;;-1:-1:-1;57908:264:0;;;;;:::i;:::-;;:::i;56710:37::-;;;;;;;;;;;;56744:3;56710:37;;72666:472;;;;;;;;;;-1:-1:-1;72666:472:0;;;;;:::i;:::-;;:::i;55448:131::-;;;;;;;;;;-1:-1:-1;55448:131:0;;;;;:::i;:::-;;:::i;56637:66::-;;;;;;;;;;;;56677:26;56637:66;;48778:138;;;;;;;;;;-1:-1:-1;48778:138:0;;;;;:::i;:::-;;:::i;57001:47::-;;;;;;;;;;-1:-1:-1;57001:47:0;;;;;:::i;:::-;;;;;;;;;;;;;;57122:29;;;;;;;;;;;;;;;;54341:212;54426:4;54449:57;;;54464:42;54449:57;;:97;;;54510:36;54534:11;54510:23;:36::i;:::-;54442:104;54341:212;-1:-1:-1;;54341:212:0:o;57543:359::-;56677:26;46600:16;46611:4;46600:10;:16::i;:::-;57667:19:::1;::::0;::::1;57647:17;57667:19:::0;;;:12:::1;:19;::::0;;;;;;57700:14;;;57696:27:::1;;57716:7;57543:359:::0;;;:::o;57696:27::-:1;57764:19;::::0;::::1;57786:1;57764:19:::0;;;:12:::1;:19;::::0;;;;:23;57797:45:::1;::::0;57821:9;57832;57797:23:::1;:45::i;:::-;57857:38;::::0;;12332:42:1;12401:15;;;12383:34;;12453:15;;12448:2;12433:18;;12426:43;12485:18;;;12478:34;;;57857:38:0::1;::::0;12310:2:1;12295:18;57857:38:0::1;;;;;;;57637:265;46626:1;57543:359:::0;;;:::o;48362:136::-;48011:7;48037:12;;;;;;;;;;:22;;;46600:16;46611:4;46600:10;:16::i;:::-;48466:25:::1;48477:4;48483:7;48466:10;:25::i;:::-;;48362:136:::0;;;:::o;49464:245::-;49557:34;;;22406:10;49557:34;49553:102;;49614:30;;;;;;;;;;;;;;49553:102;49665:37;49677:4;49683:18;49665:11;:37::i;73604:100::-;73672:25;;;;;12725:2:1;73672:25:0;;;12707:21:1;12764:2;12744:18;;;12737:30;12803:17;12783:18;;;12776:45;12838:18;;73672:25:0;;;;;;;;70322:528;70404:13;70465:8;70433:40;;;;;;;;:::i;:::-;:28;:40;70429:59;;-1:-1:-1;;70475:13:0;;;;;;;;;;;;;;;;;;70322:528::o;70429:59::-;70539:8;70502:45;;;;;;;;:::i;:::-;:33;:45;70498:69;;-1:-1:-1;;70549:18:0;;;;;;;;;;;;;;;;;;70322:528::o;70498:69::-;70623:8;70581:50;;;;;;;;:::i;:::-;:38;:50;70577:79;;-1:-1:-1;;70633:23:0;;;;;;;;;;;;;;;;;;70322:528::o;70577:79::-;70713:8;70670:51;;;;;;;;:::i;:::-;:39;:51;70666:81;;-1:-1:-1;;70723:24:0;;;;;;;;;;;;;;;;;;70322:528::o;70666:81::-;70797:8;70761:44;;;;;;;;:::i;:::-;:32;:44;70757:67;;-1:-1:-1;;70807:17:0;;;;;;;;;;;;;;;;;;70322:528::o;70757:67::-;-1:-1:-1;;70834:9:0;;;;;;;;;-1:-1:-1;70834:9:0;;;70322:528::o;55138:142::-;55219:7;55245:18;;;:12;:18;;;;;:28;;55267:5;55245:21;:28::i;:::-;55238:35;55138:142;-1:-1:-1;;;55138:142:0:o;73469:129::-;73566:25;;;;;12725:2:1;73566:25:0;;;12707:21:1;12764:2;12744:18;;;12737:30;12803:17;12783:18;;;12776:45;73550:4:0;;12838:18:1;;73566:25:0;12523:339:1;69835:163:0;-1:-1:-1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;69951:40:0;;-1:-1:-1;;69951:40:0;;;;;;;;;;:::i;70856:1266::-;70969:23;56744:3;71018:15;;70996:6;:19;;;:37;;;;:::i;:::-;70995:49;;;;:::i;:::-;70969:75;;71077:15;71054:6;:19;;:38;;;;;;;:::i;:::-;;;;;;;;71103:20;71150:649;;;;;;;;71208:13;71150:649;;;;;;71253:6;:17;;;71150:649;;;;;;71302:6;:13;;;71150:649;;;;;;71348:6;:9;;;71150:649;;;;;;71388:6;:18;;;71150:649;;;;;;71435:6;:16;;;71150:649;;;;;;71483:6;:19;;;71150:649;;;;71556:6;:17;;;71150:649;;;;71608:15;71150:649;;;;71655:6;:19;;;71150:649;;;;;;71702:6;:15;;;71150:649;;;;71742:5;;:7;;;;;;;;;:::i;:::-;;;;-1:-1:-1;71150:649:0;;71126:683;;;;;;;;:::i;:::-;;;;;;;;;;;;;71103:706;;71881:6;:13;;;71825:290;;71854:13;71825:290;71908:7;71929:6;:17;;;71960:6;:18;;;71992:6;:16;;;72022:6;:19;;;72055:6;:17;;;72086:6;:19;;;71825:290;;;;;;;;;;;;:::i;:::-;;;;;;;;70959:1163;;70856:1266;;;:::o;72128:532::-;72238:36;72277:29;72298:7;72277:20;:29::i;:::-;72238:68;;72377:11;:24;;;72321:332;;72350:13;72321:332;72415:7;72436:11;:23;;;72473:11;:23;;;72510:11;:21;;;72545:11;:24;;;72583:11;:22;;;72619:11;:24;;;72321:332;;;;;;;;;;;;:::i;:::-;;;;;;;;72228:432;72128:532;;;:::o;57247:290::-;56677:26;46600:16;46611:4;46600:10;:16::i;:::-;56792:6:::1;57346:10;:26;;57338:55;;;::::0;::::1;::::0;;16599:2:1;57338:55:0::1;::::0;::::1;16581:21:1::0;16638:2;16618:18;;;16611:30;16677:18;16657;;;16650:46;16713:18;;57338:55:0::1;16397:340:1::0;57338:55:0::1;57424:15;::::0;;57449:28;;;;57492:38:::1;::::0;;16916:25:1;;;16972:2;16957:18;;16950:34;;;57492:38:0::1;::::0;16889:18:1;57492:38:0::1;;;;;;;;57328:209;57247:290:::0;;:::o;57908:264::-;56677:26;46600:16;46611:4;46600:10;:16::i;:::-;58033:14:::1;::::0;;58057:34;;;;58106:59:::1;::::0;;16916:25:1;;;16972:2;16957:18;;16950:34;;;58106:59:0::1;::::0;16889:18:1;58106:59:0::1;16742:248:1::0;72666:472:0;72987:144;;;17310:10:1;17298:23;;17280:42;;72987:144:0;17419:15:1;;;17414:2;17399:18;;17392:43;17471:15;;;17451:18;;;17444:43;17518:2;17503:18;;17496:34;;;17561:3;17546:19;;17539:35;;;17605:3;17590:19;;17583:35;;;72987:144:0;;;;;;;;;73014:13;;72987:144;;;;;17267:3:1;72987:144:0;;;72666:472;;;;;;;;;:::o;55448:131::-;55519:7;55545:18;;;:12;:18;;;;;:27;;:25;:27::i;48778:138::-;48011:7;48037:12;;;;;;;;;;:22;;;46600:16;46611:4;46600:10;:16::i;:::-;48883:26:::1;48895:4;48901:7;48883:11;:26::i;46701:202::-:0;46786:4;46809:47;;;46824:32;46809:47;;:87;;-1:-1:-1;38614:25:0;38599:40;;;;46860:36;38500:146;47335:103;47401:30;47412:4;22406:10;47401;:30::i;:::-;47335:103;:::o;51613:653::-;51788:4;51774:19;;;;51770:32;;51613:653;;;:::o;51770:32::-;51874:5;51883:1;51874:10;51870:23;;51613:653;;;:::o;51870:23::-;51906:20;;;;;51902:358;;52086:12;52103:2;:7;;52118:5;52103:25;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;52085:43;;;52150:7;52142:39;;;;;;;18041:2:1;52142:39:0;;;18023:21:1;18080:2;18060:18;;;18053:30;18119:21;18099:18;;;18092:49;18158:18;;52142:39:0;17839:343:1;51902:358:0;52212:37;:26;;;52239:2;52243:5;52212:26;:37::i;55681:257::-;55767:4;55783:12;55798:31;55815:4;55821:7;55798:16;:31::i;:::-;55783:46;;55843:7;55839:69;;;55866:18;;;;:12;:18;;;;;:31;;55889:7;55866:22;:31::i;:::-;;55924:7;55681:257;-1:-1:-1;;;55681:257:0:o;56041:262::-;56128:4;56144:12;56159:32;56177:4;56183:7;56159:17;:32::i;:::-;56144:47;;56205:7;56201:72;;;56228:18;;;;:12;:18;;;;;:34;;56254:7;56228:25;:34::i;33110:156::-;33184:7;33234:22;33238:3;33250:5;33234:3;:22::i;32653:115::-;32716:7;32742:19;32750:3;28092:18;;28010:107;47568:197;47067:4;47090:12;;;;;;;;;;;:29;;;;;;;;;;;;;47651:108;;47701:47;;;;;18391:42:1;18379:55;;47701:47:0;;;18361:74:1;18451:18;;;18444:34;;;18334:18;;47701:47:0;18187:297:1;47651:108:0;47568:197;;:::o;39818:160::-;39927:43;;;39942:14;18379:55:1;;39927:43:0;;;18361:74:1;18451:18;;;;18444:34;;;39927:43:0;;;;;;;;;;18334:18:1;;;;39927:43:0;;;;;;;;;;;;;;39900:71;;39920:5;;39900:19;:71::i;50315:316::-;50392:4;47090:12;;;;;;;;;;;:29;;;;;;;;;;;;;50408:217;;50451:6;:12;;;;;;;;;;;:29;;;;;;;;;;:36;;;;50483:4;50451:36;;;50533:12;22406:10;;22327:96;50533:12;50506:40;;50524:7;50506:40;;50518:4;50506:40;;;;;;;;;;-1:-1:-1;50567:4:0;50560:11;;50408:217;-1:-1:-1;50609:5:0;50602:12;;31852:150;31922:4;31945:50;31950:3;31970:23;;;31945:4;:50::i;50866:317::-;50944:4;47090:12;;;;;;;;;;;:29;;;;;;;;;;;;;50960:217;;;51034:5;51002:12;;;;;;;;;;;:29;;;;;;;;;;;:37;;;;;;51058:40;22406:10;;51002:12;;51058:40;;51034:5;51058:40;-1:-1:-1;51119:4:0;51112:11;;32170:156;32243:4;32266:53;32274:3;32294:23;;;32266:7;:53::i;28459:118::-;28526:7;28552:3;:11;;28564:5;28552:18;;;;;;;;:::i;:::-;;;;;;;;;28545:25;;28459:118;;;;:::o;42574:629::-;42993:23;43019:33;:27;;;43047:4;43019:27;:33::i;:::-;42993:59;;43066:10;:17;43087:1;43066:22;;:57;;;;;43104:10;43093:30;;;;;;;;;;;;:::i;:::-;43092:31;43066:57;43062:135;;;43146:40;;;;;8086:42:1;8074:55;;43146:40:0;;;8056:74:1;8029:18;;43146:40:0;7910:226:1;25777:406:0;25840:4;27896:21;;;:14;;;:21;;;;;;25856:321;;-1:-1:-1;25898:23:0;;;;;;;;:11;:23;;;;;;;;;;;;;26080:18;;26056:21;;;:14;;;:21;;;;;;:42;;;;26112:11;;26351:1368;26417:4;26546:21;;;:14;;;:21;;;;;;26582:13;;26578:1135;;26949:18;26970:12;26981:1;26970:8;:12;:::i;:::-;27016:18;;26949:33;;-1:-1:-1;26996:17:0;;27016:22;;27037:1;;27016:22;:::i;:::-;26996:42;;27071:9;27057:10;:23;27053:378;;27100:17;27120:3;:11;;27132:9;27120:22;;;;;;;;:::i;:::-;;;;;;;;;27100:42;;27267:9;27241:3;:11;;27253:10;27241:23;;;;;;;;:::i;:::-;;;;;;;;;;;;:35;;;;27380:25;;;:14;;;:25;;;;;:36;;;27053:378;27509:17;;:3;;:17;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;27612:3;:14;;:21;27627:5;27612:21;;;;;;;;;;;27605:28;;;27655:4;27648:11;;;;;;;26578:1135;27697:5;27690:12;;;;;18112:151;18187:12;18218:38;18240:6;18248:4;18254:1;18187:12;18828;18842:23;18869:6;:11;;18888:5;18895:4;18869:31;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;18827:73;;;;18917:55;18944:6;18952:7;18961:10;18917:26;:55::i;:::-;18910:62;18587:392;-1:-1:-1;;;;;;18587:392:0:o;20032:582::-;20176:12;20205:7;20200:408;;20228:19;20236:10;20228:7;:19::i;:::-;20200:408;;;20452:17;;:22;:49;;;;-1:-1:-1;20478:18:0;;;;:23;20452:49;20448:119;;;20528:24;;;;;8086:42:1;8074:55;;20528:24:0;;;8056:74:1;8029:18;;20528:24:0;7910:226:1;20448:119:0;-1:-1:-1;20587:10:0;20580:17;;21150:516;21281:17;;:21;21277:383;;21509:10;21503:17;21565:15;21552:10;21548:2;21544:19;21537:44;21277:383;21632: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:154;907:42;900:5;896:54;889:5;886:65;876:93;;965:1;962;955:12;980:134;1048:20;;1077:31;1048:20;1077:31;:::i;:::-;980:134;;;:::o;1119:388::-;1187:6;1195;1248:2;1236:9;1227:7;1223:23;1219:32;1216:52;;;1264:1;1261;1254:12;1216:52;1303:9;1290:23;1322:31;1347:5;1322:31;:::i;:::-;1372:5;-1:-1:-1;1429:2:1;1414:18;;1401:32;1442:33;1401:32;1442:33;:::i;:::-;1494:7;1484:17;;;1119:388;;;;;:::o;1694:180::-;1753:6;1806:2;1794:9;1785:7;1781:23;1777:32;1774:52;;;1822:1;1819;1812:12;1774:52;-1:-1:-1;1845:23:1;;1694:180;-1:-1:-1;1694:180:1:o;1879:315::-;1947:6;1955;2008:2;1996:9;1987:7;1983:23;1979:32;1976:52;;;2024:1;2021;2014:12;1976:52;2060:9;2047:23;2037:33;;2120:2;2109:9;2105:18;2092:32;2133:31;2158:5;2133:31;:::i;2199:184::-;2251:77;2248:1;2241:88;2348:4;2345:1;2338:15;2372:4;2369:1;2362:15;2388:255;2460:2;2454:9;2502:6;2490:19;;2539:18;2524:34;;2560:22;;;2521:62;2518:88;;;2586:18;;:::i;:::-;2622:2;2615:22;2388:255;:::o;2648:247::-;2715:2;2709:9;2757:3;2745:16;;2791:18;2776:34;;2812:22;;;2773:62;2770:88;;;2838:18;;:::i;2900:777::-;2942:5;2995:3;2988:4;2980:6;2976:17;2972:27;2962:55;;3013:1;3010;3003:12;2962:55;3049:6;3036:20;3075:18;3112:2;3108;3105:10;3102:36;;;3118:18;;:::i;:::-;3252:2;3246:9;3314:4;3306:13;;3157:66;3302:22;;;3326:2;3298:31;3294:40;3282:53;;;3350:18;;;3370:22;;;3347:46;3344:72;;;3396:18;;:::i;:::-;3436:10;3432:2;3425:22;3471:2;3463:6;3456:18;3517:3;3510:4;3505:2;3497:6;3493:15;3489:26;3486:35;3483:55;;;3534:1;3531;3524:12;3483:55;3598:2;3591:4;3583:6;3579:17;3572:4;3564:6;3560:17;3547:54;3645:1;3638:4;3633:2;3625:6;3621:15;3617:26;3610:37;3665:6;3656:15;;;;;;2900:777;;;;:::o;3682:455::-;3759:6;3767;3820:2;3808:9;3799:7;3795:23;3791:32;3788:52;;;3836:1;3833;3826:12;3788:52;3876:9;3863:23;3909:18;3901:6;3898:30;3895:50;;;3941:1;3938;3931:12;3895:50;3964:49;4005:7;3996:6;3985:9;3981:22;3964:49;:::i;:::-;3954:59;;;4063:2;4052:9;4048:18;4035:32;4076:31;4101:5;4076:31;:::i;4142:121::-;4227:10;4220:5;4216:22;4209:5;4206:33;4196:61;;4253:1;4250;4243:12;4268:132;4335:20;;4364:30;4335:20;4364:30;:::i;4405:118::-;4491:5;4484:13;4477:21;4470:5;4467:32;4457:60;;4513:1;4510;4503:12;4528:128;4593:20;;4622:28;4593:20;4622:28;:::i;4661:806::-;4720:5;4768:6;4756:9;4751:3;4747:19;4743:32;4740:52;;;4788:1;4785;4778:12;4740:52;4810:22;;:::i;:::-;4801:31;;4855:28;4873:9;4855:28;:::i;:::-;4848:5;4841:43;4916:38;4950:2;4939:9;4935:18;4916:38;:::i;:::-;4911:2;4904:5;4900:14;4893:62;4987:38;5021:2;5010:9;5006:18;4987:38;:::i;:::-;4982:2;4975:5;4971:14;4964:62;5058:38;5092:2;5081:9;5077:18;5058:38;:::i;:::-;5053:2;5046:5;5042:14;5035:62;5130:39;5164:3;5153:9;5149:19;5130:39;:::i;:::-;5124:3;5117:5;5113:15;5106:64;5231:3;5220:9;5216:19;5203:33;5197:3;5190:5;5186:15;5179:58;5298:3;5287:9;5283:19;5270:33;5264:3;5257:5;5253:15;5246:58;5337:36;5368:3;5357:9;5353:19;5337:36;:::i;:::-;5331:3;5324:5;5320:15;5313:61;5393:3;5456:2;5445:9;5441:18;5428:32;5423:2;5416:5;5412:14;5405:56;;4661:806;;;;:::o;5472:237::-;5560:6;5613:3;5601:9;5592:7;5588:23;5584:33;5581:53;;;5630:1;5627;5620:12;5581:53;5653:50;5695:7;5684:9;5653:50;:::i;5714:320::-;5782:6;5835:2;5823:9;5814:7;5810:23;5806:32;5803:52;;;5851:1;5848;5841:12;5803:52;5891:9;5878:23;5924:18;5916:6;5913:30;5910:50;;;5956:1;5953;5946:12;5910:50;5979:49;6020:7;6011:6;6000:9;5996:22;5979:49;:::i;:::-;5969:59;5714:320;-1:-1:-1;;;;5714:320:1:o;6039:273::-;6115:6;6168:2;6156:9;6147:7;6143:23;6139:32;6136:52;;;6184:1;6181;6174:12;6136:52;6223:9;6210:23;6262:1;6255:5;6252:12;6242:40;;6278:1;6275;6268:12;6317:250;6402:1;6412:113;6426:6;6423:1;6420:13;6412:113;;;6502:11;;;6496:18;6483:11;;;6476:39;6448:2;6441:10;6412:113;;;-1:-1:-1;;6559:1:1;6541:16;;6534:27;6317:250::o;6572:330::-;6614:3;6652:5;6646:12;6679:6;6674:3;6667:19;6695:76;6764:6;6757:4;6752:3;6748:14;6741:4;6734:5;6730:16;6695:76;:::i;:::-;6816:2;6804:15;6821:66;6800:88;6791:98;;;;6891:4;6787:109;;6572:330;-1:-1:-1;;6572:330:1:o;6907:220::-;7056:2;7045:9;7038:21;7019:4;7076:45;7117:2;7106:9;7102:18;7094:6;7076:45;:::i;7132:388::-;7209:6;7217;7270:2;7258:9;7249:7;7245:23;7241:32;7238:52;;;7286:1;7283;7276:12;7238:52;7326:9;7313:23;7359:18;7351:6;7348:30;7345:50;;;7391:1;7388;7381:12;7345:50;7414:49;7455:7;7446:6;7435:9;7431:22;7414:49;:::i;:::-;7404:59;7510:2;7495:18;;;;7482:32;;-1:-1:-1;;;;7132:388:1:o;7525:248::-;7593:6;7601;7654:2;7642:9;7633:7;7629:23;7625:32;7622:52;;;7670:1;7667;7660:12;7622:52;-1:-1:-1;;7693:23:1;;;7763:2;7748:18;;;7735:32;;-1:-1:-1;7525:248:1:o;8240:1373::-;8471:13;;8217:10;8206:22;8194:35;;8440:3;8425:19;;8543:4;8535:6;8531:17;8525:24;8558:53;8605:4;8594:9;8590:20;8576:12;8217:10;8206:22;8194:35;;8141:94;8558:53;;8660:4;8652:6;8648:17;8642:24;8675:56;8725:4;8714:9;8710:20;8694:14;7855:42;7844:54;7832:67;;7778:127;8675:56;;8780:4;8772:6;8768:17;8762:24;8795:56;8845:4;8834:9;8830:20;8814:14;7855:42;7844:54;7832:67;;7778:127;8795:56;;8900:4;8892:6;8888:17;8882:24;8915:56;8965:4;8954:9;8950:20;8934:14;7855:42;7844:54;7832:67;;7778:127;8915:56;;9020:4;9012:6;9008:17;9002:24;9035:56;9085:4;9074:9;9070:20;9054:14;7855:42;7844:54;7832:67;;7778:127;9035:56;;9147:4;9139:6;9135:17;9129:24;9122:4;9111:9;9107:20;9100:54;9210:4;9202:6;9198:17;9192:24;9185:4;9174:9;9170:20;9163:54;9236:6;9296:2;9288:6;9284:15;9278:22;9273:2;9262:9;9258:18;9251:50;;9320:6;9375:2;9367:6;9363:15;9357:22;9388:51;9435:2;9424:9;9420:18;9404:14;421:13;414:21;402:34;;351:91;9388:51;-1:-1:-1;;9458:6:1;9506:15;;;9500:22;9480:18;;;9473:50;9542:6;9590:15;;;9584:22;9564:18;;;;9557:50;;;;8240:1373;:::o;9618:440::-;9724:6;9732;9740;9793:3;9781:9;9772:7;9768:23;9764:33;9761:53;;;9810:1;9807;9800:12;9761:53;9846:9;9833:23;9823:33;;9906:2;9895:9;9891:18;9878:32;9919:31;9944:5;9919:31;:::i;:::-;9969:5;-1:-1:-1;9993:59:1;10044:7;10039:2;10024:18;;9993:59;:::i;:::-;9983:69;;9618:440;;;;;:::o;10063:523::-;10149:6;10157;10165;10218:2;10206:9;10197:7;10193:23;10189:32;10186:52;;;10234:1;10231;10224:12;10186:52;10270:9;10257:23;10247:33;;10330:2;10319:9;10315:18;10302:32;10343:31;10368:5;10343:31;:::i;:::-;10393:5;-1:-1:-1;10449:2:1;10434:18;;10421:32;10476:18;10465:30;;10462:50;;;10508:1;10505;10498:12;10462:50;10531:49;10572:7;10563:6;10552:9;10548:22;10531:49;:::i;:::-;10521:59;;;10063:523;;;;;:::o;10776:1087::-;10906:6;10914;10922;10930;10938;10946;10954;10962;10970;11023:3;11011:9;11002:7;10998:23;10994:33;10991:53;;;11040:1;11037;11030:12;10991:53;11076:9;11063:23;11053:33;;11136:2;11125:9;11121:18;11108:32;11149:31;11174:5;11149:31;:::i;:::-;11199:5;-1:-1:-1;11256:2:1;11241:18;;11228:32;11269:33;11228:32;11269:33;:::i;:::-;11321:7;-1:-1:-1;11380:2:1;11365:18;;11352:32;11393;11352;11393;:::i;:::-;11444:7;-1:-1:-1;11503:3:1;11488:19;;11475:33;11517;11475;11517;:::i;:::-;11569:7;-1:-1:-1;11628:3:1;11613:19;;11600:33;11642;11600;11642;:::i;:::-;11694:7;11684:17;;;11748:3;11737:9;11733:19;11720:33;11710:43;;11800:3;11789:9;11785:19;11772:33;11762:43;;11852:3;11841:9;11837:19;11824:33;11814:43;;10776:1087;;;;;;;;;;;:::o;11868:247::-;11927:6;11980:2;11968:9;11959:7;11955:23;11951:32;11948:52;;;11996:1;11993;11986:12;11948:52;12035:9;12022:23;12054:31;12079:5;12054:31;:::i;12867:184::-;12919:77;12916:1;12909:88;13016:4;13013:1;13006:15;13040:4;13037:1;13030:15;13056:136;13134:13;;13156:30;13134:13;13156:30;:::i;13197:138::-;13276:13;;13298:31;13276:13;13298:31;:::i;13340:132::-;13416:13;;13438:28;13416:13;13438:28;:::i;13477:1183::-;13580:6;13633:3;13621:9;13612:7;13608:23;13604:33;13601:53;;;13650:1;13647;13640:12;13601:53;13676:17;;:::i;:::-;13716:39;13745:9;13716:39;:::i;:::-;13709:5;13702:54;13788:48;13832:2;13821:9;13817:18;13788:48;:::i;:::-;13783:2;13776:5;13772:14;13765:72;13869:49;13914:2;13903:9;13899:18;13869:49;:::i;:::-;13864:2;13857:5;13853:14;13846:73;13951:49;13996:2;13985:9;13981:18;13951:49;:::i;:::-;13946:2;13939:5;13935:14;13928:73;14034:50;14079:3;14068:9;14064:19;14034:50;:::i;:::-;14028:3;14021:5;14017:15;14010:75;14118:50;14163:3;14152:9;14148:19;14118:50;:::i;:::-;14112:3;14105:5;14101:15;14094:75;14223:3;14212:9;14208:19;14202:26;14196:3;14189:5;14185:15;14178:51;14283:3;14272:9;14268:19;14262:26;14256:3;14249:5;14245:15;14238:51;14308:3;14364:2;14353:9;14349:18;14343:25;14338:2;14331:5;14327:14;14320:49;;14388:3;14423:46;14465:2;14454:9;14450:18;14423:46;:::i;:::-;14407:14;;;14400:70;14489:3;14530:18;;;14524:25;14508:14;;;14501:49;14569:3;14610:18;;;14604:25;14588:14;;;14581:49;;;;-1:-1:-1;14411:5:1;13477:1183;-1:-1:-1;13477:1183:1:o;14665:184::-;14717:77;14714:1;14707:88;14814:4;14811:1;14804:15;14838:4;14835:1;14828:15;14854:168;14927:9;;;14958;;14975:15;;;14969:22;;14955:37;14945:71;;14996:18;;:::i;15027:274::-;15067:1;15093;15083:189;;15128:77;15125:1;15118:88;15229:4;15226:1;15219:15;15257:4;15254:1;15247:15;15083:189;-1:-1:-1;15286:9:1;;15027:274::o;15306:128::-;15373:9;;;15394:11;;;15391:37;;;15408:18;;:::i;15439:195::-;15478:3;15509:66;15502:5;15499:77;15496:103;;15579:18;;:::i;:::-;-1:-1:-1;15626:1:1;15615:13;;15439:195::o;15639:753::-;15946:3;15935:9;15928:22;15909:4;15967:46;16008:3;15997:9;15993:19;15985:6;15967:46;:::i;:::-;16061:10;16049:23;;;;16044:2;16029:18;;16022:51;-1:-1:-1;16092:42:1;16170:15;;;16165:2;16150:18;;16143:43;16222:15;;;;16217:2;16202:18;;16195:43;16269:3;16254:19;;16247:35;;;;16313:3;16298:19;;16291:35;16370:14;;16363:22;16357:3;16342:19;;;16335:51;15959:54;15639:753;-1:-1:-1;15639:753:1:o;18791:184::-;18843:77;18840:1;18833:88;18940:4;18937:1;18930:15;18964:4;18961:1;18954:15;18980:245;19047:6;19100:2;19088:9;19079:7;19075:23;19071:32;19068:52;;;19116:1;19113;19106:12;19068:52;19148:9;19142:16;19167:28;19189:5;19167:28;:::i;19230:184::-;19282:77;19279:1;19272:88;19379:4;19376:1;19369:15;19403:4;19400:1;19393:15;19419:287;19548:3;19586:6;19580:13;19602:66;19661:6;19656:3;19649:4;19641:6;19637:17;19602:66;:::i;:::-;19684:16;;;;;19419:287;-1:-1:-1;;19419:287: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":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"},{"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":[{"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":[],"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":[],"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":"pure","type":"function"},{"inputs":[{"internalType":"enum FastBridge.BridgeStatus","name":"keyValue","type":"uint8"}],"name":"getEnumKeyByValue","outputs":[{"internalType":"string","name":"","type":"string"}],"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":[{"internalType":"bytes32","name":"transactionId","type":"bytes32"},{"internalType":"address","name":"relayer","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint32","name":"originChainId","type":"uint32"},{"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":"chainGasAmount","type":"uint256"}],"name":"mockBridgeRelayer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"transactionId","type":"bytes32"},{"internalType":"address","name":"sender","type":"address"},{"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":"mockBridgeRequest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"transactionId","type":"bytes32"},{"internalType":"address","name":"sender","type":"address"},{"internalType":"bytes","name":"request","type":"bytes"}],"name":"mockBridgeRequestRaw","outputs":[],"stateMutability":"nonpayable","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":"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":"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":{"bridge((uint32,address,address,address,address,uint256,uint256,bool,uint256))":{"notice":"Initiates bridge on origin chain to be relayed by off-chain relayer"},"chainGasAmount()":{"notice":"Chain gas amount to forward as rebate if requested"},"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"},"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"},"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":{"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 ERC-20 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"}},"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"}},"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"}},"refund(bytes)":{"params":{"request":"The encoded bridge transaction to refund"}},"relay(bytes)":{"params":{"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":"to prevent replays"}},"version":1},"metadata":"{\"compiler\":{\"version\":\"0.8.20+commit.a1b79de6\"},\"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\":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\"},{\"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\":[{\"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\":[],\"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\":[],\"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\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"enum FastBridge.BridgeStatus\",\"name\":\"keyValue\",\"type\":\"uint8\"}],\"name\":\"getEnumKeyByValue\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"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\":[{\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"originChainId\",\"type\":\"uint32\"},{\"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\":\"chainGasAmount\",\"type\":\"uint256\"}],\"name\":\"mockBridgeRelayer\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"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\":\"mockBridgeRequest\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"request\",\"type\":\"bytes\"}],\"name\":\"mockBridgeRequestRaw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"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\":\"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\":\"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 ERC-20 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\"}},\"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\"}},\"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\"}},\"refund(bytes)\":{\"params\":{\"request\":\"The encoded bridge transaction to refund\"}},\"relay(bytes)\":{\"params\":{\"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\":\"to prevent replays\"}},\"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\"},\"chainGasAmount()\":{\"notice\":\"Chain gas amount to forward as rebate if requested\"},\"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\"},\"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\"},\"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/FastBridgeMock.sol\":\"FastBridgeMock\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeMock.sol\":{\"keccak256\":\"0x4fff59c4cd271340f4a824126cbe4ebe7c8dc20639e268edf42ff873af31f862\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://4d33ef4f98d2abd98b4bbcb403b27495c37843b37000bea9f48e533078144d84\",\"dweb:/ipfs/QmTMkQhtNJPVgpxiLnEG45Ww7xfXHMEoVQ5JdbEbaFXwwS\"]}},\"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","bridge((uint32,address,address,address,address,uint256,uint256,bool,uint256))":"45851694","canClaim(bytes32,address)":"aa9641ab","chainGasAmount()":"e00a83e0","claim(bytes,address)":"41fcb612","deployBlock()":"a3ec191a","dispute(bytes32)":"add98c70","getBridgeTransaction(bytes)":"ac11fb1a","getEnumKeyByValue(uint8)":"85ad903d","getRoleAdmin(bytes32)":"248a9ca3","getRoleMember(bytes32,uint256)":"9010d07c","getRoleMemberCount(bytes32)":"ca15c873","grantRole(bytes32,address)":"2f2ff15d","hasRole(bytes32,address)":"91d14854","mockBridgeRelayer(bytes32,address,address,uint32,address,address,uint256,uint256,uint256)":"c72870cc","mockBridgeRequest(bytes32,address,(uint32,address,address,address,address,uint256,uint256,bool,uint256))":"acaebbf1","mockBridgeRequestRaw(bytes32,address,bytes)":"aedf009d","nonce()":"affed0e0","protocolFeeRate()":"58f85880","protocolFees(address)":"dcf844a7","prove(bytes,bytes32)":"886d36ff","refund(bytes)":"5eb7d946","relay(bytes)":"8f0d6f17","renounceRole(bytes32,address)":"36568abe","revokeRole(bytes32,address)":"d547741f","setChainGasAmount(uint256)":"b250fe6b","setProtocolFeeRate(uint256)":"b13aa2d6","supportsInterface(bytes4)":"01ffc9a7","sweepProtocolFees(address,address)":"06f333f2"}},"solidity/FastBridgeMock.sol:IAccessControl":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.20 ^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 pure 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/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// lib/openzeppelin-contracts/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 ERC-165 detection.\n */\ninterface IAccessControl {\n /**\n * @dev The `account` is missing a role.\n */\n error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);\n\n /**\n * @dev The caller of a function is not the expected one.\n *\n * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.\n */\n error AccessControlBadConfirmation();\n\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted 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// lib/openzeppelin-contracts/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 ERC-20 standard as defined in the ERC.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the value of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the value of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 value) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n * caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 value) external returns (bool);\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\n * allowance mechanism. `value` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n\n// lib/openzeppelin-contracts/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 ERC-20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[ERC-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC-20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n *\n * ==== Security Considerations\n *\n * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\n * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\n * considered as an intention to spend the allowance in any specific way. The second is that because permits have\n * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\n * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\n * generally recommended is:\n *\n * ```solidity\n * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\n * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\n * doThing(..., value);\n * }\n *\n * function doThing(..., uint256 value) public {\n * token.safeTransferFrom(msg.sender, address(this), value);\n * ...\n * }\n * ```\n *\n * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\n * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\n * {SafeERC20-safeTransferFrom}).\n *\n * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\n * contracts should have entry points that don't rely on permit.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also 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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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 ERC-165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[ERC].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n\n// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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 ERC-165 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// lib/openzeppelin-contracts/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 ERC-165 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// lib/openzeppelin-contracts/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 ERC-20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n /**\n * @dev An operation with an ERC-20 token failed.\n */\n error SafeERC20FailedOperation(address token);\n\n /**\n * @dev Indicates a failed `decreaseAllowance` request.\n */\n error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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/FastBridge.sol\n\ncontract FastBridge is IFastBridge, Admin {\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 enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeStatus) public bridgeStatuses;\n /// @notice Proof of relayed bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeProof) public bridgeProofs;\n /// @notice Whether bridge has been relayed on destination chain\n mapping(bytes32 =\u003e bool) public bridgeRelays;\n\n /// @dev to prevent replays\n uint256 public nonce;\n // @dev 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 /// @notice Pulls a requested token from the user to the requested recipient.\n /// @dev Be careful of re-entrancy issues when msg.value \u003e 0 and recipient != address(this)\n function _pullToken(address recipient, address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token != UniversalTokenLib.ETH_ADDRESS) {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(recipient);\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, recipient, amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(recipient) - amountPulled;\n } else {\n // Otherwise, we need to check that ETH amount matches msg.value\n if (amount != msg.value) revert MsgValueIncorrect();\n // Transfer value to recipient if not this address\n if (recipient != address(this)) token.universalTransfer(recipient, amount);\n // We will forward msg.value in the external call later, if recipient is not this contract\n amountPulled = msg.value;\n }\n }\n\n /// @inheritdoc IFastBridge\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n // check bridge params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\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\n // transfer tokens to bridge contract\n // @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(address(this), 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 BridgeTransaction({\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 sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n\n // check haven't exceeded deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n\n // mark bridge transaction as relayed\n if (bridgeRelays[transactionId]) revert TransactionRelayed();\n bridgeRelays[transactionId] = true;\n\n // transfer tokens to recipient on destination chain and gas rebate if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n uint256 rebate = chainGasAmount;\n if (!transaction.sendChainGas) {\n // forward erc20\n rebate = 0;\n _pullToken(to, token, amount);\n } else if (token == UniversalTokenLib.ETH_ADDRESS) {\n // lump in gas rebate into amount in native gas token\n _pullToken(to, token, amount + rebate);\n } else {\n // forward erc20 then forward gas rebate in native gas token\n _pullToken(to, token, amount);\n _pullToken(to, UniversalTokenLib.ETH_ADDRESS, rebate);\n }\n\n emit BridgeRelayed(\n transactionId,\n msg.sender,\n to,\n transaction.originChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n rebate\n );\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n // update bridge tx status given proof provided\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = BridgeStatus.RELAYER_PROVED;\n bridgeProofs[transactionId] = BridgeProof({timestamp: uint96(block.timestamp), relayer: msg.sender}); // overflow ok\n\n emit BridgeProofProvided(transactionId, msg.sender, destTxHash);\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint96(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint96).max but\n /// proof.timestamp \u003c type(uint96).max via unchecked statement\n /// @param proof The bridge proof\n /// @return delta Time delta since proof submitted\n function _timeSince(BridgeProof memory proof) internal view returns (uint256 delta) {\n unchecked {\n delta = uint96(block.timestamp) - proof.timestamp;\n }\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != relayer) revert SenderIncorrect();\n return _timeSince(proof) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != msg.sender) revert SenderIncorrect();\n if (_timeSince(proof) \u003c= DISPUTE_PERIOD) revert DisputePeriodNotPassed();\n\n bridgeStatuses[transactionId] = 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, msg.sender, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeProofs[transactionId]) \u003e DISPUTE_PERIOD) revert DisputePeriodPassed();\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n delete bridgeProofs[transactionId];\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 BridgeTransaction memory transaction = getBridgeTransaction(request);\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 // set status to refunded if still in requested state\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = 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\n// test/FastBridgeMock.sol\n\ncontract FastBridgeMock is IFastBridge, Admin {\n // @dev 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 /// @dev to prevent replays\n uint256 public nonce;\n\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n // used for testing in go.\n // see: https://ethereum.stackexchange.com/questions/21155/how-to-expose-enum-in-solidity-contract\n // make sure to update fastbridge/status.go if this changes\n // or underliyng enum changes.\n //\n // TODO: a foundry test should be added to ensure this is always in sync.\n function getEnumKeyByValue(FastBridge.BridgeStatus keyValue) public pure returns (string memory) {\n if (FastBridge.BridgeStatus.NULL == keyValue) return \"NULL\";\n if (FastBridge.BridgeStatus.REQUESTED == keyValue) return \"REQUESTED\";\n if (FastBridge.BridgeStatus.RELAYER_PROVED == keyValue) return \"RELAYER_PROVED\";\n if (FastBridge.BridgeStatus.RELAYER_CLAIMED == keyValue) return \"RELAYER_CLAIMED\";\n if (FastBridge.BridgeStatus.REFUNDED == keyValue) return \"REFUNDED\";\n return \"\";\n }\n\n function mockBridgeRequest(bytes32 transactionId, address sender, BridgeParams memory params) external {\n uint256 originFeeAmount = (params.originAmount * protocolFeeRate) / FEE_BPS;\n params.originAmount -= originFeeAmount;\n\n bytes memory request = abi.encode(\n BridgeTransaction({\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: params.originAmount, // includes relayer fee\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n params.originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n function mockBridgeRequestRaw(bytes32 transactionId, address sender, bytes memory request) external {\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n emit BridgeRequested(\n transactionId,\n transaction.originSender,\n request,\n transaction.destChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n transaction.sendChainGas\n );\n }\n\n function mockBridgeRelayer(\n bytes32 transactionId,\n address relayer,\n address to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n )\n external\n {\n emit BridgeRelayed(\n transactionId, relayer, to, originChainId, originToken, destToken, originAmount, destAmount, chainGasAmount\n );\n }\n\n function bridge(BridgeParams memory params) external payable {\n revert(\"not implemented\");\n }\n\n function relay(bytes memory request) external payable {\n revert(\"not implemented\");\n }\n\n function prove(bytes memory request, bytes32 destTxHash) external {\n revert(\"not implemented\");\n }\n\n function canClaim(bytes32 transactionid, address relayer) external view returns (bool) {\n revert(\"not implemented\");\n }\n\n function claim(bytes memory request, address to) external {\n revert(\"not implemented\");\n }\n\n function dispute(bytes32 transactionId) external {\n revert(\"not implemented\");\n }\n\n function refund(bytes memory request) external {\n revert(\"not implemented\");\n }\n}\n","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","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 ERC-165 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.20+commit.a1b79de6\"},\"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 ERC-165 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/FastBridgeMock.sol\":\"IAccessControl\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeMock.sol\":{\"keccak256\":\"0x4fff59c4cd271340f4a824126cbe4ebe7c8dc20639e268edf42ff873af31f862\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://4d33ef4f98d2abd98b4bbcb403b27495c37843b37000bea9f48e533078144d84\",\"dweb:/ipfs/QmTMkQhtNJPVgpxiLnEG45Ww7xfXHMEoVQ5JdbEbaFXwwS\"]}},\"version\":1}"},"hashes":{"getRoleAdmin(bytes32)":"248a9ca3","grantRole(bytes32,address)":"2f2ff15d","hasRole(bytes32,address)":"91d14854","renounceRole(bytes32,address)":"36568abe","revokeRole(bytes32,address)":"d547741f"}},"solidity/FastBridgeMock.sol:IAccessControlEnumerable":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.20 ^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 pure 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/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// lib/openzeppelin-contracts/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 ERC-165 detection.\n */\ninterface IAccessControl {\n /**\n * @dev The `account` is missing a role.\n */\n error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);\n\n /**\n * @dev The caller of a function is not the expected one.\n *\n * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.\n */\n error AccessControlBadConfirmation();\n\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted 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// lib/openzeppelin-contracts/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 ERC-20 standard as defined in the ERC.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the value of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the value of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 value) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n * caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 value) external returns (bool);\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\n * allowance mechanism. `value` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n\n// lib/openzeppelin-contracts/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 ERC-20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[ERC-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC-20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n *\n * ==== Security Considerations\n *\n * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\n * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\n * considered as an intention to spend the allowance in any specific way. The second is that because permits have\n * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\n * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\n * generally recommended is:\n *\n * ```solidity\n * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\n * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\n * doThing(..., value);\n * }\n *\n * function doThing(..., uint256 value) public {\n * token.safeTransferFrom(msg.sender, address(this), value);\n * ...\n * }\n * ```\n *\n * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\n * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\n * {SafeERC20-safeTransferFrom}).\n *\n * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\n * contracts should have entry points that don't rely on permit.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also 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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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 ERC-165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[ERC].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n\n// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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 ERC-165 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// lib/openzeppelin-contracts/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 ERC-165 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// lib/openzeppelin-contracts/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 ERC-20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n /**\n * @dev An operation with an ERC-20 token failed.\n */\n error SafeERC20FailedOperation(address token);\n\n /**\n * @dev Indicates a failed `decreaseAllowance` request.\n */\n error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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/FastBridge.sol\n\ncontract FastBridge is IFastBridge, Admin {\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 enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeStatus) public bridgeStatuses;\n /// @notice Proof of relayed bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeProof) public bridgeProofs;\n /// @notice Whether bridge has been relayed on destination chain\n mapping(bytes32 =\u003e bool) public bridgeRelays;\n\n /// @dev to prevent replays\n uint256 public nonce;\n // @dev 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 /// @notice Pulls a requested token from the user to the requested recipient.\n /// @dev Be careful of re-entrancy issues when msg.value \u003e 0 and recipient != address(this)\n function _pullToken(address recipient, address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token != UniversalTokenLib.ETH_ADDRESS) {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(recipient);\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, recipient, amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(recipient) - amountPulled;\n } else {\n // Otherwise, we need to check that ETH amount matches msg.value\n if (amount != msg.value) revert MsgValueIncorrect();\n // Transfer value to recipient if not this address\n if (recipient != address(this)) token.universalTransfer(recipient, amount);\n // We will forward msg.value in the external call later, if recipient is not this contract\n amountPulled = msg.value;\n }\n }\n\n /// @inheritdoc IFastBridge\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n // check bridge params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\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\n // transfer tokens to bridge contract\n // @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(address(this), 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 BridgeTransaction({\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 sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n\n // check haven't exceeded deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n\n // mark bridge transaction as relayed\n if (bridgeRelays[transactionId]) revert TransactionRelayed();\n bridgeRelays[transactionId] = true;\n\n // transfer tokens to recipient on destination chain and gas rebate if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n uint256 rebate = chainGasAmount;\n if (!transaction.sendChainGas) {\n // forward erc20\n rebate = 0;\n _pullToken(to, token, amount);\n } else if (token == UniversalTokenLib.ETH_ADDRESS) {\n // lump in gas rebate into amount in native gas token\n _pullToken(to, token, amount + rebate);\n } else {\n // forward erc20 then forward gas rebate in native gas token\n _pullToken(to, token, amount);\n _pullToken(to, UniversalTokenLib.ETH_ADDRESS, rebate);\n }\n\n emit BridgeRelayed(\n transactionId,\n msg.sender,\n to,\n transaction.originChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n rebate\n );\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n // update bridge tx status given proof provided\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = BridgeStatus.RELAYER_PROVED;\n bridgeProofs[transactionId] = BridgeProof({timestamp: uint96(block.timestamp), relayer: msg.sender}); // overflow ok\n\n emit BridgeProofProvided(transactionId, msg.sender, destTxHash);\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint96(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint96).max but\n /// proof.timestamp \u003c type(uint96).max via unchecked statement\n /// @param proof The bridge proof\n /// @return delta Time delta since proof submitted\n function _timeSince(BridgeProof memory proof) internal view returns (uint256 delta) {\n unchecked {\n delta = uint96(block.timestamp) - proof.timestamp;\n }\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != relayer) revert SenderIncorrect();\n return _timeSince(proof) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != msg.sender) revert SenderIncorrect();\n if (_timeSince(proof) \u003c= DISPUTE_PERIOD) revert DisputePeriodNotPassed();\n\n bridgeStatuses[transactionId] = 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, msg.sender, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeProofs[transactionId]) \u003e DISPUTE_PERIOD) revert DisputePeriodPassed();\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n delete bridgeProofs[transactionId];\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 BridgeTransaction memory transaction = getBridgeTransaction(request);\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 // set status to refunded if still in requested state\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = 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\n// test/FastBridgeMock.sol\n\ncontract FastBridgeMock is IFastBridge, Admin {\n // @dev 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 /// @dev to prevent replays\n uint256 public nonce;\n\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n // used for testing in go.\n // see: https://ethereum.stackexchange.com/questions/21155/how-to-expose-enum-in-solidity-contract\n // make sure to update fastbridge/status.go if this changes\n // or underliyng enum changes.\n //\n // TODO: a foundry test should be added to ensure this is always in sync.\n function getEnumKeyByValue(FastBridge.BridgeStatus keyValue) public pure returns (string memory) {\n if (FastBridge.BridgeStatus.NULL == keyValue) return \"NULL\";\n if (FastBridge.BridgeStatus.REQUESTED == keyValue) return \"REQUESTED\";\n if (FastBridge.BridgeStatus.RELAYER_PROVED == keyValue) return \"RELAYER_PROVED\";\n if (FastBridge.BridgeStatus.RELAYER_CLAIMED == keyValue) return \"RELAYER_CLAIMED\";\n if (FastBridge.BridgeStatus.REFUNDED == keyValue) return \"REFUNDED\";\n return \"\";\n }\n\n function mockBridgeRequest(bytes32 transactionId, address sender, BridgeParams memory params) external {\n uint256 originFeeAmount = (params.originAmount * protocolFeeRate) / FEE_BPS;\n params.originAmount -= originFeeAmount;\n\n bytes memory request = abi.encode(\n BridgeTransaction({\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: params.originAmount, // includes relayer fee\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n params.originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n function mockBridgeRequestRaw(bytes32 transactionId, address sender, bytes memory request) external {\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n emit BridgeRequested(\n transactionId,\n transaction.originSender,\n request,\n transaction.destChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n transaction.sendChainGas\n );\n }\n\n function mockBridgeRelayer(\n bytes32 transactionId,\n address relayer,\n address to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n )\n external\n {\n emit BridgeRelayed(\n transactionId, relayer, to, originChainId, originToken, destToken, originAmount, destAmount, chainGasAmount\n );\n }\n\n function bridge(BridgeParams memory params) external payable {\n revert(\"not implemented\");\n }\n\n function relay(bytes memory request) external payable {\n revert(\"not implemented\");\n }\n\n function prove(bytes memory request, bytes32 destTxHash) external {\n revert(\"not implemented\");\n }\n\n function canClaim(bytes32 transactionid, address relayer) external view returns (bool) {\n revert(\"not implemented\");\n }\n\n function claim(bytes memory request, address to) external {\n revert(\"not implemented\");\n }\n\n function dispute(bytes32 transactionId) external {\n revert(\"not implemented\");\n }\n\n function refund(bytes memory request) external {\n revert(\"not implemented\");\n }\n}\n","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","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 ERC-165 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.20+commit.a1b79de6\"},\"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 ERC-165 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/FastBridgeMock.sol\":\"IAccessControlEnumerable\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeMock.sol\":{\"keccak256\":\"0x4fff59c4cd271340f4a824126cbe4ebe7c8dc20639e268edf42ff873af31f862\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://4d33ef4f98d2abd98b4bbcb403b27495c37843b37000bea9f48e533078144d84\",\"dweb:/ipfs/QmTMkQhtNJPVgpxiLnEG45Ww7xfXHMEoVQ5JdbEbaFXwwS\"]}},\"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/FastBridgeMock.sol:IAdmin":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.20 ^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 pure 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/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// lib/openzeppelin-contracts/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 ERC-165 detection.\n */\ninterface IAccessControl {\n /**\n * @dev The `account` is missing a role.\n */\n error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);\n\n /**\n * @dev The caller of a function is not the expected one.\n *\n * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.\n */\n error AccessControlBadConfirmation();\n\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted 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// lib/openzeppelin-contracts/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 ERC-20 standard as defined in the ERC.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the value of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the value of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 value) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n * caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 value) external returns (bool);\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\n * allowance mechanism. `value` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n\n// lib/openzeppelin-contracts/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 ERC-20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[ERC-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC-20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n *\n * ==== Security Considerations\n *\n * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\n * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\n * considered as an intention to spend the allowance in any specific way. The second is that because permits have\n * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\n * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\n * generally recommended is:\n *\n * ```solidity\n * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\n * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\n * doThing(..., value);\n * }\n *\n * function doThing(..., uint256 value) public {\n * token.safeTransferFrom(msg.sender, address(this), value);\n * ...\n * }\n * ```\n *\n * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\n * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\n * {SafeERC20-safeTransferFrom}).\n *\n * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\n * contracts should have entry points that don't rely on permit.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also 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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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 ERC-165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[ERC].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n\n// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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 ERC-165 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// lib/openzeppelin-contracts/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 ERC-165 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// lib/openzeppelin-contracts/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 ERC-20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n /**\n * @dev An operation with an ERC-20 token failed.\n */\n error SafeERC20FailedOperation(address token);\n\n /**\n * @dev Indicates a failed `decreaseAllowance` request.\n */\n error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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/FastBridge.sol\n\ncontract FastBridge is IFastBridge, Admin {\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 enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeStatus) public bridgeStatuses;\n /// @notice Proof of relayed bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeProof) public bridgeProofs;\n /// @notice Whether bridge has been relayed on destination chain\n mapping(bytes32 =\u003e bool) public bridgeRelays;\n\n /// @dev to prevent replays\n uint256 public nonce;\n // @dev 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 /// @notice Pulls a requested token from the user to the requested recipient.\n /// @dev Be careful of re-entrancy issues when msg.value \u003e 0 and recipient != address(this)\n function _pullToken(address recipient, address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token != UniversalTokenLib.ETH_ADDRESS) {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(recipient);\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, recipient, amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(recipient) - amountPulled;\n } else {\n // Otherwise, we need to check that ETH amount matches msg.value\n if (amount != msg.value) revert MsgValueIncorrect();\n // Transfer value to recipient if not this address\n if (recipient != address(this)) token.universalTransfer(recipient, amount);\n // We will forward msg.value in the external call later, if recipient is not this contract\n amountPulled = msg.value;\n }\n }\n\n /// @inheritdoc IFastBridge\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n // check bridge params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\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\n // transfer tokens to bridge contract\n // @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(address(this), 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 BridgeTransaction({\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 sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n\n // check haven't exceeded deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n\n // mark bridge transaction as relayed\n if (bridgeRelays[transactionId]) revert TransactionRelayed();\n bridgeRelays[transactionId] = true;\n\n // transfer tokens to recipient on destination chain and gas rebate if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n uint256 rebate = chainGasAmount;\n if (!transaction.sendChainGas) {\n // forward erc20\n rebate = 0;\n _pullToken(to, token, amount);\n } else if (token == UniversalTokenLib.ETH_ADDRESS) {\n // lump in gas rebate into amount in native gas token\n _pullToken(to, token, amount + rebate);\n } else {\n // forward erc20 then forward gas rebate in native gas token\n _pullToken(to, token, amount);\n _pullToken(to, UniversalTokenLib.ETH_ADDRESS, rebate);\n }\n\n emit BridgeRelayed(\n transactionId,\n msg.sender,\n to,\n transaction.originChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n rebate\n );\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n // update bridge tx status given proof provided\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = BridgeStatus.RELAYER_PROVED;\n bridgeProofs[transactionId] = BridgeProof({timestamp: uint96(block.timestamp), relayer: msg.sender}); // overflow ok\n\n emit BridgeProofProvided(transactionId, msg.sender, destTxHash);\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint96(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint96).max but\n /// proof.timestamp \u003c type(uint96).max via unchecked statement\n /// @param proof The bridge proof\n /// @return delta Time delta since proof submitted\n function _timeSince(BridgeProof memory proof) internal view returns (uint256 delta) {\n unchecked {\n delta = uint96(block.timestamp) - proof.timestamp;\n }\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != relayer) revert SenderIncorrect();\n return _timeSince(proof) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != msg.sender) revert SenderIncorrect();\n if (_timeSince(proof) \u003c= DISPUTE_PERIOD) revert DisputePeriodNotPassed();\n\n bridgeStatuses[transactionId] = 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, msg.sender, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeProofs[transactionId]) \u003e DISPUTE_PERIOD) revert DisputePeriodPassed();\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n delete bridgeProofs[transactionId];\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 BridgeTransaction memory transaction = getBridgeTransaction(request);\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 // set status to refunded if still in requested state\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = 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\n// test/FastBridgeMock.sol\n\ncontract FastBridgeMock is IFastBridge, Admin {\n // @dev 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 /// @dev to prevent replays\n uint256 public nonce;\n\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n // used for testing in go.\n // see: https://ethereum.stackexchange.com/questions/21155/how-to-expose-enum-in-solidity-contract\n // make sure to update fastbridge/status.go if this changes\n // or underliyng enum changes.\n //\n // TODO: a foundry test should be added to ensure this is always in sync.\n function getEnumKeyByValue(FastBridge.BridgeStatus keyValue) public pure returns (string memory) {\n if (FastBridge.BridgeStatus.NULL == keyValue) return \"NULL\";\n if (FastBridge.BridgeStatus.REQUESTED == keyValue) return \"REQUESTED\";\n if (FastBridge.BridgeStatus.RELAYER_PROVED == keyValue) return \"RELAYER_PROVED\";\n if (FastBridge.BridgeStatus.RELAYER_CLAIMED == keyValue) return \"RELAYER_CLAIMED\";\n if (FastBridge.BridgeStatus.REFUNDED == keyValue) return \"REFUNDED\";\n return \"\";\n }\n\n function mockBridgeRequest(bytes32 transactionId, address sender, BridgeParams memory params) external {\n uint256 originFeeAmount = (params.originAmount * protocolFeeRate) / FEE_BPS;\n params.originAmount -= originFeeAmount;\n\n bytes memory request = abi.encode(\n BridgeTransaction({\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: params.originAmount, // includes relayer fee\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n params.originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n function mockBridgeRequestRaw(bytes32 transactionId, address sender, bytes memory request) external {\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n emit BridgeRequested(\n transactionId,\n transaction.originSender,\n request,\n transaction.destChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n transaction.sendChainGas\n );\n }\n\n function mockBridgeRelayer(\n bytes32 transactionId,\n address relayer,\n address to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n )\n external\n {\n emit BridgeRelayed(\n transactionId, relayer, to, originChainId, originToken, destToken, originAmount, destAmount, chainGasAmount\n );\n }\n\n function bridge(BridgeParams memory params) external payable {\n revert(\"not implemented\");\n }\n\n function relay(bytes memory request) external payable {\n revert(\"not implemented\");\n }\n\n function prove(bytes memory request, bytes32 destTxHash) external {\n revert(\"not implemented\");\n }\n\n function canClaim(bytes32 transactionid, address relayer) external view returns (bool) {\n revert(\"not implemented\");\n }\n\n function claim(bytes memory request, address to) external {\n revert(\"not implemented\");\n }\n\n function dispute(bytes32 transactionId) external {\n revert(\"not implemented\");\n }\n\n function refund(bytes memory request) external {\n revert(\"not implemented\");\n }\n}\n","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","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.20+commit.a1b79de6\"},\"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/FastBridgeMock.sol\":\"IAdmin\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeMock.sol\":{\"keccak256\":\"0x4fff59c4cd271340f4a824126cbe4ebe7c8dc20639e268edf42ff873af31f862\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://4d33ef4f98d2abd98b4bbcb403b27495c37843b37000bea9f48e533078144d84\",\"dweb:/ipfs/QmTMkQhtNJPVgpxiLnEG45Ww7xfXHMEoVQ5JdbEbaFXwwS\"]}},\"version\":1}"},"hashes":{"setChainGasAmount(uint256)":"b250fe6b","setProtocolFeeRate(uint256)":"b13aa2d6","sweepProtocolFees(address,address)":"06f333f2"}},"solidity/FastBridgeMock.sol:IERC165":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.20 ^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 pure 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/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// lib/openzeppelin-contracts/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 ERC-165 detection.\n */\ninterface IAccessControl {\n /**\n * @dev The `account` is missing a role.\n */\n error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);\n\n /**\n * @dev The caller of a function is not the expected one.\n *\n * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.\n */\n error AccessControlBadConfirmation();\n\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted 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// lib/openzeppelin-contracts/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 ERC-20 standard as defined in the ERC.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the value of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the value of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 value) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n * caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 value) external returns (bool);\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\n * allowance mechanism. `value` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n\n// lib/openzeppelin-contracts/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 ERC-20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[ERC-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC-20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n *\n * ==== Security Considerations\n *\n * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\n * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\n * considered as an intention to spend the allowance in any specific way. The second is that because permits have\n * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\n * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\n * generally recommended is:\n *\n * ```solidity\n * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\n * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\n * doThing(..., value);\n * }\n *\n * function doThing(..., uint256 value) public {\n * token.safeTransferFrom(msg.sender, address(this), value);\n * ...\n * }\n * ```\n *\n * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\n * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\n * {SafeERC20-safeTransferFrom}).\n *\n * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\n * contracts should have entry points that don't rely on permit.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also 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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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 ERC-165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[ERC].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n\n// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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 ERC-165 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// lib/openzeppelin-contracts/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 ERC-165 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// lib/openzeppelin-contracts/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 ERC-20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n /**\n * @dev An operation with an ERC-20 token failed.\n */\n error SafeERC20FailedOperation(address token);\n\n /**\n * @dev Indicates a failed `decreaseAllowance` request.\n */\n error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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/FastBridge.sol\n\ncontract FastBridge is IFastBridge, Admin {\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 enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeStatus) public bridgeStatuses;\n /// @notice Proof of relayed bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeProof) public bridgeProofs;\n /// @notice Whether bridge has been relayed on destination chain\n mapping(bytes32 =\u003e bool) public bridgeRelays;\n\n /// @dev to prevent replays\n uint256 public nonce;\n // @dev 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 /// @notice Pulls a requested token from the user to the requested recipient.\n /// @dev Be careful of re-entrancy issues when msg.value \u003e 0 and recipient != address(this)\n function _pullToken(address recipient, address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token != UniversalTokenLib.ETH_ADDRESS) {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(recipient);\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, recipient, amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(recipient) - amountPulled;\n } else {\n // Otherwise, we need to check that ETH amount matches msg.value\n if (amount != msg.value) revert MsgValueIncorrect();\n // Transfer value to recipient if not this address\n if (recipient != address(this)) token.universalTransfer(recipient, amount);\n // We will forward msg.value in the external call later, if recipient is not this contract\n amountPulled = msg.value;\n }\n }\n\n /// @inheritdoc IFastBridge\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n // check bridge params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\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\n // transfer tokens to bridge contract\n // @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(address(this), 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 BridgeTransaction({\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 sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n\n // check haven't exceeded deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n\n // mark bridge transaction as relayed\n if (bridgeRelays[transactionId]) revert TransactionRelayed();\n bridgeRelays[transactionId] = true;\n\n // transfer tokens to recipient on destination chain and gas rebate if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n uint256 rebate = chainGasAmount;\n if (!transaction.sendChainGas) {\n // forward erc20\n rebate = 0;\n _pullToken(to, token, amount);\n } else if (token == UniversalTokenLib.ETH_ADDRESS) {\n // lump in gas rebate into amount in native gas token\n _pullToken(to, token, amount + rebate);\n } else {\n // forward erc20 then forward gas rebate in native gas token\n _pullToken(to, token, amount);\n _pullToken(to, UniversalTokenLib.ETH_ADDRESS, rebate);\n }\n\n emit BridgeRelayed(\n transactionId,\n msg.sender,\n to,\n transaction.originChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n rebate\n );\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n // update bridge tx status given proof provided\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = BridgeStatus.RELAYER_PROVED;\n bridgeProofs[transactionId] = BridgeProof({timestamp: uint96(block.timestamp), relayer: msg.sender}); // overflow ok\n\n emit BridgeProofProvided(transactionId, msg.sender, destTxHash);\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint96(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint96).max but\n /// proof.timestamp \u003c type(uint96).max via unchecked statement\n /// @param proof The bridge proof\n /// @return delta Time delta since proof submitted\n function _timeSince(BridgeProof memory proof) internal view returns (uint256 delta) {\n unchecked {\n delta = uint96(block.timestamp) - proof.timestamp;\n }\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != relayer) revert SenderIncorrect();\n return _timeSince(proof) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != msg.sender) revert SenderIncorrect();\n if (_timeSince(proof) \u003c= DISPUTE_PERIOD) revert DisputePeriodNotPassed();\n\n bridgeStatuses[transactionId] = 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, msg.sender, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeProofs[transactionId]) \u003e DISPUTE_PERIOD) revert DisputePeriodPassed();\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n delete bridgeProofs[transactionId];\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 BridgeTransaction memory transaction = getBridgeTransaction(request);\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 // set status to refunded if still in requested state\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = 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\n// test/FastBridgeMock.sol\n\ncontract FastBridgeMock is IFastBridge, Admin {\n // @dev 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 /// @dev to prevent replays\n uint256 public nonce;\n\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n // used for testing in go.\n // see: https://ethereum.stackexchange.com/questions/21155/how-to-expose-enum-in-solidity-contract\n // make sure to update fastbridge/status.go if this changes\n // or underliyng enum changes.\n //\n // TODO: a foundry test should be added to ensure this is always in sync.\n function getEnumKeyByValue(FastBridge.BridgeStatus keyValue) public pure returns (string memory) {\n if (FastBridge.BridgeStatus.NULL == keyValue) return \"NULL\";\n if (FastBridge.BridgeStatus.REQUESTED == keyValue) return \"REQUESTED\";\n if (FastBridge.BridgeStatus.RELAYER_PROVED == keyValue) return \"RELAYER_PROVED\";\n if (FastBridge.BridgeStatus.RELAYER_CLAIMED == keyValue) return \"RELAYER_CLAIMED\";\n if (FastBridge.BridgeStatus.REFUNDED == keyValue) return \"REFUNDED\";\n return \"\";\n }\n\n function mockBridgeRequest(bytes32 transactionId, address sender, BridgeParams memory params) external {\n uint256 originFeeAmount = (params.originAmount * protocolFeeRate) / FEE_BPS;\n params.originAmount -= originFeeAmount;\n\n bytes memory request = abi.encode(\n BridgeTransaction({\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: params.originAmount, // includes relayer fee\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n params.originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n function mockBridgeRequestRaw(bytes32 transactionId, address sender, bytes memory request) external {\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n emit BridgeRequested(\n transactionId,\n transaction.originSender,\n request,\n transaction.destChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n transaction.sendChainGas\n );\n }\n\n function mockBridgeRelayer(\n bytes32 transactionId,\n address relayer,\n address to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n )\n external\n {\n emit BridgeRelayed(\n transactionId, relayer, to, originChainId, originToken, destToken, originAmount, destAmount, chainGasAmount\n );\n }\n\n function bridge(BridgeParams memory params) external payable {\n revert(\"not implemented\");\n }\n\n function relay(bytes memory request) external payable {\n revert(\"not implemented\");\n }\n\n function prove(bytes memory request, bytes32 destTxHash) external {\n revert(\"not implemented\");\n }\n\n function canClaim(bytes32 transactionid, address relayer) external view returns (bool) {\n revert(\"not implemented\");\n }\n\n function claim(bytes memory request, address to) external {\n revert(\"not implemented\");\n }\n\n function dispute(bytes32 transactionId) external {\n revert(\"not implemented\");\n }\n\n function refund(bytes memory request) external {\n revert(\"not implemented\");\n }\n}\n","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","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 ERC-165 standard, as defined in the https://eips.ethereum.org/EIPS/eip-165[ERC]. 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[ERC 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.20+commit.a1b79de6\"},\"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 ERC-165 standard, as defined in the https://eips.ethereum.org/EIPS/eip-165[ERC]. 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[ERC 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/FastBridgeMock.sol\":\"IERC165\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeMock.sol\":{\"keccak256\":\"0x4fff59c4cd271340f4a824126cbe4ebe7c8dc20639e268edf42ff873af31f862\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://4d33ef4f98d2abd98b4bbcb403b27495c37843b37000bea9f48e533078144d84\",\"dweb:/ipfs/QmTMkQhtNJPVgpxiLnEG45Ww7xfXHMEoVQ5JdbEbaFXwwS\"]}},\"version\":1}"},"hashes":{"supportsInterface(bytes4)":"01ffc9a7"}},"solidity/FastBridgeMock.sol:IERC20":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.20 ^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 pure 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/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// lib/openzeppelin-contracts/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 ERC-165 detection.\n */\ninterface IAccessControl {\n /**\n * @dev The `account` is missing a role.\n */\n error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);\n\n /**\n * @dev The caller of a function is not the expected one.\n *\n * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.\n */\n error AccessControlBadConfirmation();\n\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted 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// lib/openzeppelin-contracts/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 ERC-20 standard as defined in the ERC.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the value of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the value of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 value) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n * caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 value) external returns (bool);\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\n * allowance mechanism. `value` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n\n// lib/openzeppelin-contracts/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 ERC-20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[ERC-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC-20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n *\n * ==== Security Considerations\n *\n * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\n * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\n * considered as an intention to spend the allowance in any specific way. The second is that because permits have\n * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\n * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\n * generally recommended is:\n *\n * ```solidity\n * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\n * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\n * doThing(..., value);\n * }\n *\n * function doThing(..., uint256 value) public {\n * token.safeTransferFrom(msg.sender, address(this), value);\n * ...\n * }\n * ```\n *\n * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\n * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\n * {SafeERC20-safeTransferFrom}).\n *\n * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\n * contracts should have entry points that don't rely on permit.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also 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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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 ERC-165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[ERC].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n\n// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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 ERC-165 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// lib/openzeppelin-contracts/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 ERC-165 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// lib/openzeppelin-contracts/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 ERC-20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n /**\n * @dev An operation with an ERC-20 token failed.\n */\n error SafeERC20FailedOperation(address token);\n\n /**\n * @dev Indicates a failed `decreaseAllowance` request.\n */\n error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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/FastBridge.sol\n\ncontract FastBridge is IFastBridge, Admin {\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 enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeStatus) public bridgeStatuses;\n /// @notice Proof of relayed bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeProof) public bridgeProofs;\n /// @notice Whether bridge has been relayed on destination chain\n mapping(bytes32 =\u003e bool) public bridgeRelays;\n\n /// @dev to prevent replays\n uint256 public nonce;\n // @dev 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 /// @notice Pulls a requested token from the user to the requested recipient.\n /// @dev Be careful of re-entrancy issues when msg.value \u003e 0 and recipient != address(this)\n function _pullToken(address recipient, address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token != UniversalTokenLib.ETH_ADDRESS) {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(recipient);\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, recipient, amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(recipient) - amountPulled;\n } else {\n // Otherwise, we need to check that ETH amount matches msg.value\n if (amount != msg.value) revert MsgValueIncorrect();\n // Transfer value to recipient if not this address\n if (recipient != address(this)) token.universalTransfer(recipient, amount);\n // We will forward msg.value in the external call later, if recipient is not this contract\n amountPulled = msg.value;\n }\n }\n\n /// @inheritdoc IFastBridge\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n // check bridge params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\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\n // transfer tokens to bridge contract\n // @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(address(this), 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 BridgeTransaction({\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 sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n\n // check haven't exceeded deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n\n // mark bridge transaction as relayed\n if (bridgeRelays[transactionId]) revert TransactionRelayed();\n bridgeRelays[transactionId] = true;\n\n // transfer tokens to recipient on destination chain and gas rebate if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n uint256 rebate = chainGasAmount;\n if (!transaction.sendChainGas) {\n // forward erc20\n rebate = 0;\n _pullToken(to, token, amount);\n } else if (token == UniversalTokenLib.ETH_ADDRESS) {\n // lump in gas rebate into amount in native gas token\n _pullToken(to, token, amount + rebate);\n } else {\n // forward erc20 then forward gas rebate in native gas token\n _pullToken(to, token, amount);\n _pullToken(to, UniversalTokenLib.ETH_ADDRESS, rebate);\n }\n\n emit BridgeRelayed(\n transactionId,\n msg.sender,\n to,\n transaction.originChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n rebate\n );\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n // update bridge tx status given proof provided\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = BridgeStatus.RELAYER_PROVED;\n bridgeProofs[transactionId] = BridgeProof({timestamp: uint96(block.timestamp), relayer: msg.sender}); // overflow ok\n\n emit BridgeProofProvided(transactionId, msg.sender, destTxHash);\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint96(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint96).max but\n /// proof.timestamp \u003c type(uint96).max via unchecked statement\n /// @param proof The bridge proof\n /// @return delta Time delta since proof submitted\n function _timeSince(BridgeProof memory proof) internal view returns (uint256 delta) {\n unchecked {\n delta = uint96(block.timestamp) - proof.timestamp;\n }\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != relayer) revert SenderIncorrect();\n return _timeSince(proof) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != msg.sender) revert SenderIncorrect();\n if (_timeSince(proof) \u003c= DISPUTE_PERIOD) revert DisputePeriodNotPassed();\n\n bridgeStatuses[transactionId] = 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, msg.sender, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeProofs[transactionId]) \u003e DISPUTE_PERIOD) revert DisputePeriodPassed();\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n delete bridgeProofs[transactionId];\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 BridgeTransaction memory transaction = getBridgeTransaction(request);\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 // set status to refunded if still in requested state\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = 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\n// test/FastBridgeMock.sol\n\ncontract FastBridgeMock is IFastBridge, Admin {\n // @dev 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 /// @dev to prevent replays\n uint256 public nonce;\n\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n // used for testing in go.\n // see: https://ethereum.stackexchange.com/questions/21155/how-to-expose-enum-in-solidity-contract\n // make sure to update fastbridge/status.go if this changes\n // or underliyng enum changes.\n //\n // TODO: a foundry test should be added to ensure this is always in sync.\n function getEnumKeyByValue(FastBridge.BridgeStatus keyValue) public pure returns (string memory) {\n if (FastBridge.BridgeStatus.NULL == keyValue) return \"NULL\";\n if (FastBridge.BridgeStatus.REQUESTED == keyValue) return \"REQUESTED\";\n if (FastBridge.BridgeStatus.RELAYER_PROVED == keyValue) return \"RELAYER_PROVED\";\n if (FastBridge.BridgeStatus.RELAYER_CLAIMED == keyValue) return \"RELAYER_CLAIMED\";\n if (FastBridge.BridgeStatus.REFUNDED == keyValue) return \"REFUNDED\";\n return \"\";\n }\n\n function mockBridgeRequest(bytes32 transactionId, address sender, BridgeParams memory params) external {\n uint256 originFeeAmount = (params.originAmount * protocolFeeRate) / FEE_BPS;\n params.originAmount -= originFeeAmount;\n\n bytes memory request = abi.encode(\n BridgeTransaction({\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: params.originAmount, // includes relayer fee\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n params.originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n function mockBridgeRequestRaw(bytes32 transactionId, address sender, bytes memory request) external {\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n emit BridgeRequested(\n transactionId,\n transaction.originSender,\n request,\n transaction.destChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n transaction.sendChainGas\n );\n }\n\n function mockBridgeRelayer(\n bytes32 transactionId,\n address relayer,\n address to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n )\n external\n {\n emit BridgeRelayed(\n transactionId, relayer, to, originChainId, originToken, destToken, originAmount, destAmount, chainGasAmount\n );\n }\n\n function bridge(BridgeParams memory params) external payable {\n revert(\"not implemented\");\n }\n\n function relay(bytes memory request) external payable {\n revert(\"not implemented\");\n }\n\n function prove(bytes memory request, bytes32 destTxHash) external {\n revert(\"not implemented\");\n }\n\n function canClaim(bytes32 transactionid, address relayer) external view returns (bool) {\n revert(\"not implemented\");\n }\n\n function claim(bytes memory request, address to) external {\n revert(\"not implemented\");\n }\n\n function dispute(bytes32 transactionId) external {\n revert(\"not implemented\");\n }\n\n function refund(bytes memory request) external {\n revert(\"not implemented\");\n }\n}\n","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","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 ERC-20 standard as defined in the ERC.","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.20+commit.a1b79de6\"},\"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 ERC-20 standard as defined in the ERC.\",\"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/FastBridgeMock.sol\":\"IERC20\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeMock.sol\":{\"keccak256\":\"0x4fff59c4cd271340f4a824126cbe4ebe7c8dc20639e268edf42ff873af31f862\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://4d33ef4f98d2abd98b4bbcb403b27495c37843b37000bea9f48e533078144d84\",\"dweb:/ipfs/QmTMkQhtNJPVgpxiLnEG45Ww7xfXHMEoVQ5JdbEbaFXwwS\"]}},\"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/FastBridgeMock.sol:IERC20Permit":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.20 ^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 pure 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/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// lib/openzeppelin-contracts/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 ERC-165 detection.\n */\ninterface IAccessControl {\n /**\n * @dev The `account` is missing a role.\n */\n error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);\n\n /**\n * @dev The caller of a function is not the expected one.\n *\n * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.\n */\n error AccessControlBadConfirmation();\n\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted 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// lib/openzeppelin-contracts/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 ERC-20 standard as defined in the ERC.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the value of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the value of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 value) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n * caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 value) external returns (bool);\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\n * allowance mechanism. `value` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n\n// lib/openzeppelin-contracts/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 ERC-20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[ERC-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC-20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n *\n * ==== Security Considerations\n *\n * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\n * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\n * considered as an intention to spend the allowance in any specific way. The second is that because permits have\n * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\n * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\n * generally recommended is:\n *\n * ```solidity\n * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\n * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\n * doThing(..., value);\n * }\n *\n * function doThing(..., uint256 value) public {\n * token.safeTransferFrom(msg.sender, address(this), value);\n * ...\n * }\n * ```\n *\n * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\n * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\n * {SafeERC20-safeTransferFrom}).\n *\n * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\n * contracts should have entry points that don't rely on permit.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also 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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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 ERC-165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[ERC].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n\n// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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 ERC-165 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// lib/openzeppelin-contracts/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 ERC-165 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// lib/openzeppelin-contracts/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 ERC-20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n /**\n * @dev An operation with an ERC-20 token failed.\n */\n error SafeERC20FailedOperation(address token);\n\n /**\n * @dev Indicates a failed `decreaseAllowance` request.\n */\n error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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/FastBridge.sol\n\ncontract FastBridge is IFastBridge, Admin {\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 enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeStatus) public bridgeStatuses;\n /// @notice Proof of relayed bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeProof) public bridgeProofs;\n /// @notice Whether bridge has been relayed on destination chain\n mapping(bytes32 =\u003e bool) public bridgeRelays;\n\n /// @dev to prevent replays\n uint256 public nonce;\n // @dev 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 /// @notice Pulls a requested token from the user to the requested recipient.\n /// @dev Be careful of re-entrancy issues when msg.value \u003e 0 and recipient != address(this)\n function _pullToken(address recipient, address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token != UniversalTokenLib.ETH_ADDRESS) {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(recipient);\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, recipient, amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(recipient) - amountPulled;\n } else {\n // Otherwise, we need to check that ETH amount matches msg.value\n if (amount != msg.value) revert MsgValueIncorrect();\n // Transfer value to recipient if not this address\n if (recipient != address(this)) token.universalTransfer(recipient, amount);\n // We will forward msg.value in the external call later, if recipient is not this contract\n amountPulled = msg.value;\n }\n }\n\n /// @inheritdoc IFastBridge\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n // check bridge params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\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\n // transfer tokens to bridge contract\n // @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(address(this), 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 BridgeTransaction({\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 sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n\n // check haven't exceeded deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n\n // mark bridge transaction as relayed\n if (bridgeRelays[transactionId]) revert TransactionRelayed();\n bridgeRelays[transactionId] = true;\n\n // transfer tokens to recipient on destination chain and gas rebate if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n uint256 rebate = chainGasAmount;\n if (!transaction.sendChainGas) {\n // forward erc20\n rebate = 0;\n _pullToken(to, token, amount);\n } else if (token == UniversalTokenLib.ETH_ADDRESS) {\n // lump in gas rebate into amount in native gas token\n _pullToken(to, token, amount + rebate);\n } else {\n // forward erc20 then forward gas rebate in native gas token\n _pullToken(to, token, amount);\n _pullToken(to, UniversalTokenLib.ETH_ADDRESS, rebate);\n }\n\n emit BridgeRelayed(\n transactionId,\n msg.sender,\n to,\n transaction.originChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n rebate\n );\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n // update bridge tx status given proof provided\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = BridgeStatus.RELAYER_PROVED;\n bridgeProofs[transactionId] = BridgeProof({timestamp: uint96(block.timestamp), relayer: msg.sender}); // overflow ok\n\n emit BridgeProofProvided(transactionId, msg.sender, destTxHash);\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint96(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint96).max but\n /// proof.timestamp \u003c type(uint96).max via unchecked statement\n /// @param proof The bridge proof\n /// @return delta Time delta since proof submitted\n function _timeSince(BridgeProof memory proof) internal view returns (uint256 delta) {\n unchecked {\n delta = uint96(block.timestamp) - proof.timestamp;\n }\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != relayer) revert SenderIncorrect();\n return _timeSince(proof) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != msg.sender) revert SenderIncorrect();\n if (_timeSince(proof) \u003c= DISPUTE_PERIOD) revert DisputePeriodNotPassed();\n\n bridgeStatuses[transactionId] = 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, msg.sender, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeProofs[transactionId]) \u003e DISPUTE_PERIOD) revert DisputePeriodPassed();\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n delete bridgeProofs[transactionId];\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 BridgeTransaction memory transaction = getBridgeTransaction(request);\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 // set status to refunded if still in requested state\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = 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\n// test/FastBridgeMock.sol\n\ncontract FastBridgeMock is IFastBridge, Admin {\n // @dev 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 /// @dev to prevent replays\n uint256 public nonce;\n\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n // used for testing in go.\n // see: https://ethereum.stackexchange.com/questions/21155/how-to-expose-enum-in-solidity-contract\n // make sure to update fastbridge/status.go if this changes\n // or underliyng enum changes.\n //\n // TODO: a foundry test should be added to ensure this is always in sync.\n function getEnumKeyByValue(FastBridge.BridgeStatus keyValue) public pure returns (string memory) {\n if (FastBridge.BridgeStatus.NULL == keyValue) return \"NULL\";\n if (FastBridge.BridgeStatus.REQUESTED == keyValue) return \"REQUESTED\";\n if (FastBridge.BridgeStatus.RELAYER_PROVED == keyValue) return \"RELAYER_PROVED\";\n if (FastBridge.BridgeStatus.RELAYER_CLAIMED == keyValue) return \"RELAYER_CLAIMED\";\n if (FastBridge.BridgeStatus.REFUNDED == keyValue) return \"REFUNDED\";\n return \"\";\n }\n\n function mockBridgeRequest(bytes32 transactionId, address sender, BridgeParams memory params) external {\n uint256 originFeeAmount = (params.originAmount * protocolFeeRate) / FEE_BPS;\n params.originAmount -= originFeeAmount;\n\n bytes memory request = abi.encode(\n BridgeTransaction({\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: params.originAmount, // includes relayer fee\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n params.originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n function mockBridgeRequestRaw(bytes32 transactionId, address sender, bytes memory request) external {\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n emit BridgeRequested(\n transactionId,\n transaction.originSender,\n request,\n transaction.destChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n transaction.sendChainGas\n );\n }\n\n function mockBridgeRelayer(\n bytes32 transactionId,\n address relayer,\n address to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n )\n external\n {\n emit BridgeRelayed(\n transactionId, relayer, to, originChainId, originToken, destToken, originAmount, destAmount, chainGasAmount\n );\n }\n\n function bridge(BridgeParams memory params) external payable {\n revert(\"not implemented\");\n }\n\n function relay(bytes memory request) external payable {\n revert(\"not implemented\");\n }\n\n function prove(bytes memory request, bytes32 destTxHash) external {\n revert(\"not implemented\");\n }\n\n function canClaim(bytes32 transactionid, address relayer) external view returns (bool) {\n revert(\"not implemented\");\n }\n\n function claim(bytes memory request, address to) external {\n revert(\"not implemented\");\n }\n\n function dispute(bytes32 transactionId) external {\n revert(\"not implemented\");\n }\n\n function refund(bytes memory request) external {\n revert(\"not implemented\");\n }\n}\n","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","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 ERC-20 Permit extension allowing approvals to be made via signatures, as defined in https://eips.ethereum.org/EIPS/eip-2612[ERC-2612]. Adds the {permit} method, which can be used to change an account's ERC-20 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.20+commit.a1b79de6\"},\"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 ERC-20 Permit extension allowing approvals to be made via signatures, as defined in https://eips.ethereum.org/EIPS/eip-2612[ERC-2612]. Adds the {permit} method, which can be used to change an account's ERC-20 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/FastBridgeMock.sol\":\"IERC20Permit\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeMock.sol\":{\"keccak256\":\"0x4fff59c4cd271340f4a824126cbe4ebe7c8dc20639e268edf42ff873af31f862\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://4d33ef4f98d2abd98b4bbcb403b27495c37843b37000bea9f48e533078144d84\",\"dweb:/ipfs/QmTMkQhtNJPVgpxiLnEG45Ww7xfXHMEoVQ5JdbEbaFXwwS\"]}},\"version\":1}"},"hashes":{"DOMAIN_SEPARATOR()":"3644e515","nonces(address)":"7ecebe00","permit(address,address,uint256,uint256,uint8,bytes32,bytes32)":"d505accf"}},"solidity/FastBridgeMock.sol:IFastBridge":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.20 ^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 pure 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/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// lib/openzeppelin-contracts/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 ERC-165 detection.\n */\ninterface IAccessControl {\n /**\n * @dev The `account` is missing a role.\n */\n error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);\n\n /**\n * @dev The caller of a function is not the expected one.\n *\n * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.\n */\n error AccessControlBadConfirmation();\n\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted 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// lib/openzeppelin-contracts/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 ERC-20 standard as defined in the ERC.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the value of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the value of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 value) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n * caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 value) external returns (bool);\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\n * allowance mechanism. `value` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n\n// lib/openzeppelin-contracts/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 ERC-20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[ERC-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC-20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n *\n * ==== Security Considerations\n *\n * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\n * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\n * considered as an intention to spend the allowance in any specific way. The second is that because permits have\n * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\n * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\n * generally recommended is:\n *\n * ```solidity\n * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\n * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\n * doThing(..., value);\n * }\n *\n * function doThing(..., uint256 value) public {\n * token.safeTransferFrom(msg.sender, address(this), value);\n * ...\n * }\n * ```\n *\n * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\n * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\n * {SafeERC20-safeTransferFrom}).\n *\n * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\n * contracts should have entry points that don't rely on permit.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also 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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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 ERC-165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[ERC].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n\n// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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 ERC-165 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// lib/openzeppelin-contracts/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 ERC-165 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// lib/openzeppelin-contracts/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 ERC-20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n /**\n * @dev An operation with an ERC-20 token failed.\n */\n error SafeERC20FailedOperation(address token);\n\n /**\n * @dev Indicates a failed `decreaseAllowance` request.\n */\n error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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/FastBridge.sol\n\ncontract FastBridge is IFastBridge, Admin {\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 enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeStatus) public bridgeStatuses;\n /// @notice Proof of relayed bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeProof) public bridgeProofs;\n /// @notice Whether bridge has been relayed on destination chain\n mapping(bytes32 =\u003e bool) public bridgeRelays;\n\n /// @dev to prevent replays\n uint256 public nonce;\n // @dev 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 /// @notice Pulls a requested token from the user to the requested recipient.\n /// @dev Be careful of re-entrancy issues when msg.value \u003e 0 and recipient != address(this)\n function _pullToken(address recipient, address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token != UniversalTokenLib.ETH_ADDRESS) {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(recipient);\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, recipient, amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(recipient) - amountPulled;\n } else {\n // Otherwise, we need to check that ETH amount matches msg.value\n if (amount != msg.value) revert MsgValueIncorrect();\n // Transfer value to recipient if not this address\n if (recipient != address(this)) token.universalTransfer(recipient, amount);\n // We will forward msg.value in the external call later, if recipient is not this contract\n amountPulled = msg.value;\n }\n }\n\n /// @inheritdoc IFastBridge\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n // check bridge params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\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\n // transfer tokens to bridge contract\n // @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(address(this), 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 BridgeTransaction({\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 sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n\n // check haven't exceeded deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n\n // mark bridge transaction as relayed\n if (bridgeRelays[transactionId]) revert TransactionRelayed();\n bridgeRelays[transactionId] = true;\n\n // transfer tokens to recipient on destination chain and gas rebate if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n uint256 rebate = chainGasAmount;\n if (!transaction.sendChainGas) {\n // forward erc20\n rebate = 0;\n _pullToken(to, token, amount);\n } else if (token == UniversalTokenLib.ETH_ADDRESS) {\n // lump in gas rebate into amount in native gas token\n _pullToken(to, token, amount + rebate);\n } else {\n // forward erc20 then forward gas rebate in native gas token\n _pullToken(to, token, amount);\n _pullToken(to, UniversalTokenLib.ETH_ADDRESS, rebate);\n }\n\n emit BridgeRelayed(\n transactionId,\n msg.sender,\n to,\n transaction.originChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n rebate\n );\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n // update bridge tx status given proof provided\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = BridgeStatus.RELAYER_PROVED;\n bridgeProofs[transactionId] = BridgeProof({timestamp: uint96(block.timestamp), relayer: msg.sender}); // overflow ok\n\n emit BridgeProofProvided(transactionId, msg.sender, destTxHash);\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint96(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint96).max but\n /// proof.timestamp \u003c type(uint96).max via unchecked statement\n /// @param proof The bridge proof\n /// @return delta Time delta since proof submitted\n function _timeSince(BridgeProof memory proof) internal view returns (uint256 delta) {\n unchecked {\n delta = uint96(block.timestamp) - proof.timestamp;\n }\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != relayer) revert SenderIncorrect();\n return _timeSince(proof) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != msg.sender) revert SenderIncorrect();\n if (_timeSince(proof) \u003c= DISPUTE_PERIOD) revert DisputePeriodNotPassed();\n\n bridgeStatuses[transactionId] = 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, msg.sender, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeProofs[transactionId]) \u003e DISPUTE_PERIOD) revert DisputePeriodPassed();\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n delete bridgeProofs[transactionId];\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 BridgeTransaction memory transaction = getBridgeTransaction(request);\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 // set status to refunded if still in requested state\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = 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\n// test/FastBridgeMock.sol\n\ncontract FastBridgeMock is IFastBridge, Admin {\n // @dev 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 /// @dev to prevent replays\n uint256 public nonce;\n\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n // used for testing in go.\n // see: https://ethereum.stackexchange.com/questions/21155/how-to-expose-enum-in-solidity-contract\n // make sure to update fastbridge/status.go if this changes\n // or underliyng enum changes.\n //\n // TODO: a foundry test should be added to ensure this is always in sync.\n function getEnumKeyByValue(FastBridge.BridgeStatus keyValue) public pure returns (string memory) {\n if (FastBridge.BridgeStatus.NULL == keyValue) return \"NULL\";\n if (FastBridge.BridgeStatus.REQUESTED == keyValue) return \"REQUESTED\";\n if (FastBridge.BridgeStatus.RELAYER_PROVED == keyValue) return \"RELAYER_PROVED\";\n if (FastBridge.BridgeStatus.RELAYER_CLAIMED == keyValue) return \"RELAYER_CLAIMED\";\n if (FastBridge.BridgeStatus.REFUNDED == keyValue) return \"REFUNDED\";\n return \"\";\n }\n\n function mockBridgeRequest(bytes32 transactionId, address sender, BridgeParams memory params) external {\n uint256 originFeeAmount = (params.originAmount * protocolFeeRate) / FEE_BPS;\n params.originAmount -= originFeeAmount;\n\n bytes memory request = abi.encode(\n BridgeTransaction({\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: params.originAmount, // includes relayer fee\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n params.originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n function mockBridgeRequestRaw(bytes32 transactionId, address sender, bytes memory request) external {\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n emit BridgeRequested(\n transactionId,\n transaction.originSender,\n request,\n transaction.destChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n transaction.sendChainGas\n );\n }\n\n function mockBridgeRelayer(\n bytes32 transactionId,\n address relayer,\n address to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n )\n external\n {\n emit BridgeRelayed(\n transactionId, relayer, to, originChainId, originToken, destToken, originAmount, destAmount, chainGasAmount\n );\n }\n\n function bridge(BridgeParams memory params) external payable {\n revert(\"not implemented\");\n }\n\n function relay(bytes memory request) external payable {\n revert(\"not implemented\");\n }\n\n function prove(bytes memory request, bytes32 destTxHash) external {\n revert(\"not implemented\");\n }\n\n function canClaim(bytes32 transactionid, address relayer) external view returns (bool) {\n revert(\"not implemented\");\n }\n\n function claim(bytes memory request, address to) external {\n revert(\"not implemented\");\n }\n\n function dispute(bytes32 transactionId) external {\n revert(\"not implemented\");\n }\n\n function refund(bytes memory request) external {\n revert(\"not implemented\");\n }\n}\n","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","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":"pure","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.20+commit.a1b79de6\"},\"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\":\"pure\",\"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/FastBridgeMock.sol\":\"IFastBridge\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeMock.sol\":{\"keccak256\":\"0x4fff59c4cd271340f4a824126cbe4ebe7c8dc20639e268edf42ff873af31f862\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://4d33ef4f98d2abd98b4bbcb403b27495c37843b37000bea9f48e533078144d84\",\"dweb:/ipfs/QmTMkQhtNJPVgpxiLnEG45Ww7xfXHMEoVQ5JdbEbaFXwwS\"]}},\"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/FastBridgeMock.sol:SafeERC20":{"code":"0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220c51b222f1984df769e9e9836d8b17da22ec98bfb801c9728e848da279f2ef33e64736f6c63430008140033","runtime-code":"0x73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220c51b222f1984df769e9e9836d8b17da22ec98bfb801c9728e848da279f2ef33e64736f6c63430008140033","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.20 ^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 pure 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/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// lib/openzeppelin-contracts/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 ERC-165 detection.\n */\ninterface IAccessControl {\n /**\n * @dev The `account` is missing a role.\n */\n error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);\n\n /**\n * @dev The caller of a function is not the expected one.\n *\n * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.\n */\n error AccessControlBadConfirmation();\n\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted 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// lib/openzeppelin-contracts/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 ERC-20 standard as defined in the ERC.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the value of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the value of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 value) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n * caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 value) external returns (bool);\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\n * allowance mechanism. `value` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n\n// lib/openzeppelin-contracts/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 ERC-20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[ERC-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC-20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n *\n * ==== Security Considerations\n *\n * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\n * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\n * considered as an intention to spend the allowance in any specific way. The second is that because permits have\n * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\n * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\n * generally recommended is:\n *\n * ```solidity\n * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\n * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\n * doThing(..., value);\n * }\n *\n * function doThing(..., uint256 value) public {\n * token.safeTransferFrom(msg.sender, address(this), value);\n * ...\n * }\n * ```\n *\n * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\n * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\n * {SafeERC20-safeTransferFrom}).\n *\n * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\n * contracts should have entry points that don't rely on permit.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also 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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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 ERC-165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[ERC].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n\n// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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 ERC-165 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// lib/openzeppelin-contracts/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 ERC-165 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// lib/openzeppelin-contracts/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 ERC-20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n /**\n * @dev An operation with an ERC-20 token failed.\n */\n error SafeERC20FailedOperation(address token);\n\n /**\n * @dev Indicates a failed `decreaseAllowance` request.\n */\n error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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/FastBridge.sol\n\ncontract FastBridge is IFastBridge, Admin {\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 enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeStatus) public bridgeStatuses;\n /// @notice Proof of relayed bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeProof) public bridgeProofs;\n /// @notice Whether bridge has been relayed on destination chain\n mapping(bytes32 =\u003e bool) public bridgeRelays;\n\n /// @dev to prevent replays\n uint256 public nonce;\n // @dev 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 /// @notice Pulls a requested token from the user to the requested recipient.\n /// @dev Be careful of re-entrancy issues when msg.value \u003e 0 and recipient != address(this)\n function _pullToken(address recipient, address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token != UniversalTokenLib.ETH_ADDRESS) {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(recipient);\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, recipient, amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(recipient) - amountPulled;\n } else {\n // Otherwise, we need to check that ETH amount matches msg.value\n if (amount != msg.value) revert MsgValueIncorrect();\n // Transfer value to recipient if not this address\n if (recipient != address(this)) token.universalTransfer(recipient, amount);\n // We will forward msg.value in the external call later, if recipient is not this contract\n amountPulled = msg.value;\n }\n }\n\n /// @inheritdoc IFastBridge\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n // check bridge params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\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\n // transfer tokens to bridge contract\n // @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(address(this), 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 BridgeTransaction({\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 sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n\n // check haven't exceeded deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n\n // mark bridge transaction as relayed\n if (bridgeRelays[transactionId]) revert TransactionRelayed();\n bridgeRelays[transactionId] = true;\n\n // transfer tokens to recipient on destination chain and gas rebate if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n uint256 rebate = chainGasAmount;\n if (!transaction.sendChainGas) {\n // forward erc20\n rebate = 0;\n _pullToken(to, token, amount);\n } else if (token == UniversalTokenLib.ETH_ADDRESS) {\n // lump in gas rebate into amount in native gas token\n _pullToken(to, token, amount + rebate);\n } else {\n // forward erc20 then forward gas rebate in native gas token\n _pullToken(to, token, amount);\n _pullToken(to, UniversalTokenLib.ETH_ADDRESS, rebate);\n }\n\n emit BridgeRelayed(\n transactionId,\n msg.sender,\n to,\n transaction.originChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n rebate\n );\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n // update bridge tx status given proof provided\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = BridgeStatus.RELAYER_PROVED;\n bridgeProofs[transactionId] = BridgeProof({timestamp: uint96(block.timestamp), relayer: msg.sender}); // overflow ok\n\n emit BridgeProofProvided(transactionId, msg.sender, destTxHash);\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint96(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint96).max but\n /// proof.timestamp \u003c type(uint96).max via unchecked statement\n /// @param proof The bridge proof\n /// @return delta Time delta since proof submitted\n function _timeSince(BridgeProof memory proof) internal view returns (uint256 delta) {\n unchecked {\n delta = uint96(block.timestamp) - proof.timestamp;\n }\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != relayer) revert SenderIncorrect();\n return _timeSince(proof) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != msg.sender) revert SenderIncorrect();\n if (_timeSince(proof) \u003c= DISPUTE_PERIOD) revert DisputePeriodNotPassed();\n\n bridgeStatuses[transactionId] = 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, msg.sender, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeProofs[transactionId]) \u003e DISPUTE_PERIOD) revert DisputePeriodPassed();\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n delete bridgeProofs[transactionId];\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 BridgeTransaction memory transaction = getBridgeTransaction(request);\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 // set status to refunded if still in requested state\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = 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\n// test/FastBridgeMock.sol\n\ncontract FastBridgeMock is IFastBridge, Admin {\n // @dev 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 /// @dev to prevent replays\n uint256 public nonce;\n\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n // used for testing in go.\n // see: https://ethereum.stackexchange.com/questions/21155/how-to-expose-enum-in-solidity-contract\n // make sure to update fastbridge/status.go if this changes\n // or underliyng enum changes.\n //\n // TODO: a foundry test should be added to ensure this is always in sync.\n function getEnumKeyByValue(FastBridge.BridgeStatus keyValue) public pure returns (string memory) {\n if (FastBridge.BridgeStatus.NULL == keyValue) return \"NULL\";\n if (FastBridge.BridgeStatus.REQUESTED == keyValue) return \"REQUESTED\";\n if (FastBridge.BridgeStatus.RELAYER_PROVED == keyValue) return \"RELAYER_PROVED\";\n if (FastBridge.BridgeStatus.RELAYER_CLAIMED == keyValue) return \"RELAYER_CLAIMED\";\n if (FastBridge.BridgeStatus.REFUNDED == keyValue) return \"REFUNDED\";\n return \"\";\n }\n\n function mockBridgeRequest(bytes32 transactionId, address sender, BridgeParams memory params) external {\n uint256 originFeeAmount = (params.originAmount * protocolFeeRate) / FEE_BPS;\n params.originAmount -= originFeeAmount;\n\n bytes memory request = abi.encode(\n BridgeTransaction({\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: params.originAmount, // includes relayer fee\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n params.originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n function mockBridgeRequestRaw(bytes32 transactionId, address sender, bytes memory request) external {\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n emit BridgeRequested(\n transactionId,\n transaction.originSender,\n request,\n transaction.destChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n transaction.sendChainGas\n );\n }\n\n function mockBridgeRelayer(\n bytes32 transactionId,\n address relayer,\n address to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n )\n external\n {\n emit BridgeRelayed(\n transactionId, relayer, to, originChainId, originToken, destToken, originAmount, destAmount, chainGasAmount\n );\n }\n\n function bridge(BridgeParams memory params) external payable {\n revert(\"not implemented\");\n }\n\n function relay(bytes memory request) external payable {\n revert(\"not implemented\");\n }\n\n function prove(bytes memory request, bytes32 destTxHash) external {\n revert(\"not implemented\");\n }\n\n function canClaim(bytes32 transactionid, address relayer) external view returns (bool) {\n revert(\"not implemented\");\n }\n\n function claim(bytes memory request, address to) external {\n revert(\"not implemented\");\n }\n\n function dispute(bytes32 transactionId) external {\n revert(\"not implemented\");\n }\n\n function refund(bytes memory request) external {\n revert(\"not implemented\");\n }\n}\n","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","compilerOptions":"--combined-json bin,bin-runtime,srcmap,srcmap-runtime,abi,userdoc,devdoc,metadata,hashes --optimize --optimize-runs 10000 --allow-paths ., ./, ../ --evm-version=istanbul","srcMap":"39265:5019:0:-:0;;;;;;;;;;;;;;;-1:-1:-1;;;39265:5019:0;;;;;;;;;;;;;;;;;","srcMapRuntime":"39265:5019: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 ERC-20 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 ERC-20 token failed."}]},"kind":"dev","methods":{},"title":"SafeERC20","version":1},"metadata":"{\"compiler\":{\"version\":\"0.8.20+commit.a1b79de6\"},\"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 ERC-20 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 ERC-20 token failed.\"}]},\"kind\":\"dev\",\"methods\":{},\"title\":\"SafeERC20\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/FastBridgeMock.sol\":\"SafeERC20\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeMock.sol\":{\"keccak256\":\"0x4fff59c4cd271340f4a824126cbe4ebe7c8dc20639e268edf42ff873af31f862\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://4d33ef4f98d2abd98b4bbcb403b27495c37843b37000bea9f48e533078144d84\",\"dweb:/ipfs/QmTMkQhtNJPVgpxiLnEG45Ww7xfXHMEoVQ5JdbEbaFXwwS\"]}},\"version\":1}"},"hashes":{}},"solidity/FastBridgeMock.sol:UniversalTokenLib":{"code":"0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220091110fff57e33a0f49e1afe323fd28b79984a963c9cb8afaca914399291e9a964736f6c63430008140033","runtime-code":"0x73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220091110fff57e33a0f49e1afe323fd28b79984a963c9cb8afaca914399291e9a964736f6c63430008140033","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.20 ^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 pure 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/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// lib/openzeppelin-contracts/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 ERC-165 detection.\n */\ninterface IAccessControl {\n /**\n * @dev The `account` is missing a role.\n */\n error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);\n\n /**\n * @dev The caller of a function is not the expected one.\n *\n * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.\n */\n error AccessControlBadConfirmation();\n\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted 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// lib/openzeppelin-contracts/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 ERC-20 standard as defined in the ERC.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the value of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the value of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 value) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n * caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 value) external returns (bool);\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\n * allowance mechanism. `value` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n\n// lib/openzeppelin-contracts/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 ERC-20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[ERC-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC-20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n *\n * ==== Security Considerations\n *\n * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\n * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\n * considered as an intention to spend the allowance in any specific way. The second is that because permits have\n * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\n * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\n * generally recommended is:\n *\n * ```solidity\n * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\n * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\n * doThing(..., value);\n * }\n *\n * function doThing(..., uint256 value) public {\n * token.safeTransferFrom(msg.sender, address(this), value);\n * ...\n * }\n * ```\n *\n * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\n * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\n * {SafeERC20-safeTransferFrom}).\n *\n * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\n * contracts should have entry points that don't rely on permit.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also 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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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 ERC-165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[ERC].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n\n// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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 ERC-165 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// lib/openzeppelin-contracts/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 ERC-165 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// lib/openzeppelin-contracts/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 ERC-20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n /**\n * @dev An operation with an ERC-20 token failed.\n */\n error SafeERC20FailedOperation(address token);\n\n /**\n * @dev Indicates a failed `decreaseAllowance` request.\n */\n error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _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// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/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/FastBridge.sol\n\ncontract FastBridge is IFastBridge, Admin {\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 enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeStatus) public bridgeStatuses;\n /// @notice Proof of relayed bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeProof) public bridgeProofs;\n /// @notice Whether bridge has been relayed on destination chain\n mapping(bytes32 =\u003e bool) public bridgeRelays;\n\n /// @dev to prevent replays\n uint256 public nonce;\n // @dev 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 /// @notice Pulls a requested token from the user to the requested recipient.\n /// @dev Be careful of re-entrancy issues when msg.value \u003e 0 and recipient != address(this)\n function _pullToken(address recipient, address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token != UniversalTokenLib.ETH_ADDRESS) {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(recipient);\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, recipient, amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(recipient) - amountPulled;\n } else {\n // Otherwise, we need to check that ETH amount matches msg.value\n if (amount != msg.value) revert MsgValueIncorrect();\n // Transfer value to recipient if not this address\n if (recipient != address(this)) token.universalTransfer(recipient, amount);\n // We will forward msg.value in the external call later, if recipient is not this contract\n amountPulled = msg.value;\n }\n }\n\n /// @inheritdoc IFastBridge\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n // check bridge params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\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\n // transfer tokens to bridge contract\n // @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(address(this), 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 BridgeTransaction({\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 sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n\n // check haven't exceeded deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n\n // mark bridge transaction as relayed\n if (bridgeRelays[transactionId]) revert TransactionRelayed();\n bridgeRelays[transactionId] = true;\n\n // transfer tokens to recipient on destination chain and gas rebate if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n uint256 rebate = chainGasAmount;\n if (!transaction.sendChainGas) {\n // forward erc20\n rebate = 0;\n _pullToken(to, token, amount);\n } else if (token == UniversalTokenLib.ETH_ADDRESS) {\n // lump in gas rebate into amount in native gas token\n _pullToken(to, token, amount + rebate);\n } else {\n // forward erc20 then forward gas rebate in native gas token\n _pullToken(to, token, amount);\n _pullToken(to, UniversalTokenLib.ETH_ADDRESS, rebate);\n }\n\n emit BridgeRelayed(\n transactionId,\n msg.sender,\n to,\n transaction.originChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n rebate\n );\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n // update bridge tx status given proof provided\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = BridgeStatus.RELAYER_PROVED;\n bridgeProofs[transactionId] = BridgeProof({timestamp: uint96(block.timestamp), relayer: msg.sender}); // overflow ok\n\n emit BridgeProofProvided(transactionId, msg.sender, destTxHash);\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint96(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint96).max but\n /// proof.timestamp \u003c type(uint96).max via unchecked statement\n /// @param proof The bridge proof\n /// @return delta Time delta since proof submitted\n function _timeSince(BridgeProof memory proof) internal view returns (uint256 delta) {\n unchecked {\n delta = uint96(block.timestamp) - proof.timestamp;\n }\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != relayer) revert SenderIncorrect();\n return _timeSince(proof) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != msg.sender) revert SenderIncorrect();\n if (_timeSince(proof) \u003c= DISPUTE_PERIOD) revert DisputePeriodNotPassed();\n\n bridgeStatuses[transactionId] = 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, msg.sender, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeProofs[transactionId]) \u003e DISPUTE_PERIOD) revert DisputePeriodPassed();\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n delete bridgeProofs[transactionId];\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 BridgeTransaction memory transaction = getBridgeTransaction(request);\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 // set status to refunded if still in requested state\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = 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\n// test/FastBridgeMock.sol\n\ncontract FastBridgeMock is IFastBridge, Admin {\n // @dev 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 /// @dev to prevent replays\n uint256 public nonce;\n\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n // used for testing in go.\n // see: https://ethereum.stackexchange.com/questions/21155/how-to-expose-enum-in-solidity-contract\n // make sure to update fastbridge/status.go if this changes\n // or underliyng enum changes.\n //\n // TODO: a foundry test should be added to ensure this is always in sync.\n function getEnumKeyByValue(FastBridge.BridgeStatus keyValue) public pure returns (string memory) {\n if (FastBridge.BridgeStatus.NULL == keyValue) return \"NULL\";\n if (FastBridge.BridgeStatus.REQUESTED == keyValue) return \"REQUESTED\";\n if (FastBridge.BridgeStatus.RELAYER_PROVED == keyValue) return \"RELAYER_PROVED\";\n if (FastBridge.BridgeStatus.RELAYER_CLAIMED == keyValue) return \"RELAYER_CLAIMED\";\n if (FastBridge.BridgeStatus.REFUNDED == keyValue) return \"REFUNDED\";\n return \"\";\n }\n\n function mockBridgeRequest(bytes32 transactionId, address sender, BridgeParams memory params) external {\n uint256 originFeeAmount = (params.originAmount * protocolFeeRate) / FEE_BPS;\n params.originAmount -= originFeeAmount;\n\n bytes memory request = abi.encode(\n BridgeTransaction({\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: params.originAmount, // includes relayer fee\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n params.originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n function mockBridgeRequestRaw(bytes32 transactionId, address sender, bytes memory request) external {\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n emit BridgeRequested(\n transactionId,\n transaction.originSender,\n request,\n transaction.destChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n transaction.sendChainGas\n );\n }\n\n function mockBridgeRelayer(\n bytes32 transactionId,\n address relayer,\n address to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n )\n external\n {\n emit BridgeRelayed(\n transactionId, relayer, to, originChainId, originToken, destToken, originAmount, destAmount, chainGasAmount\n );\n }\n\n function bridge(BridgeParams memory params) external payable {\n revert(\"not implemented\");\n }\n\n function relay(bytes memory request) external payable {\n revert(\"not implemented\");\n }\n\n function prove(bytes memory request, bytes32 destTxHash) external {\n revert(\"not implemented\");\n }\n\n function canClaim(bytes32 transactionid, address relayer) external view returns (bool) {\n revert(\"not implemented\");\n }\n\n function claim(bytes memory request, address to) external {\n revert(\"not implemented\");\n }\n\n function dispute(bytes32 transactionId) external {\n revert(\"not implemented\");\n }\n\n function refund(bytes memory request) external {\n revert(\"not implemented\");\n }\n}\n","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","compilerOptions":"--combined-json bin,bin-runtime,srcmap,srcmap-runtime,abi,userdoc,devdoc,metadata,hashes --optimize --optimize-runs 10000 --allow-paths ., ./, ../ --evm-version=istanbul","srcMap":"51225:2551:0:-:0;;;;;;;;;;;;;;;-1:-1:-1;;;51225:2551:0;;;;;;;;;;;;;;;;;","srcMapRuntime":"51225:2551:0:-:0;;;;;;;;","abiDefinition":[],"userDoc":{"kind":"user","methods":{},"version":1},"developerDoc":{"kind":"dev","methods":{},"version":1},"metadata":"{\"compiler\":{\"version\":\"0.8.20+commit.a1b79de6\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/FastBridgeMock.sol\":\"UniversalTokenLib\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeMock.sol\":{\"keccak256\":\"0x4fff59c4cd271340f4a824126cbe4ebe7c8dc20639e268edf42ff873af31f862\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://4d33ef4f98d2abd98b4bbcb403b27495c37843b37000bea9f48e533078144d84\",\"dweb:/ipfs/QmTMkQhtNJPVgpxiLnEG45Ww7xfXHMEoVQ5JdbEbaFXwwS\"]}},\"version\":1}"},"hashes":{}}} \ No newline at end of file +{"solidity/FastBridgeMock.sol:AccessControl":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.20 ^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 pure 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/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// 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/FastBridge.sol\n\ncontract FastBridge is IFastBridge, Admin {\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 enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeStatus) public bridgeStatuses;\n /// @notice Proof of relayed bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeProof) public bridgeProofs;\n /// @notice Whether bridge has been relayed on destination chain\n mapping(bytes32 =\u003e bool) public bridgeRelays;\n\n /// @dev to prevent replays\n uint256 public nonce;\n // @dev 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 /// @notice Pulls a requested token from the user to the requested recipient.\n /// @dev Be careful of re-entrancy issues when msg.value \u003e 0 and recipient != address(this)\n function _pullToken(address recipient, address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token != UniversalTokenLib.ETH_ADDRESS) {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(recipient);\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, recipient, amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(recipient) - amountPulled;\n } else {\n // Otherwise, we need to check that ETH amount matches msg.value\n if (amount != msg.value) revert MsgValueIncorrect();\n // Transfer value to recipient if not this address\n if (recipient != address(this)) token.universalTransfer(recipient, amount);\n // We will forward msg.value in the external call later, if recipient is not this contract\n amountPulled = msg.value;\n }\n }\n\n /// @inheritdoc IFastBridge\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n // check bridge params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\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\n // transfer tokens to bridge contract\n // @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(address(this), 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 BridgeTransaction({\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 sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n\n // check haven't exceeded deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n\n // mark bridge transaction as relayed\n if (bridgeRelays[transactionId]) revert TransactionRelayed();\n bridgeRelays[transactionId] = true;\n\n // transfer tokens to recipient on destination chain and gas rebate if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n uint256 rebate = chainGasAmount;\n if (!transaction.sendChainGas) {\n // forward erc20\n rebate = 0;\n _pullToken(to, token, amount);\n } else if (token == UniversalTokenLib.ETH_ADDRESS) {\n // lump in gas rebate into amount in native gas token\n _pullToken(to, token, amount + rebate);\n } else {\n // forward erc20 then forward gas rebate in native gas token\n _pullToken(to, token, amount);\n _pullToken(to, UniversalTokenLib.ETH_ADDRESS, rebate);\n }\n\n emit BridgeRelayed(\n transactionId,\n msg.sender,\n to,\n transaction.originChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n rebate\n );\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n // update bridge tx status given proof provided\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = BridgeStatus.RELAYER_PROVED;\n bridgeProofs[transactionId] = BridgeProof({timestamp: uint96(block.timestamp), relayer: msg.sender}); // overflow ok\n\n emit BridgeProofProvided(transactionId, msg.sender, destTxHash);\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint96(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint96).max but\n /// proof.timestamp \u003c type(uint96).max via unchecked statement\n /// @param proof The bridge proof\n /// @return delta Time delta since proof submitted\n function _timeSince(BridgeProof memory proof) internal view returns (uint256 delta) {\n unchecked {\n delta = uint96(block.timestamp) - proof.timestamp;\n }\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != relayer) revert SenderIncorrect();\n return _timeSince(proof) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != msg.sender) revert SenderIncorrect();\n if (_timeSince(proof) \u003c= DISPUTE_PERIOD) revert DisputePeriodNotPassed();\n\n bridgeStatuses[transactionId] = 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, msg.sender, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeProofs[transactionId]) \u003e DISPUTE_PERIOD) revert DisputePeriodPassed();\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n delete bridgeProofs[transactionId];\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 BridgeTransaction memory transaction = getBridgeTransaction(request);\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 // set status to refunded if still in requested state\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = 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\n// test/FastBridgeMock.sol\n\ncontract FastBridgeMock is IFastBridge, Admin {\n // @dev 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 /// @dev to prevent replays\n uint256 public nonce;\n\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n // used for testing in go.\n // see: https://ethereum.stackexchange.com/questions/21155/how-to-expose-enum-in-solidity-contract\n // make sure to update fastbridge/status.go if this changes\n // or underliyng enum changes.\n //\n // TODO: a foundry test should be added to ensure this is always in sync.\n function getEnumKeyByValue(FastBridge.BridgeStatus keyValue) public pure returns (string memory) {\n if (FastBridge.BridgeStatus.NULL == keyValue) return \"NULL\";\n if (FastBridge.BridgeStatus.REQUESTED == keyValue) return \"REQUESTED\";\n if (FastBridge.BridgeStatus.RELAYER_PROVED == keyValue) return \"RELAYER_PROVED\";\n if (FastBridge.BridgeStatus.RELAYER_CLAIMED == keyValue) return \"RELAYER_CLAIMED\";\n if (FastBridge.BridgeStatus.REFUNDED == keyValue) return \"REFUNDED\";\n return \"\";\n }\n\n function mockBridgeRequest(bytes32 transactionId, address sender, BridgeParams memory params) external {\n uint256 originFeeAmount = (params.originAmount * protocolFeeRate) / FEE_BPS;\n params.originAmount -= originFeeAmount;\n\n bytes memory request = abi.encode(\n BridgeTransaction({\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: params.originAmount, // includes relayer fee\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n params.originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n function mockBridgeRequestRaw(bytes32 transactionId, address sender, bytes memory request) external {\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n emit BridgeRequested(\n transactionId,\n transaction.originSender,\n request,\n transaction.destChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n transaction.sendChainGas\n );\n }\n\n function mockBridgeRelayer(\n bytes32 transactionId,\n address relayer,\n address to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n )\n external\n {\n emit BridgeRelayed(\n transactionId, relayer, to, originChainId, originToken, destToken, originAmount, destAmount, chainGasAmount\n );\n }\n\n function bridge(BridgeParams memory params) external payable {\n revert(\"not implemented\");\n }\n\n function relay(bytes memory request) external payable {\n revert(\"not implemented\");\n }\n\n function prove(bytes memory request, bytes32 destTxHash) external {\n revert(\"not implemented\");\n }\n\n function canClaim(bytes32 transactionid, address relayer) external view returns (bool) {\n revert(\"not implemented\");\n }\n\n function claim(bytes memory request, address to) external {\n revert(\"not implemented\");\n }\n\n function dispute(bytes32 transactionId) external {\n revert(\"not implemented\");\n }\n\n function refund(bytes memory request) external {\n revert(\"not implemented\");\n }\n}\n","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","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.20+commit.a1b79de6\"},\"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/FastBridgeMock.sol\":\"AccessControl\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeMock.sol\":{\"keccak256\":\"0xb58951ea9ccf93b597bddaa7b405278a10398c87bf748538ac7a67cd65184783\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://bb67eff4aa6731cbb158660257e9091bbc8135d228ceb240943772f9b5ada90e\",\"dweb:/ipfs/QmQbxcMCxtY5dWAJoPBpipMUjrN5zMvhQDCVkcMpRsn9LP\"]}},\"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/FastBridgeMock.sol:AccessControlEnumerable":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.20 ^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 pure 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/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// 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/FastBridge.sol\n\ncontract FastBridge is IFastBridge, Admin {\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 enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeStatus) public bridgeStatuses;\n /// @notice Proof of relayed bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeProof) public bridgeProofs;\n /// @notice Whether bridge has been relayed on destination chain\n mapping(bytes32 =\u003e bool) public bridgeRelays;\n\n /// @dev to prevent replays\n uint256 public nonce;\n // @dev 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 /// @notice Pulls a requested token from the user to the requested recipient.\n /// @dev Be careful of re-entrancy issues when msg.value \u003e 0 and recipient != address(this)\n function _pullToken(address recipient, address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token != UniversalTokenLib.ETH_ADDRESS) {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(recipient);\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, recipient, amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(recipient) - amountPulled;\n } else {\n // Otherwise, we need to check that ETH amount matches msg.value\n if (amount != msg.value) revert MsgValueIncorrect();\n // Transfer value to recipient if not this address\n if (recipient != address(this)) token.universalTransfer(recipient, amount);\n // We will forward msg.value in the external call later, if recipient is not this contract\n amountPulled = msg.value;\n }\n }\n\n /// @inheritdoc IFastBridge\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n // check bridge params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\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\n // transfer tokens to bridge contract\n // @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(address(this), 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 BridgeTransaction({\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 sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n\n // check haven't exceeded deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n\n // mark bridge transaction as relayed\n if (bridgeRelays[transactionId]) revert TransactionRelayed();\n bridgeRelays[transactionId] = true;\n\n // transfer tokens to recipient on destination chain and gas rebate if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n uint256 rebate = chainGasAmount;\n if (!transaction.sendChainGas) {\n // forward erc20\n rebate = 0;\n _pullToken(to, token, amount);\n } else if (token == UniversalTokenLib.ETH_ADDRESS) {\n // lump in gas rebate into amount in native gas token\n _pullToken(to, token, amount + rebate);\n } else {\n // forward erc20 then forward gas rebate in native gas token\n _pullToken(to, token, amount);\n _pullToken(to, UniversalTokenLib.ETH_ADDRESS, rebate);\n }\n\n emit BridgeRelayed(\n transactionId,\n msg.sender,\n to,\n transaction.originChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n rebate\n );\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n // update bridge tx status given proof provided\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = BridgeStatus.RELAYER_PROVED;\n bridgeProofs[transactionId] = BridgeProof({timestamp: uint96(block.timestamp), relayer: msg.sender}); // overflow ok\n\n emit BridgeProofProvided(transactionId, msg.sender, destTxHash);\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint96(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint96).max but\n /// proof.timestamp \u003c type(uint96).max via unchecked statement\n /// @param proof The bridge proof\n /// @return delta Time delta since proof submitted\n function _timeSince(BridgeProof memory proof) internal view returns (uint256 delta) {\n unchecked {\n delta = uint96(block.timestamp) - proof.timestamp;\n }\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != relayer) revert SenderIncorrect();\n return _timeSince(proof) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != msg.sender) revert SenderIncorrect();\n if (_timeSince(proof) \u003c= DISPUTE_PERIOD) revert DisputePeriodNotPassed();\n\n bridgeStatuses[transactionId] = 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, msg.sender, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeProofs[transactionId]) \u003e DISPUTE_PERIOD) revert DisputePeriodPassed();\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n delete bridgeProofs[transactionId];\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 BridgeTransaction memory transaction = getBridgeTransaction(request);\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 // set status to refunded if still in requested state\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = 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\n// test/FastBridgeMock.sol\n\ncontract FastBridgeMock is IFastBridge, Admin {\n // @dev 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 /// @dev to prevent replays\n uint256 public nonce;\n\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n // used for testing in go.\n // see: https://ethereum.stackexchange.com/questions/21155/how-to-expose-enum-in-solidity-contract\n // make sure to update fastbridge/status.go if this changes\n // or underliyng enum changes.\n //\n // TODO: a foundry test should be added to ensure this is always in sync.\n function getEnumKeyByValue(FastBridge.BridgeStatus keyValue) public pure returns (string memory) {\n if (FastBridge.BridgeStatus.NULL == keyValue) return \"NULL\";\n if (FastBridge.BridgeStatus.REQUESTED == keyValue) return \"REQUESTED\";\n if (FastBridge.BridgeStatus.RELAYER_PROVED == keyValue) return \"RELAYER_PROVED\";\n if (FastBridge.BridgeStatus.RELAYER_CLAIMED == keyValue) return \"RELAYER_CLAIMED\";\n if (FastBridge.BridgeStatus.REFUNDED == keyValue) return \"REFUNDED\";\n return \"\";\n }\n\n function mockBridgeRequest(bytes32 transactionId, address sender, BridgeParams memory params) external {\n uint256 originFeeAmount = (params.originAmount * protocolFeeRate) / FEE_BPS;\n params.originAmount -= originFeeAmount;\n\n bytes memory request = abi.encode(\n BridgeTransaction({\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: params.originAmount, // includes relayer fee\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n params.originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n function mockBridgeRequestRaw(bytes32 transactionId, address sender, bytes memory request) external {\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n emit BridgeRequested(\n transactionId,\n transaction.originSender,\n request,\n transaction.destChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n transaction.sendChainGas\n );\n }\n\n function mockBridgeRelayer(\n bytes32 transactionId,\n address relayer,\n address to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n )\n external\n {\n emit BridgeRelayed(\n transactionId, relayer, to, originChainId, originToken, destToken, originAmount, destAmount, chainGasAmount\n );\n }\n\n function bridge(BridgeParams memory params) external payable {\n revert(\"not implemented\");\n }\n\n function relay(bytes memory request) external payable {\n revert(\"not implemented\");\n }\n\n function prove(bytes memory request, bytes32 destTxHash) external {\n revert(\"not implemented\");\n }\n\n function canClaim(bytes32 transactionid, address relayer) external view returns (bool) {\n revert(\"not implemented\");\n }\n\n function claim(bytes memory request, address to) external {\n revert(\"not implemented\");\n }\n\n function dispute(bytes32 transactionId) external {\n revert(\"not implemented\");\n }\n\n function refund(bytes memory request) external {\n revert(\"not implemented\");\n }\n}\n","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","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.20+commit.a1b79de6\"},\"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/FastBridgeMock.sol\":\"AccessControlEnumerable\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeMock.sol\":{\"keccak256\":\"0xb58951ea9ccf93b597bddaa7b405278a10398c87bf748538ac7a67cd65184783\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://bb67eff4aa6731cbb158660257e9091bbc8135d228ceb240943772f9b5ada90e\",\"dweb:/ipfs/QmQbxcMCxtY5dWAJoPBpipMUjrN5zMvhQDCVkcMpRsn9LP\"]}},\"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/FastBridgeMock.sol:Address":{"code":"0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220e1828b68e29fbb3dc84ef6cf93a098d0b733b59ccc6648eaafcd08a35aa7518a64736f6c63430008140033","runtime-code":"0x73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220e1828b68e29fbb3dc84ef6cf93a098d0b733b59ccc6648eaafcd08a35aa7518a64736f6c63430008140033","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.20 ^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 pure 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/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// 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/FastBridge.sol\n\ncontract FastBridge is IFastBridge, Admin {\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 enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeStatus) public bridgeStatuses;\n /// @notice Proof of relayed bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeProof) public bridgeProofs;\n /// @notice Whether bridge has been relayed on destination chain\n mapping(bytes32 =\u003e bool) public bridgeRelays;\n\n /// @dev to prevent replays\n uint256 public nonce;\n // @dev 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 /// @notice Pulls a requested token from the user to the requested recipient.\n /// @dev Be careful of re-entrancy issues when msg.value \u003e 0 and recipient != address(this)\n function _pullToken(address recipient, address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token != UniversalTokenLib.ETH_ADDRESS) {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(recipient);\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, recipient, amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(recipient) - amountPulled;\n } else {\n // Otherwise, we need to check that ETH amount matches msg.value\n if (amount != msg.value) revert MsgValueIncorrect();\n // Transfer value to recipient if not this address\n if (recipient != address(this)) token.universalTransfer(recipient, amount);\n // We will forward msg.value in the external call later, if recipient is not this contract\n amountPulled = msg.value;\n }\n }\n\n /// @inheritdoc IFastBridge\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n // check bridge params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\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\n // transfer tokens to bridge contract\n // @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(address(this), 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 BridgeTransaction({\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 sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n\n // check haven't exceeded deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n\n // mark bridge transaction as relayed\n if (bridgeRelays[transactionId]) revert TransactionRelayed();\n bridgeRelays[transactionId] = true;\n\n // transfer tokens to recipient on destination chain and gas rebate if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n uint256 rebate = chainGasAmount;\n if (!transaction.sendChainGas) {\n // forward erc20\n rebate = 0;\n _pullToken(to, token, amount);\n } else if (token == UniversalTokenLib.ETH_ADDRESS) {\n // lump in gas rebate into amount in native gas token\n _pullToken(to, token, amount + rebate);\n } else {\n // forward erc20 then forward gas rebate in native gas token\n _pullToken(to, token, amount);\n _pullToken(to, UniversalTokenLib.ETH_ADDRESS, rebate);\n }\n\n emit BridgeRelayed(\n transactionId,\n msg.sender,\n to,\n transaction.originChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n rebate\n );\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n // update bridge tx status given proof provided\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = BridgeStatus.RELAYER_PROVED;\n bridgeProofs[transactionId] = BridgeProof({timestamp: uint96(block.timestamp), relayer: msg.sender}); // overflow ok\n\n emit BridgeProofProvided(transactionId, msg.sender, destTxHash);\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint96(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint96).max but\n /// proof.timestamp \u003c type(uint96).max via unchecked statement\n /// @param proof The bridge proof\n /// @return delta Time delta since proof submitted\n function _timeSince(BridgeProof memory proof) internal view returns (uint256 delta) {\n unchecked {\n delta = uint96(block.timestamp) - proof.timestamp;\n }\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != relayer) revert SenderIncorrect();\n return _timeSince(proof) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != msg.sender) revert SenderIncorrect();\n if (_timeSince(proof) \u003c= DISPUTE_PERIOD) revert DisputePeriodNotPassed();\n\n bridgeStatuses[transactionId] = 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, msg.sender, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeProofs[transactionId]) \u003e DISPUTE_PERIOD) revert DisputePeriodPassed();\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n delete bridgeProofs[transactionId];\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 BridgeTransaction memory transaction = getBridgeTransaction(request);\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 // set status to refunded if still in requested state\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = 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\n// test/FastBridgeMock.sol\n\ncontract FastBridgeMock is IFastBridge, Admin {\n // @dev 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 /// @dev to prevent replays\n uint256 public nonce;\n\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n // used for testing in go.\n // see: https://ethereum.stackexchange.com/questions/21155/how-to-expose-enum-in-solidity-contract\n // make sure to update fastbridge/status.go if this changes\n // or underliyng enum changes.\n //\n // TODO: a foundry test should be added to ensure this is always in sync.\n function getEnumKeyByValue(FastBridge.BridgeStatus keyValue) public pure returns (string memory) {\n if (FastBridge.BridgeStatus.NULL == keyValue) return \"NULL\";\n if (FastBridge.BridgeStatus.REQUESTED == keyValue) return \"REQUESTED\";\n if (FastBridge.BridgeStatus.RELAYER_PROVED == keyValue) return \"RELAYER_PROVED\";\n if (FastBridge.BridgeStatus.RELAYER_CLAIMED == keyValue) return \"RELAYER_CLAIMED\";\n if (FastBridge.BridgeStatus.REFUNDED == keyValue) return \"REFUNDED\";\n return \"\";\n }\n\n function mockBridgeRequest(bytes32 transactionId, address sender, BridgeParams memory params) external {\n uint256 originFeeAmount = (params.originAmount * protocolFeeRate) / FEE_BPS;\n params.originAmount -= originFeeAmount;\n\n bytes memory request = abi.encode(\n BridgeTransaction({\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: params.originAmount, // includes relayer fee\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n params.originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n function mockBridgeRequestRaw(bytes32 transactionId, address sender, bytes memory request) external {\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n emit BridgeRequested(\n transactionId,\n transaction.originSender,\n request,\n transaction.destChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n transaction.sendChainGas\n );\n }\n\n function mockBridgeRelayer(\n bytes32 transactionId,\n address relayer,\n address to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n )\n external\n {\n emit BridgeRelayed(\n transactionId, relayer, to, originChainId, originToken, destToken, originAmount, destAmount, chainGasAmount\n );\n }\n\n function bridge(BridgeParams memory params) external payable {\n revert(\"not implemented\");\n }\n\n function relay(bytes memory request) external payable {\n revert(\"not implemented\");\n }\n\n function prove(bytes memory request, bytes32 destTxHash) external {\n revert(\"not implemented\");\n }\n\n function canClaim(bytes32 transactionid, address relayer) external view returns (bool) {\n revert(\"not implemented\");\n }\n\n function claim(bytes memory request, address to) external {\n revert(\"not implemented\");\n }\n\n function dispute(bytes32 transactionId) external {\n revert(\"not implemented\");\n }\n\n function refund(bytes memory request) external {\n revert(\"not implemented\");\n }\n}\n","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","compilerOptions":"--combined-json bin,bin-runtime,srcmap,srcmap-runtime,abi,userdoc,devdoc,metadata,hashes --optimize --optimize-runs 10000 --allow-paths ., ./, ../ --evm-version=istanbul","srcMap":"15598:6066:0:-:0;;;;;;;;;;;;;;;-1:-1:-1;;;15598:6066:0;;;;;;;;;;;;;;;;;","srcMapRuntime":"15598: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.20+commit.a1b79de6\"},\"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/FastBridgeMock.sol\":\"Address\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeMock.sol\":{\"keccak256\":\"0xb58951ea9ccf93b597bddaa7b405278a10398c87bf748538ac7a67cd65184783\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://bb67eff4aa6731cbb158660257e9091bbc8135d228ceb240943772f9b5ada90e\",\"dweb:/ipfs/QmQbxcMCxtY5dWAJoPBpipMUjrN5zMvhQDCVkcMpRsn9LP\"]}},\"version\":1}"},"hashes":{}},"solidity/FastBridgeMock.sol:Admin":{"code":"0x60806040523480156200001157600080fd5b50604051620014123803806200141283398101604081905262000034916200018e565b6200004160008262000049565b5050620001b9565b60008062000058848462000086565b905080156200007d5760008481526001602052604090206200007b908462000134565b505b90505b92915050565b6000828152602081815260408083206001600160a01b038516845290915281205460ff166200012b576000838152602081815260408083206001600160a01b03861684529091529020805460ff19166001179055620000e23390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a450600162000080565b50600062000080565b60006200007d836001600160a01b03841660008181526001830160205260408120546200012b5750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915562000080565b600060208284031215620001a157600080fd5b81516001600160a01b03811681146200007d57600080fd5b61124980620001c96000396000f3fe608060405234801561001057600080fd5b50600436106101775760003560e01c806391d14854116100d8578063bf333f2c1161008c578063d547741f11610066578063d547741f14610385578063dcf844a714610398578063e00a83e0146103b857600080fd5b8063bf333f2c14610341578063ca15c8731461034b578063ccc574901461035e57600080fd5b8063a217fddf116100bd578063a217fddf14610313578063b13aa2d61461031b578063b250fe6b1461032e57600080fd5b806391d14854146102a8578063926d7d7f146102ec57600080fd5b80632f2ff15d1161012f57806358f858801161011457806358f85880146102405780635960ccf2146102495780639010d07c1461027057600080fd5b80632f2ff15d1461021a57806336568abe1461022d57600080fd5b806306f333f21161016057806306f333f2146101d95780630f5f6ed7146101ee578063248a9ca3146101f757600080fd5b806301ffc9a71461017c57806303ed0ee5146101a4575b600080fd5b61018f61018a366004611013565b6103c1565b60405190151581526020015b60405180910390f35b6101cb7f043c983c49d46f0e102151eaf8085d4a2e6571d5df2d47b013f39bddfd4a639d81565b60405190815260200161019b565b6101ec6101e736600461107e565b61041d565b005b6101cb61271081565b6101cb6102053660046110b1565b60009081526020819052604090206001015490565b6101ec6102283660046110ca565b61050b565b6101ec61023b3660046110ca565b610536565b6101cb60025481565b6101cb7fdb9556138406326f00296e13ea2ad7db24ba82381212d816b1a40c23b466b32781565b61028361027e3660046110ed565b61058f565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161019b565b61018f6102b63660046110ca565b60009182526020828152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b6101cb7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc481565b6101cb600081565b6101ec6103293660046110b1565b6105ae565b6101ec61033c3660046110b1565b610690565b6101cb620f424081565b6101cb6103593660046110b1565b6106f8565b6101cb7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5581565b6101ec6103933660046110ca565b61070f565b6101cb6103a636600461110f565b60036020526000908152604090205481565b6101cb60045481565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f5a05180f000000000000000000000000000000000000000000000000000000001480610417575061041782610734565b92915050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f55610447816107cb565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600360205260408120549081900361047b5750505050565b73ffffffffffffffffffffffffffffffffffffffff84166000818152600360205260408120556104ac9084836107d8565b6040805173ffffffffffffffffffffffffffffffffffffffff8087168252851660208201529081018290527f244e51bc38c1452fa8aaf487bcb4bca36c2baa3a5fbdb776b1eabd8dc6d277cd9060600160405180910390a1505b505050565b600082815260208190526040902060010154610526816107cb565b610530838361092f565b50505050565b73ffffffffffffffffffffffffffffffffffffffff81163314610585576040517f6697b23200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6105068282610964565b60008281526001602052604081206105a79083610991565b9392505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f556105d8816107cb565b612710821115610649576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f6e657746656552617465203e206d61780000000000000000000000000000000060448201526064015b60405180910390fd5b600280549083905560408051828152602081018590527f14914da2bf76024616fbe1859783fcd4dbddcb179b1f3a854949fbf920dcb95791015b60405180910390a1505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f556106ba816107cb565b600480549083905560408051828152602081018590527f5cf09b12f3f56b4c564d51b25b40360af6d795198adb61ae0806a36c294323fa9101610683565b60008181526001602052604081206104179061099d565b60008281526020819052604090206001015461072a816107cb565b6105308383610964565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061041757507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614610417565b6107d581336109a7565b50565b3073ffffffffffffffffffffffffffffffffffffffff8316036107fa57505050565b8060000361080757505050565b7fffffffffffffffffffffffff111111111111111111111111111111111111111273ffffffffffffffffffffffffffffffffffffffff84160161090e5760008273ffffffffffffffffffffffffffffffffffffffff168260405160006040518083038185875af1925050503d806000811461089e576040519150601f19603f3d011682016040523d82523d6000602084013e6108a3565b606091505b5050905080610530576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f455448207472616e73666572206661696c6564000000000000000000000000006044820152606401610640565b61050673ffffffffffffffffffffffffffffffffffffffff84168383610a31565b60008061093c8484610abe565b905080156105a757600084815260016020526040902061095c9084610bba565b509392505050565b6000806109718484610bdc565b905080156105a757600084815260016020526040902061095c9084610c97565b60006105a78383610cb9565b6000610417825490565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16610a2d576040517fe2517d3f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8216600482015260248101839052604401610640565b5050565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000179052610506908490610ce3565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915281205460ff16610bb25760008381526020818152604080832073ffffffffffffffffffffffffffffffffffffffff86168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055610b503390565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a4506001610417565b506000610417565b60006105a78373ffffffffffffffffffffffffffffffffffffffff8416610d79565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915281205460ff1615610bb25760008381526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8616808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a4506001610417565b60006105a78373ffffffffffffffffffffffffffffffffffffffff8416610dc0565b6000826000018281548110610cd057610cd061112a565b9060005260206000200154905092915050565b6000610d0573ffffffffffffffffffffffffffffffffffffffff841683610eb3565b90508051600014158015610d2a575080806020019051810190610d289190611159565b155b15610506576040517f5274afe700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84166004820152602401610640565b6000818152600183016020526040812054610bb257508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610417565b60008181526001830160205260408120548015610ea9576000610de460018361117b565b8554909150600090610df89060019061117b565b9050808214610e5d576000866000018281548110610e1857610e1861112a565b9060005260206000200154905080876000018481548110610e3b57610e3b61112a565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080610e6e57610e6e6111b5565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610417565b6000915050610417565b60606105a783836000846000808573ffffffffffffffffffffffffffffffffffffffff168486604051610ee691906111e4565b60006040518083038185875af1925050503d8060008114610f23576040519150601f19603f3d011682016040523d82523d6000602084013e610f28565b606091505b5091509150610f38868383610f42565b9695505050505050565b606082610f5757610f5282610fd1565b6105a7565b8151158015610f7b575073ffffffffffffffffffffffffffffffffffffffff84163b155b15610fca576040517f9996b31500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85166004820152602401610640565b50806105a7565b805115610fe15780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006020828403121561102557600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146105a757600080fd5b803573ffffffffffffffffffffffffffffffffffffffff8116811461107957600080fd5b919050565b6000806040838503121561109157600080fd5b61109a83611055565b91506110a860208401611055565b90509250929050565b6000602082840312156110c357600080fd5b5035919050565b600080604083850312156110dd57600080fd5b823591506110a860208401611055565b6000806040838503121561110057600080fd5b50508035926020909101359150565b60006020828403121561112157600080fd5b6105a782611055565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006020828403121561116b57600080fd5b815180151581146105a757600080fd5b81810381811115610417577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b6000825160005b8181101561120557602081860181015185830152016111eb565b50600092019182525091905056fea2646970667358221220f8a690a9e53a73fae27a3411c13cdb2a1b5392c7c709848e4b898d92e8162e6164736f6c63430008140033","runtime-code":"0x608060405234801561001057600080fd5b50600436106101775760003560e01c806391d14854116100d8578063bf333f2c1161008c578063d547741f11610066578063d547741f14610385578063dcf844a714610398578063e00a83e0146103b857600080fd5b8063bf333f2c14610341578063ca15c8731461034b578063ccc574901461035e57600080fd5b8063a217fddf116100bd578063a217fddf14610313578063b13aa2d61461031b578063b250fe6b1461032e57600080fd5b806391d14854146102a8578063926d7d7f146102ec57600080fd5b80632f2ff15d1161012f57806358f858801161011457806358f85880146102405780635960ccf2146102495780639010d07c1461027057600080fd5b80632f2ff15d1461021a57806336568abe1461022d57600080fd5b806306f333f21161016057806306f333f2146101d95780630f5f6ed7146101ee578063248a9ca3146101f757600080fd5b806301ffc9a71461017c57806303ed0ee5146101a4575b600080fd5b61018f61018a366004611013565b6103c1565b60405190151581526020015b60405180910390f35b6101cb7f043c983c49d46f0e102151eaf8085d4a2e6571d5df2d47b013f39bddfd4a639d81565b60405190815260200161019b565b6101ec6101e736600461107e565b61041d565b005b6101cb61271081565b6101cb6102053660046110b1565b60009081526020819052604090206001015490565b6101ec6102283660046110ca565b61050b565b6101ec61023b3660046110ca565b610536565b6101cb60025481565b6101cb7fdb9556138406326f00296e13ea2ad7db24ba82381212d816b1a40c23b466b32781565b61028361027e3660046110ed565b61058f565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161019b565b61018f6102b63660046110ca565b60009182526020828152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b6101cb7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc481565b6101cb600081565b6101ec6103293660046110b1565b6105ae565b6101ec61033c3660046110b1565b610690565b6101cb620f424081565b6101cb6103593660046110b1565b6106f8565b6101cb7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5581565b6101ec6103933660046110ca565b61070f565b6101cb6103a636600461110f565b60036020526000908152604090205481565b6101cb60045481565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f5a05180f000000000000000000000000000000000000000000000000000000001480610417575061041782610734565b92915050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f55610447816107cb565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600360205260408120549081900361047b5750505050565b73ffffffffffffffffffffffffffffffffffffffff84166000818152600360205260408120556104ac9084836107d8565b6040805173ffffffffffffffffffffffffffffffffffffffff8087168252851660208201529081018290527f244e51bc38c1452fa8aaf487bcb4bca36c2baa3a5fbdb776b1eabd8dc6d277cd9060600160405180910390a1505b505050565b600082815260208190526040902060010154610526816107cb565b610530838361092f565b50505050565b73ffffffffffffffffffffffffffffffffffffffff81163314610585576040517f6697b23200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6105068282610964565b60008281526001602052604081206105a79083610991565b9392505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f556105d8816107cb565b612710821115610649576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f6e657746656552617465203e206d61780000000000000000000000000000000060448201526064015b60405180910390fd5b600280549083905560408051828152602081018590527f14914da2bf76024616fbe1859783fcd4dbddcb179b1f3a854949fbf920dcb95791015b60405180910390a1505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f556106ba816107cb565b600480549083905560408051828152602081018590527f5cf09b12f3f56b4c564d51b25b40360af6d795198adb61ae0806a36c294323fa9101610683565b60008181526001602052604081206104179061099d565b60008281526020819052604090206001015461072a816107cb565b6105308383610964565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061041757507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614610417565b6107d581336109a7565b50565b3073ffffffffffffffffffffffffffffffffffffffff8316036107fa57505050565b8060000361080757505050565b7fffffffffffffffffffffffff111111111111111111111111111111111111111273ffffffffffffffffffffffffffffffffffffffff84160161090e5760008273ffffffffffffffffffffffffffffffffffffffff168260405160006040518083038185875af1925050503d806000811461089e576040519150601f19603f3d011682016040523d82523d6000602084013e6108a3565b606091505b5050905080610530576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f455448207472616e73666572206661696c6564000000000000000000000000006044820152606401610640565b61050673ffffffffffffffffffffffffffffffffffffffff84168383610a31565b60008061093c8484610abe565b905080156105a757600084815260016020526040902061095c9084610bba565b509392505050565b6000806109718484610bdc565b905080156105a757600084815260016020526040902061095c9084610c97565b60006105a78383610cb9565b6000610417825490565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16610a2d576040517fe2517d3f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8216600482015260248101839052604401610640565b5050565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000179052610506908490610ce3565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915281205460ff16610bb25760008381526020818152604080832073ffffffffffffffffffffffffffffffffffffffff86168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055610b503390565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a4506001610417565b506000610417565b60006105a78373ffffffffffffffffffffffffffffffffffffffff8416610d79565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915281205460ff1615610bb25760008381526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8616808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a4506001610417565b60006105a78373ffffffffffffffffffffffffffffffffffffffff8416610dc0565b6000826000018281548110610cd057610cd061112a565b9060005260206000200154905092915050565b6000610d0573ffffffffffffffffffffffffffffffffffffffff841683610eb3565b90508051600014158015610d2a575080806020019051810190610d289190611159565b155b15610506576040517f5274afe700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84166004820152602401610640565b6000818152600183016020526040812054610bb257508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610417565b60008181526001830160205260408120548015610ea9576000610de460018361117b565b8554909150600090610df89060019061117b565b9050808214610e5d576000866000018281548110610e1857610e1861112a565b9060005260206000200154905080876000018481548110610e3b57610e3b61112a565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080610e6e57610e6e6111b5565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610417565b6000915050610417565b60606105a783836000846000808573ffffffffffffffffffffffffffffffffffffffff168486604051610ee691906111e4565b60006040518083038185875af1925050503d8060008114610f23576040519150601f19603f3d011682016040523d82523d6000602084013e610f28565b606091505b5091509150610f38868383610f42565b9695505050505050565b606082610f5757610f5282610fd1565b6105a7565b8151158015610f7b575073ffffffffffffffffffffffffffffffffffffffff84163b155b15610fca576040517f9996b31500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85166004820152602401610640565b50806105a7565b805115610fe15780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006020828403121561102557600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146105a757600080fd5b803573ffffffffffffffffffffffffffffffffffffffff8116811461107957600080fd5b919050565b6000806040838503121561109157600080fd5b61109a83611055565b91506110a860208401611055565b90509250929050565b6000602082840312156110c357600080fd5b5035919050565b600080604083850312156110dd57600080fd5b823591506110a860208401611055565b6000806040838503121561110057600080fd5b50508035926020909101359150565b60006020828403121561112157600080fd5b6105a782611055565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006020828403121561116b57600080fd5b815180151581146105a757600080fd5b81810381811115610417577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b6000825160005b8181101561120557602081860181015185830152016111eb565b50600092019182525091905056fea2646970667358221220f8a690a9e53a73fae27a3411c13cdb2a1b5392c7c709848e4b898d92e8162e6164736f6c63430008140033","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.20 ^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 pure 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/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// 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/FastBridge.sol\n\ncontract FastBridge is IFastBridge, Admin {\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 enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeStatus) public bridgeStatuses;\n /// @notice Proof of relayed bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeProof) public bridgeProofs;\n /// @notice Whether bridge has been relayed on destination chain\n mapping(bytes32 =\u003e bool) public bridgeRelays;\n\n /// @dev to prevent replays\n uint256 public nonce;\n // @dev 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 /// @notice Pulls a requested token from the user to the requested recipient.\n /// @dev Be careful of re-entrancy issues when msg.value \u003e 0 and recipient != address(this)\n function _pullToken(address recipient, address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token != UniversalTokenLib.ETH_ADDRESS) {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(recipient);\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, recipient, amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(recipient) - amountPulled;\n } else {\n // Otherwise, we need to check that ETH amount matches msg.value\n if (amount != msg.value) revert MsgValueIncorrect();\n // Transfer value to recipient if not this address\n if (recipient != address(this)) token.universalTransfer(recipient, amount);\n // We will forward msg.value in the external call later, if recipient is not this contract\n amountPulled = msg.value;\n }\n }\n\n /// @inheritdoc IFastBridge\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n // check bridge params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\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\n // transfer tokens to bridge contract\n // @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(address(this), 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 BridgeTransaction({\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 sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n\n // check haven't exceeded deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n\n // mark bridge transaction as relayed\n if (bridgeRelays[transactionId]) revert TransactionRelayed();\n bridgeRelays[transactionId] = true;\n\n // transfer tokens to recipient on destination chain and gas rebate if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n uint256 rebate = chainGasAmount;\n if (!transaction.sendChainGas) {\n // forward erc20\n rebate = 0;\n _pullToken(to, token, amount);\n } else if (token == UniversalTokenLib.ETH_ADDRESS) {\n // lump in gas rebate into amount in native gas token\n _pullToken(to, token, amount + rebate);\n } else {\n // forward erc20 then forward gas rebate in native gas token\n _pullToken(to, token, amount);\n _pullToken(to, UniversalTokenLib.ETH_ADDRESS, rebate);\n }\n\n emit BridgeRelayed(\n transactionId,\n msg.sender,\n to,\n transaction.originChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n rebate\n );\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n // update bridge tx status given proof provided\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = BridgeStatus.RELAYER_PROVED;\n bridgeProofs[transactionId] = BridgeProof({timestamp: uint96(block.timestamp), relayer: msg.sender}); // overflow ok\n\n emit BridgeProofProvided(transactionId, msg.sender, destTxHash);\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint96(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint96).max but\n /// proof.timestamp \u003c type(uint96).max via unchecked statement\n /// @param proof The bridge proof\n /// @return delta Time delta since proof submitted\n function _timeSince(BridgeProof memory proof) internal view returns (uint256 delta) {\n unchecked {\n delta = uint96(block.timestamp) - proof.timestamp;\n }\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != relayer) revert SenderIncorrect();\n return _timeSince(proof) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != msg.sender) revert SenderIncorrect();\n if (_timeSince(proof) \u003c= DISPUTE_PERIOD) revert DisputePeriodNotPassed();\n\n bridgeStatuses[transactionId] = 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, msg.sender, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeProofs[transactionId]) \u003e DISPUTE_PERIOD) revert DisputePeriodPassed();\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n delete bridgeProofs[transactionId];\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 BridgeTransaction memory transaction = getBridgeTransaction(request);\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 // set status to refunded if still in requested state\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = 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\n// test/FastBridgeMock.sol\n\ncontract FastBridgeMock is IFastBridge, Admin {\n // @dev 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 /// @dev to prevent replays\n uint256 public nonce;\n\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n // used for testing in go.\n // see: https://ethereum.stackexchange.com/questions/21155/how-to-expose-enum-in-solidity-contract\n // make sure to update fastbridge/status.go if this changes\n // or underliyng enum changes.\n //\n // TODO: a foundry test should be added to ensure this is always in sync.\n function getEnumKeyByValue(FastBridge.BridgeStatus keyValue) public pure returns (string memory) {\n if (FastBridge.BridgeStatus.NULL == keyValue) return \"NULL\";\n if (FastBridge.BridgeStatus.REQUESTED == keyValue) return \"REQUESTED\";\n if (FastBridge.BridgeStatus.RELAYER_PROVED == keyValue) return \"RELAYER_PROVED\";\n if (FastBridge.BridgeStatus.RELAYER_CLAIMED == keyValue) return \"RELAYER_CLAIMED\";\n if (FastBridge.BridgeStatus.REFUNDED == keyValue) return \"REFUNDED\";\n return \"\";\n }\n\n function mockBridgeRequest(bytes32 transactionId, address sender, BridgeParams memory params) external {\n uint256 originFeeAmount = (params.originAmount * protocolFeeRate) / FEE_BPS;\n params.originAmount -= originFeeAmount;\n\n bytes memory request = abi.encode(\n BridgeTransaction({\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: params.originAmount, // includes relayer fee\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n params.originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n function mockBridgeRequestRaw(bytes32 transactionId, address sender, bytes memory request) external {\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n emit BridgeRequested(\n transactionId,\n transaction.originSender,\n request,\n transaction.destChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n transaction.sendChainGas\n );\n }\n\n function mockBridgeRelayer(\n bytes32 transactionId,\n address relayer,\n address to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n )\n external\n {\n emit BridgeRelayed(\n transactionId, relayer, to, originChainId, originToken, destToken, originAmount, destAmount, chainGasAmount\n );\n }\n\n function bridge(BridgeParams memory params) external payable {\n revert(\"not implemented\");\n }\n\n function relay(bytes memory request) external payable {\n revert(\"not implemented\");\n }\n\n function prove(bytes memory request, bytes32 destTxHash) external {\n revert(\"not implemented\");\n }\n\n function canClaim(bytes32 transactionid, address relayer) external view returns (bool) {\n revert(\"not implemented\");\n }\n\n function claim(bytes memory request, address to) external {\n revert(\"not implemented\");\n }\n\n function dispute(bytes32 transactionId) external {\n revert(\"not implemented\");\n }\n\n function refund(bytes memory request) external {\n revert(\"not implemented\");\n }\n}\n","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","compilerOptions":"--combined-json bin,bin-runtime,srcmap,srcmap-runtime,abi,userdoc,devdoc,metadata,hashes --optimize --optimize-runs 10000 --allow-paths ., ./, ../ --evm-version=istanbul","srcMap":"56322:1843:0:-:0;;;57149:83;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;57187:38;46359:4;57218:6;57187:10;:38::i;:::-;;57149:83;56322:1843;;55672:257;55758:4;;55789:31;55806:4;55812:7;55789:16;:31::i;:::-;55774:46;;55834:7;55830:69;;;55857:18;;;;:12;:18;;;;;:31;;55880:7;55857:22;:31::i;:::-;;55830:69;55915:7;-1:-1:-1;55672:257:0;;;;;:::o;50306:316::-;50383:4;47081:12;;;;;;;;;;;-1:-1:-1;;;;;47081:29:0;;;;;;;;;;;;50399:217;;50442:6;:12;;;;;;;;;;;-1:-1:-1;;;;;50442:29:0;;;;;;;;;:36;;-1:-1:-1;;50442:36:0;50474:4;50442:36;;;50524:12;22402:10;;22323:96;50524:12;-1:-1:-1;;;;;50497:40:0;50515:7;-1:-1:-1;;;;;50497:40:0;50509:4;50497:40;;;;;;;;;;-1:-1:-1;50558:4:0;50551:11;;50399:217;-1:-1:-1;50600:5:0;50593:12;;31847:150;31917:4;31940:50;31945:3;-1:-1:-1;;;;;31965:23:0;;25835:4;27891:21;;;:14;;;:21;;;;;;25851:321;;-1:-1:-1;25893:23:0;;;;;;;;:11;:23;;;;;;;;;;;;;26075:18;;26051:21;;;:14;;;:21;;;;;;:42;;;;26107: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;56322:1843:0;;;;;;","srcMapRuntime":"56322:1843:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;54332:212;;;;;;:::i;:::-;;:::i;:::-;;;516:14:1;;509:22;491:41;;479:2;464:18;54332:212:0;;;;;;;;56562:60;;56599:23;56562:60;;;;;689:25:1;;;677:2;662:18;56562:60:0;543:177:1;57534:359:0;;;;;;:::i;:::-;;:::i;:::-;;56744:45;;56783:6;56744:45;;47937:120;;;;;;:::i;:::-;48002:7;48028:12;;;;;;;;;;:22;;;;47937:120;48353:136;;;;;;:::i;:::-;;:::i;49455:245::-;;;;;;:::i;:::-;;:::i;56906:30::-;;;;;;56490:66;;56530:26;56490:66;;55129:142;;;;;;:::i;:::-;;:::i;:::-;;;2246:42:1;2234:55;;;2216:74;;2204:2;2189:18;55129:142:0;2070:226:1;46981:136:0;;;;;;:::i;:::-;47058:4;47081:12;;;;;;;;;;;:29;;;;;;;;;;;;;;;;46981:136;56420:64;;56459:25;56420:64;;46314:49;;46359:4;46314:49;;57238:290;;;;;;:::i;:::-;;:::i;57899:264::-;;;;;;:::i;:::-;;:::i;56701:37::-;;56735:3;56701:37;;55439:131;;;;;;:::i;:::-;;:::i;56628:66::-;;56668:26;56628:66;;48769:138;;;;;;:::i;:::-;;:::i;56992:47::-;;;;;;:::i;:::-;;;;;;;;;;;;;;57113:29;;;;;;54332:212;54417:4;54440:57;;;54455:42;54440:57;;:97;;;54501:36;54525:11;54501:23;:36::i;:::-;54433:104;54332:212;-1:-1:-1;;54332:212:0:o;57534:359::-;56668:26;46591:16;46602:4;46591:10;:16::i;:::-;57658:19:::1;::::0;::::1;57638:17;57658:19:::0;;;:12:::1;:19;::::0;;;;;;57691:14;;;57687:27:::1;;57707:7;57534:359:::0;;;:::o;57687:27::-:1;57755:19;::::0;::::1;57777:1;57755:19:::0;;;:12:::1;:19;::::0;;;;:23;57788:45:::1;::::0;57812:9;57823;57788:23:::1;:45::i;:::-;57848:38;::::0;;2889:42:1;2958:15;;;2940:34;;3010:15;;3005:2;2990:18;;2983:43;3042:18;;;3035:34;;;57848:38:0::1;::::0;2867:2:1;2852:18;57848:38:0::1;;;;;;;57628:265;46617:1;57534:359:::0;;;:::o;48353:136::-;48002:7;48028:12;;;;;;;;;;:22;;;46591:16;46602:4;46591:10;:16::i;:::-;48457:25:::1;48468:4;48474:7;48457:10;:25::i;:::-;;48353:136:::0;;;:::o;49455:245::-;49548:34;;;22402:10;49548:34;49544:102;;49605:30;;;;;;;;;;;;;;49544:102;49656:37;49668:4;49674:18;49656:11;:37::i;55129:142::-;55210:7;55236:18;;;:12;:18;;;;;:28;;55258:5;55236:21;:28::i;:::-;55229:35;55129:142;-1:-1:-1;;;55129:142:0:o;57238:290::-;56668:26;46591:16;46602:4;46591:10;:16::i;:::-;56783:6:::1;57337:10;:26;;57329:55;;;::::0;::::1;::::0;;3282:2:1;57329:55:0::1;::::0;::::1;3264:21:1::0;3321:2;3301:18;;;3294:30;3360:18;3340;;;3333:46;3396:18;;57329:55:0::1;;;;;;;;;57415:15;::::0;;57440:28;;;;57483:38:::1;::::0;;3599:25:1;;;3655:2;3640:18;;3633:34;;;57483:38:0::1;::::0;3572:18:1;57483:38:0::1;;;;;;;;57319:209;57238:290:::0;;:::o;57899:264::-;56668:26;46591:16;46602:4;46591:10;:16::i;:::-;58024:14:::1;::::0;;58048:34;;;;58097:59:::1;::::0;;3599:25:1;;;3655:2;3640:18;;3633:34;;;58097:59:0::1;::::0;3572:18:1;58097:59:0::1;3425:248:1::0;55439:131:0;55510:7;55536:18;;;:12;:18;;;;;:27;;:25;:27::i;48769:138::-;48002:7;48028:12;;;;;;;;;;:22;;;46591:16;46602:4;46591:10;:16::i;:::-;48874:26:::1;48886:4;48892:7;48874:11;:26::i;46692:202::-:0;46777:4;46800:47;;;46815:32;46800:47;;:87;;-1:-1:-1;38607:25:0;38592:40;;;;46851:36;38493:146;47326:103;47392:30;47403:4;22402:10;47392;:30::i;:::-;47326:103;:::o;51604:653::-;51779:4;51765:19;;;;51761:32;;51604:653;;;:::o;51761:32::-;51865:5;51874:1;51865:10;51861:23;;51604:653;;;:::o;51861:23::-;51897:20;;;;;51893:358;;52077:12;52094:2;:7;;52109:5;52094:25;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;52076:43;;;52141:7;52133:39;;;;;;;4090:2:1;52133:39:0;;;4072:21:1;4129:2;4109:18;;;4102:30;4168:21;4148:18;;;4141:49;4207:18;;52133:39:0;3888:343:1;51893:358:0;52203:37;:26;;;52230:2;52234:5;52203:26;:37::i;55672:257::-;55758:4;55774:12;55789:31;55806:4;55812:7;55789:16;:31::i;:::-;55774:46;;55834:7;55830:69;;;55857:18;;;;:12;:18;;;;;:31;;55880:7;55857:22;:31::i;:::-;;55915:7;55672:257;-1:-1:-1;;;55672:257:0:o;56032:262::-;56119:4;56135:12;56150:32;56168:4;56174:7;56150:17;:32::i;:::-;56135:47;;56196:7;56192:72;;;56219:18;;;;:12;:18;;;;;:34;;56245:7;56219:25;:34::i;33105:156::-;33179:7;33229:22;33233:3;33245:5;33229:3;:22::i;32648:115::-;32711:7;32737:19;32745:3;28087:18;;28005:107;47559:197;47058:4;47081:12;;;;;;;;;;;:29;;;;;;;;;;;;;47642:108;;47692:47;;;;;4440:42:1;4428:55;;47692:47:0;;;4410:74:1;4500:18;;;4493:34;;;4383:18;;47692:47:0;4236:297:1;47642:108:0;47559:197;;:::o;39809:160::-;39918:43;;;39933:14;4428:55:1;;39918:43:0;;;4410:74:1;4500:18;;;;4493:34;;;39918:43:0;;;;;;;;;;4383:18:1;;;;39918:43:0;;;;;;;;;;;;;;39891:71;;39911:5;;39891:19;:71::i;50306:316::-;50383:4;47081:12;;;;;;;;;;;:29;;;;;;;;;;;;;50399:217;;50442:6;:12;;;;;;;;;;;:29;;;;;;;;;;:36;;;;50474:4;50442:36;;;50524:12;22402:10;;22323:96;50524:12;50497:40;;50515:7;50497:40;;50509:4;50497:40;;;;;;;;;;-1:-1:-1;50558:4:0;50551:11;;50399:217;-1:-1:-1;50600:5:0;50593:12;;31847:150;31917:4;31940:50;31945:3;31965:23;;;31940:4;:50::i;50857:317::-;50935:4;47081:12;;;;;;;;;;;:29;;;;;;;;;;;;;50951:217;;;51025:5;50993:12;;;;;;;;;;;:29;;;;;;;;;;;:37;;;;;;51049:40;22402:10;;50993:12;;51049:40;;51025:5;51049:40;-1:-1:-1;51110:4:0;51103:11;;32165:156;32238:4;32261:53;32269:3;32289:23;;;32261:7;:53::i;28454:118::-;28521:7;28547:3;:11;;28559:5;28547:18;;;;;;;;:::i;:::-;;;;;;;;;28540:25;;28454:118;;;;:::o;42565:629::-;42984:23;43010:33;:27;;;43038:4;43010:27;:33::i;:::-;42984:59;;43057:10;:17;43078:1;43057:22;;:57;;;;;43095:10;43084:30;;;;;;;;;;;;:::i;:::-;43083:31;43057:57;43053:135;;;43137:40;;;;;2246:42:1;2234:55;;43137:40:0;;;2216:74:1;2189:18;;43137:40:0;2070:226:1;25772:406:0;25835:4;27891:21;;;:14;;;:21;;;;;;25851:321;;-1:-1:-1;25893:23:0;;;;;;;;:11;:23;;;;;;;;;;;;;26075:18;;26051:21;;;:14;;;:21;;;;;;:42;;;;26107:11;;26346:1368;26412:4;26541:21;;;:14;;;:21;;;;;;26577:13;;26573:1135;;26944:18;26965:12;26976:1;26965:8;:12;:::i;:::-;27011:18;;26944:33;;-1:-1:-1;26991:17:0;;27011:22;;27032:1;;27011:22;:::i;:::-;26991:42;;27066:9;27052:10;:23;27048:378;;27095:17;27115:3;:11;;27127:9;27115:22;;;;;;;;:::i;:::-;;;;;;;;;27095:42;;27262:9;27236:3;:11;;27248:10;27236:23;;;;;;;;:::i;:::-;;;;;;;;;;;;:35;;;;27375:25;;;:14;;;:25;;;;;:36;;;27048:378;27504:17;;:3;;:17;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;27607:3;:14;;:21;27622:5;27607:21;;;;;;;;;;;27600:28;;;27650:4;27643:11;;;;;;;26573:1135;27692:5;27685:12;;;;;18108:151;18183:12;18214:38;18236:6;18244:4;18250:1;18183:12;18824;18838:23;18865:6;:11;;18884:5;18891:4;18865:31;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;18823:73;;;;18913:55;18940:6;18948:7;18957:10;18913:26;:55::i;:::-;18906:62;18583:392;-1:-1:-1;;;;;;18583:392:0:o;20028:582::-;20172:12;20201:7;20196:408;;20224:19;20232:10;20224:7;:19::i;:::-;20196:408;;;20448:17;;:22;:49;;;;-1:-1:-1;20474:18:0;;;;:23;20448:49;20444:119;;;20524:24;;;;;2246:42:1;2234:55;;20524:24:0;;;2216:74:1;2189:18;;20524:24:0;2070:226:1;20444:119:0;-1:-1:-1;20583:10:0;20576:17;;21146:516;21277:17;;:21;21273:383;;21505:10;21499:17;21561:15;21548:10;21544:2;21540:19;21533:44;21273:383;21628: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.20+commit.a1b79de6\"},\"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/FastBridgeMock.sol\":\"Admin\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeMock.sol\":{\"keccak256\":\"0xb58951ea9ccf93b597bddaa7b405278a10398c87bf748538ac7a67cd65184783\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://bb67eff4aa6731cbb158660257e9091bbc8135d228ceb240943772f9b5ada90e\",\"dweb:/ipfs/QmQbxcMCxtY5dWAJoPBpipMUjrN5zMvhQDCVkcMpRsn9LP\"]}},\"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/FastBridgeMock.sol:Context":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.20 ^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 pure 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/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// 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/FastBridge.sol\n\ncontract FastBridge is IFastBridge, Admin {\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 enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeStatus) public bridgeStatuses;\n /// @notice Proof of relayed bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeProof) public bridgeProofs;\n /// @notice Whether bridge has been relayed on destination chain\n mapping(bytes32 =\u003e bool) public bridgeRelays;\n\n /// @dev to prevent replays\n uint256 public nonce;\n // @dev 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 /// @notice Pulls a requested token from the user to the requested recipient.\n /// @dev Be careful of re-entrancy issues when msg.value \u003e 0 and recipient != address(this)\n function _pullToken(address recipient, address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token != UniversalTokenLib.ETH_ADDRESS) {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(recipient);\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, recipient, amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(recipient) - amountPulled;\n } else {\n // Otherwise, we need to check that ETH amount matches msg.value\n if (amount != msg.value) revert MsgValueIncorrect();\n // Transfer value to recipient if not this address\n if (recipient != address(this)) token.universalTransfer(recipient, amount);\n // We will forward msg.value in the external call later, if recipient is not this contract\n amountPulled = msg.value;\n }\n }\n\n /// @inheritdoc IFastBridge\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n // check bridge params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\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\n // transfer tokens to bridge contract\n // @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(address(this), 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 BridgeTransaction({\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 sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n\n // check haven't exceeded deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n\n // mark bridge transaction as relayed\n if (bridgeRelays[transactionId]) revert TransactionRelayed();\n bridgeRelays[transactionId] = true;\n\n // transfer tokens to recipient on destination chain and gas rebate if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n uint256 rebate = chainGasAmount;\n if (!transaction.sendChainGas) {\n // forward erc20\n rebate = 0;\n _pullToken(to, token, amount);\n } else if (token == UniversalTokenLib.ETH_ADDRESS) {\n // lump in gas rebate into amount in native gas token\n _pullToken(to, token, amount + rebate);\n } else {\n // forward erc20 then forward gas rebate in native gas token\n _pullToken(to, token, amount);\n _pullToken(to, UniversalTokenLib.ETH_ADDRESS, rebate);\n }\n\n emit BridgeRelayed(\n transactionId,\n msg.sender,\n to,\n transaction.originChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n rebate\n );\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n // update bridge tx status given proof provided\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = BridgeStatus.RELAYER_PROVED;\n bridgeProofs[transactionId] = BridgeProof({timestamp: uint96(block.timestamp), relayer: msg.sender}); // overflow ok\n\n emit BridgeProofProvided(transactionId, msg.sender, destTxHash);\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint96(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint96).max but\n /// proof.timestamp \u003c type(uint96).max via unchecked statement\n /// @param proof The bridge proof\n /// @return delta Time delta since proof submitted\n function _timeSince(BridgeProof memory proof) internal view returns (uint256 delta) {\n unchecked {\n delta = uint96(block.timestamp) - proof.timestamp;\n }\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != relayer) revert SenderIncorrect();\n return _timeSince(proof) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != msg.sender) revert SenderIncorrect();\n if (_timeSince(proof) \u003c= DISPUTE_PERIOD) revert DisputePeriodNotPassed();\n\n bridgeStatuses[transactionId] = 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, msg.sender, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeProofs[transactionId]) \u003e DISPUTE_PERIOD) revert DisputePeriodPassed();\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n delete bridgeProofs[transactionId];\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 BridgeTransaction memory transaction = getBridgeTransaction(request);\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 // set status to refunded if still in requested state\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = 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\n// test/FastBridgeMock.sol\n\ncontract FastBridgeMock is IFastBridge, Admin {\n // @dev 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 /// @dev to prevent replays\n uint256 public nonce;\n\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n // used for testing in go.\n // see: https://ethereum.stackexchange.com/questions/21155/how-to-expose-enum-in-solidity-contract\n // make sure to update fastbridge/status.go if this changes\n // or underliyng enum changes.\n //\n // TODO: a foundry test should be added to ensure this is always in sync.\n function getEnumKeyByValue(FastBridge.BridgeStatus keyValue) public pure returns (string memory) {\n if (FastBridge.BridgeStatus.NULL == keyValue) return \"NULL\";\n if (FastBridge.BridgeStatus.REQUESTED == keyValue) return \"REQUESTED\";\n if (FastBridge.BridgeStatus.RELAYER_PROVED == keyValue) return \"RELAYER_PROVED\";\n if (FastBridge.BridgeStatus.RELAYER_CLAIMED == keyValue) return \"RELAYER_CLAIMED\";\n if (FastBridge.BridgeStatus.REFUNDED == keyValue) return \"REFUNDED\";\n return \"\";\n }\n\n function mockBridgeRequest(bytes32 transactionId, address sender, BridgeParams memory params) external {\n uint256 originFeeAmount = (params.originAmount * protocolFeeRate) / FEE_BPS;\n params.originAmount -= originFeeAmount;\n\n bytes memory request = abi.encode(\n BridgeTransaction({\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: params.originAmount, // includes relayer fee\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n params.originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n function mockBridgeRequestRaw(bytes32 transactionId, address sender, bytes memory request) external {\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n emit BridgeRequested(\n transactionId,\n transaction.originSender,\n request,\n transaction.destChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n transaction.sendChainGas\n );\n }\n\n function mockBridgeRelayer(\n bytes32 transactionId,\n address relayer,\n address to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n )\n external\n {\n emit BridgeRelayed(\n transactionId, relayer, to, originChainId, originToken, destToken, originAmount, destAmount, chainGasAmount\n );\n }\n\n function bridge(BridgeParams memory params) external payable {\n revert(\"not implemented\");\n }\n\n function relay(bytes memory request) external payable {\n revert(\"not implemented\");\n }\n\n function prove(bytes memory request, bytes32 destTxHash) external {\n revert(\"not implemented\");\n }\n\n function canClaim(bytes32 transactionid, address relayer) external view returns (bool) {\n revert(\"not implemented\");\n }\n\n function claim(bytes memory request, address to) external {\n revert(\"not implemented\");\n }\n\n function dispute(bytes32 transactionId) external {\n revert(\"not implemented\");\n }\n\n function refund(bytes memory request) external {\n revert(\"not implemented\");\n }\n}\n","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","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.20+commit.a1b79de6\"},\"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/FastBridgeMock.sol\":\"Context\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeMock.sol\":{\"keccak256\":\"0xb58951ea9ccf93b597bddaa7b405278a10398c87bf748538ac7a67cd65184783\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://bb67eff4aa6731cbb158660257e9091bbc8135d228ceb240943772f9b5ada90e\",\"dweb:/ipfs/QmQbxcMCxtY5dWAJoPBpipMUjrN5zMvhQDCVkcMpRsn9LP\"]}},\"version\":1}"},"hashes":{}},"solidity/FastBridgeMock.sol:ERC165":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.20 ^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 pure 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/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// 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/FastBridge.sol\n\ncontract FastBridge is IFastBridge, Admin {\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 enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeStatus) public bridgeStatuses;\n /// @notice Proof of relayed bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeProof) public bridgeProofs;\n /// @notice Whether bridge has been relayed on destination chain\n mapping(bytes32 =\u003e bool) public bridgeRelays;\n\n /// @dev to prevent replays\n uint256 public nonce;\n // @dev 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 /// @notice Pulls a requested token from the user to the requested recipient.\n /// @dev Be careful of re-entrancy issues when msg.value \u003e 0 and recipient != address(this)\n function _pullToken(address recipient, address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token != UniversalTokenLib.ETH_ADDRESS) {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(recipient);\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, recipient, amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(recipient) - amountPulled;\n } else {\n // Otherwise, we need to check that ETH amount matches msg.value\n if (amount != msg.value) revert MsgValueIncorrect();\n // Transfer value to recipient if not this address\n if (recipient != address(this)) token.universalTransfer(recipient, amount);\n // We will forward msg.value in the external call later, if recipient is not this contract\n amountPulled = msg.value;\n }\n }\n\n /// @inheritdoc IFastBridge\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n // check bridge params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\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\n // transfer tokens to bridge contract\n // @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(address(this), 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 BridgeTransaction({\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 sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n\n // check haven't exceeded deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n\n // mark bridge transaction as relayed\n if (bridgeRelays[transactionId]) revert TransactionRelayed();\n bridgeRelays[transactionId] = true;\n\n // transfer tokens to recipient on destination chain and gas rebate if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n uint256 rebate = chainGasAmount;\n if (!transaction.sendChainGas) {\n // forward erc20\n rebate = 0;\n _pullToken(to, token, amount);\n } else if (token == UniversalTokenLib.ETH_ADDRESS) {\n // lump in gas rebate into amount in native gas token\n _pullToken(to, token, amount + rebate);\n } else {\n // forward erc20 then forward gas rebate in native gas token\n _pullToken(to, token, amount);\n _pullToken(to, UniversalTokenLib.ETH_ADDRESS, rebate);\n }\n\n emit BridgeRelayed(\n transactionId,\n msg.sender,\n to,\n transaction.originChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n rebate\n );\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n // update bridge tx status given proof provided\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = BridgeStatus.RELAYER_PROVED;\n bridgeProofs[transactionId] = BridgeProof({timestamp: uint96(block.timestamp), relayer: msg.sender}); // overflow ok\n\n emit BridgeProofProvided(transactionId, msg.sender, destTxHash);\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint96(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint96).max but\n /// proof.timestamp \u003c type(uint96).max via unchecked statement\n /// @param proof The bridge proof\n /// @return delta Time delta since proof submitted\n function _timeSince(BridgeProof memory proof) internal view returns (uint256 delta) {\n unchecked {\n delta = uint96(block.timestamp) - proof.timestamp;\n }\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != relayer) revert SenderIncorrect();\n return _timeSince(proof) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != msg.sender) revert SenderIncorrect();\n if (_timeSince(proof) \u003c= DISPUTE_PERIOD) revert DisputePeriodNotPassed();\n\n bridgeStatuses[transactionId] = 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, msg.sender, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeProofs[transactionId]) \u003e DISPUTE_PERIOD) revert DisputePeriodPassed();\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n delete bridgeProofs[transactionId];\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 BridgeTransaction memory transaction = getBridgeTransaction(request);\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 // set status to refunded if still in requested state\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = 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\n// test/FastBridgeMock.sol\n\ncontract FastBridgeMock is IFastBridge, Admin {\n // @dev 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 /// @dev to prevent replays\n uint256 public nonce;\n\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n // used for testing in go.\n // see: https://ethereum.stackexchange.com/questions/21155/how-to-expose-enum-in-solidity-contract\n // make sure to update fastbridge/status.go if this changes\n // or underliyng enum changes.\n //\n // TODO: a foundry test should be added to ensure this is always in sync.\n function getEnumKeyByValue(FastBridge.BridgeStatus keyValue) public pure returns (string memory) {\n if (FastBridge.BridgeStatus.NULL == keyValue) return \"NULL\";\n if (FastBridge.BridgeStatus.REQUESTED == keyValue) return \"REQUESTED\";\n if (FastBridge.BridgeStatus.RELAYER_PROVED == keyValue) return \"RELAYER_PROVED\";\n if (FastBridge.BridgeStatus.RELAYER_CLAIMED == keyValue) return \"RELAYER_CLAIMED\";\n if (FastBridge.BridgeStatus.REFUNDED == keyValue) return \"REFUNDED\";\n return \"\";\n }\n\n function mockBridgeRequest(bytes32 transactionId, address sender, BridgeParams memory params) external {\n uint256 originFeeAmount = (params.originAmount * protocolFeeRate) / FEE_BPS;\n params.originAmount -= originFeeAmount;\n\n bytes memory request = abi.encode(\n BridgeTransaction({\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: params.originAmount, // includes relayer fee\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n params.originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n function mockBridgeRequestRaw(bytes32 transactionId, address sender, bytes memory request) external {\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n emit BridgeRequested(\n transactionId,\n transaction.originSender,\n request,\n transaction.destChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n transaction.sendChainGas\n );\n }\n\n function mockBridgeRelayer(\n bytes32 transactionId,\n address relayer,\n address to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n )\n external\n {\n emit BridgeRelayed(\n transactionId, relayer, to, originChainId, originToken, destToken, originAmount, destAmount, chainGasAmount\n );\n }\n\n function bridge(BridgeParams memory params) external payable {\n revert(\"not implemented\");\n }\n\n function relay(bytes memory request) external payable {\n revert(\"not implemented\");\n }\n\n function prove(bytes memory request, bytes32 destTxHash) external {\n revert(\"not implemented\");\n }\n\n function canClaim(bytes32 transactionid, address relayer) external view returns (bool) {\n revert(\"not implemented\");\n }\n\n function claim(bytes memory request, address to) external {\n revert(\"not implemented\");\n }\n\n function dispute(bytes32 transactionId) external {\n revert(\"not implemented\");\n }\n\n function refund(bytes memory request) external {\n revert(\"not implemented\");\n }\n}\n","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","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.20+commit.a1b79de6\"},\"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/FastBridgeMock.sol\":\"ERC165\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeMock.sol\":{\"keccak256\":\"0xb58951ea9ccf93b597bddaa7b405278a10398c87bf748538ac7a67cd65184783\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://bb67eff4aa6731cbb158660257e9091bbc8135d228ceb240943772f9b5ada90e\",\"dweb:/ipfs/QmQbxcMCxtY5dWAJoPBpipMUjrN5zMvhQDCVkcMpRsn9LP\"]}},\"version\":1}"},"hashes":{"supportsInterface(bytes4)":"01ffc9a7"}},"solidity/FastBridgeMock.sol:EnumerableSet":{"code":"0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212202f269d118504dda82572144eb47e6cd8f57b1d550267c82258312e57d46f164664736f6c63430008140033","runtime-code":"0x73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212202f269d118504dda82572144eb47e6cd8f57b1d550267c82258312e57d46f164664736f6c63430008140033","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.20 ^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 pure 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/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// 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/FastBridge.sol\n\ncontract FastBridge is IFastBridge, Admin {\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 enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeStatus) public bridgeStatuses;\n /// @notice Proof of relayed bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeProof) public bridgeProofs;\n /// @notice Whether bridge has been relayed on destination chain\n mapping(bytes32 =\u003e bool) public bridgeRelays;\n\n /// @dev to prevent replays\n uint256 public nonce;\n // @dev 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 /// @notice Pulls a requested token from the user to the requested recipient.\n /// @dev Be careful of re-entrancy issues when msg.value \u003e 0 and recipient != address(this)\n function _pullToken(address recipient, address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token != UniversalTokenLib.ETH_ADDRESS) {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(recipient);\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, recipient, amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(recipient) - amountPulled;\n } else {\n // Otherwise, we need to check that ETH amount matches msg.value\n if (amount != msg.value) revert MsgValueIncorrect();\n // Transfer value to recipient if not this address\n if (recipient != address(this)) token.universalTransfer(recipient, amount);\n // We will forward msg.value in the external call later, if recipient is not this contract\n amountPulled = msg.value;\n }\n }\n\n /// @inheritdoc IFastBridge\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n // check bridge params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\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\n // transfer tokens to bridge contract\n // @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(address(this), 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 BridgeTransaction({\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 sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n\n // check haven't exceeded deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n\n // mark bridge transaction as relayed\n if (bridgeRelays[transactionId]) revert TransactionRelayed();\n bridgeRelays[transactionId] = true;\n\n // transfer tokens to recipient on destination chain and gas rebate if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n uint256 rebate = chainGasAmount;\n if (!transaction.sendChainGas) {\n // forward erc20\n rebate = 0;\n _pullToken(to, token, amount);\n } else if (token == UniversalTokenLib.ETH_ADDRESS) {\n // lump in gas rebate into amount in native gas token\n _pullToken(to, token, amount + rebate);\n } else {\n // forward erc20 then forward gas rebate in native gas token\n _pullToken(to, token, amount);\n _pullToken(to, UniversalTokenLib.ETH_ADDRESS, rebate);\n }\n\n emit BridgeRelayed(\n transactionId,\n msg.sender,\n to,\n transaction.originChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n rebate\n );\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n // update bridge tx status given proof provided\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = BridgeStatus.RELAYER_PROVED;\n bridgeProofs[transactionId] = BridgeProof({timestamp: uint96(block.timestamp), relayer: msg.sender}); // overflow ok\n\n emit BridgeProofProvided(transactionId, msg.sender, destTxHash);\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint96(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint96).max but\n /// proof.timestamp \u003c type(uint96).max via unchecked statement\n /// @param proof The bridge proof\n /// @return delta Time delta since proof submitted\n function _timeSince(BridgeProof memory proof) internal view returns (uint256 delta) {\n unchecked {\n delta = uint96(block.timestamp) - proof.timestamp;\n }\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != relayer) revert SenderIncorrect();\n return _timeSince(proof) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != msg.sender) revert SenderIncorrect();\n if (_timeSince(proof) \u003c= DISPUTE_PERIOD) revert DisputePeriodNotPassed();\n\n bridgeStatuses[transactionId] = 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, msg.sender, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeProofs[transactionId]) \u003e DISPUTE_PERIOD) revert DisputePeriodPassed();\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n delete bridgeProofs[transactionId];\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 BridgeTransaction memory transaction = getBridgeTransaction(request);\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 // set status to refunded if still in requested state\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = 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\n// test/FastBridgeMock.sol\n\ncontract FastBridgeMock is IFastBridge, Admin {\n // @dev 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 /// @dev to prevent replays\n uint256 public nonce;\n\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n // used for testing in go.\n // see: https://ethereum.stackexchange.com/questions/21155/how-to-expose-enum-in-solidity-contract\n // make sure to update fastbridge/status.go if this changes\n // or underliyng enum changes.\n //\n // TODO: a foundry test should be added to ensure this is always in sync.\n function getEnumKeyByValue(FastBridge.BridgeStatus keyValue) public pure returns (string memory) {\n if (FastBridge.BridgeStatus.NULL == keyValue) return \"NULL\";\n if (FastBridge.BridgeStatus.REQUESTED == keyValue) return \"REQUESTED\";\n if (FastBridge.BridgeStatus.RELAYER_PROVED == keyValue) return \"RELAYER_PROVED\";\n if (FastBridge.BridgeStatus.RELAYER_CLAIMED == keyValue) return \"RELAYER_CLAIMED\";\n if (FastBridge.BridgeStatus.REFUNDED == keyValue) return \"REFUNDED\";\n return \"\";\n }\n\n function mockBridgeRequest(bytes32 transactionId, address sender, BridgeParams memory params) external {\n uint256 originFeeAmount = (params.originAmount * protocolFeeRate) / FEE_BPS;\n params.originAmount -= originFeeAmount;\n\n bytes memory request = abi.encode(\n BridgeTransaction({\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: params.originAmount, // includes relayer fee\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n params.originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n function mockBridgeRequestRaw(bytes32 transactionId, address sender, bytes memory request) external {\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n emit BridgeRequested(\n transactionId,\n transaction.originSender,\n request,\n transaction.destChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n transaction.sendChainGas\n );\n }\n\n function mockBridgeRelayer(\n bytes32 transactionId,\n address relayer,\n address to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n )\n external\n {\n emit BridgeRelayed(\n transactionId, relayer, to, originChainId, originToken, destToken, originAmount, destAmount, chainGasAmount\n );\n }\n\n function bridge(BridgeParams memory params) external payable {\n revert(\"not implemented\");\n }\n\n function relay(bytes memory request) external payable {\n revert(\"not implemented\");\n }\n\n function prove(bytes memory request, bytes32 destTxHash) external {\n revert(\"not implemented\");\n }\n\n function canClaim(bytes32 transactionid, address relayer) external view returns (bool) {\n revert(\"not implemented\");\n }\n\n function claim(bytes memory request, address to) external {\n revert(\"not implemented\");\n }\n\n function dispute(bytes32 transactionId) external {\n revert(\"not implemented\");\n }\n\n function refund(bytes memory request) external {\n revert(\"not implemented\");\n }\n}\n","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","compilerOptions":"--combined-json bin,bin-runtime,srcmap,srcmap-runtime,abi,userdoc,devdoc,metadata,hashes --optimize --optimize-runs 10000 --allow-paths ., ./, ../ --evm-version=istanbul","srcMap":"24861:11640:0:-:0;;;;;;;;;;;;;;;-1:-1:-1;;;24861:11640:0;;;;;;;;;;;;;;;;;","srcMapRuntime":"24861: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.20+commit.a1b79de6\"},\"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/FastBridgeMock.sol\":\"EnumerableSet\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeMock.sol\":{\"keccak256\":\"0xb58951ea9ccf93b597bddaa7b405278a10398c87bf748538ac7a67cd65184783\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://bb67eff4aa6731cbb158660257e9091bbc8135d228ceb240943772f9b5ada90e\",\"dweb:/ipfs/QmQbxcMCxtY5dWAJoPBpipMUjrN5zMvhQDCVkcMpRsn9LP\"]}},\"version\":1}"},"hashes":{}},"solidity/FastBridgeMock.sol:FastBridge":{"code":"0x60a06040523480156200001157600080fd5b5060405162002d7a38038062002d7a833981016040819052620000349162000194565b80620000426000826200004f565b50504360805250620001bf565b6000806200005e84846200008c565b90508015620000835760008481526001602052604090206200008190846200013a565b505b90505b92915050565b6000828152602081815260408083206001600160a01b038516845290915281205460ff1662000131576000838152602081815260408083206001600160a01b03861684529091529020805460ff19166001179055620000e83390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a450600162000086565b50600062000086565b600062000083836001600160a01b0384166000818152600183016020526040812054620001315750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915562000086565b600060208284031215620001a757600080fd5b81516001600160a01b03811681146200008357600080fd5b608051612b9f620001db60003960006106510152612b9f6000f3fe60806040526004361061026a5760003560e01c80639010d07c11610153578063add98c70116100cb578063ca15c8731161007f578063d547741f11610064578063d547741f146107a1578063dcf844a7146107c1578063e00a83e0146107ee57600080fd5b8063ca15c8731461074d578063ccc574901461076d57600080fd5b8063b13aa2d6116100b0578063b13aa2d6146106f6578063b250fe6b14610716578063bf333f2c1461073657600080fd5b8063add98c70146106c0578063affed0e0146106e057600080fd5b8063a217fddf11610122578063a5bbe22b11610107578063a5bbe22b1461047f578063aa9641ab14610673578063ac11fb1a1461069357600080fd5b8063a217fddf1461062a578063a3ec191a1461063f57600080fd5b80639010d07c146104f857806391ad50391461053057806391d14854146105b2578063926d7d7f146105f657600080fd5b806341fcb612116101e65780635eb7d946116101b55780638379a24f1161019a5780638379a24f14610495578063886d36ff146104c55780638f0d6f17146104e557600080fd5b80635eb7d9461461045f578063820688d51461047f57600080fd5b806341fcb612146103e2578063458516941461040257806358f85880146104155780635960ccf21461042b57600080fd5b80630f5f6ed71161023d578063248a9ca311610222578063248a9ca3146103725780632f2ff15d146103a257806336568abe146103c257600080fd5b80630f5f6ed714610345578063190da5951461035b57600080fd5b806301ffc9a71461026f57806303ed0ee5146102a4578063051287bc146102e657806306f333f214610323575b600080fd5b34801561027b57600080fd5b5061028f61028a3660046122fc565b610804565b60405190151581526020015b60405180910390f35b3480156102b057600080fd5b506102d87f043c983c49d46f0e102151eaf8085d4a2e6571d5df2d47b013f39bddfd4a639d81565b60405190815260200161029b565b3480156102f257600080fd5b5061031661030136600461233e565b60056020526000908152604090205460ff1681565b60405161029b9190612386565b34801561032f57600080fd5b5061034361033e3660046123ec565b610860565b005b34801561035157600080fd5b506102d861271081565b34801561036757600080fd5b506102d862093a8081565b34801561037e57600080fd5b506102d861038d36600461233e565b60009081526020819052604090206001015490565b3480156103ae57600080fd5b506103436103bd366004612425565b610927565b3480156103ce57600080fd5b506103436103dd366004612425565b610952565b3480156103ee57600080fd5b506103436103fd366004612572565b61099e565b6103436104103660046125ef565b610bd7565b34801561042157600080fd5b506102d860025481565b34801561043757600080fd5b506102d87fdb9556138406326f00296e13ea2ad7db24ba82381212d816b1a40c23b466b32781565b34801561046b57600080fd5b5061034361047a366004612692565b610ee5565b34801561048b57600080fd5b506102d861070881565b3480156104a157600080fd5b5061028f6104b036600461233e565b60076020526000908152604090205460ff1681565b3480156104d157600080fd5b506103436104e03660046126cf565b6110bd565b6103436104f3366004612692565b6111f0565b34801561050457600080fd5b50610518610513366004612714565b611437565b6040516001600160a01b03909116815260200161029b565b34801561053c57600080fd5b5061058661054b36600461233e565b6006602052600090815260409020546bffffffffffffffffffffffff8116906c0100000000000000000000000090046001600160a01b031682565b604080516bffffffffffffffffffffffff90931683526001600160a01b0390911660208301520161029b565b3480156105be57600080fd5b5061028f6105cd366004612425565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b34801561060257600080fd5b506102d87fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc481565b34801561063657600080fd5b506102d8600081565b34801561064b57600080fd5b506102d87f000000000000000000000000000000000000000000000000000000000000000081565b34801561067f57600080fd5b5061028f61068e366004612425565b611456565b34801561069f57600080fd5b506106b36106ae366004612692565b611559565b60405161029b9190612736565b3480156106cc57600080fd5b506103436106db36600461233e565b6115cc565b3480156106ec57600080fd5b506102d860085481565b34801561070257600080fd5b5061034361071136600461233e565b611735565b34801561072257600080fd5b5061034361073136600461233e565b611817565b34801561074257600080fd5b506102d8620f424081565b34801561075957600080fd5b506102d861076836600461233e565b61187f565b34801561077957600080fd5b506102d87f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5581565b3480156107ad57600080fd5b506103436107bc366004612425565b611896565b3480156107cd57600080fd5b506102d86107dc36600461281c565b60036020526000908152604090205481565b3480156107fa57600080fd5b506102d860045481565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f5a05180f00000000000000000000000000000000000000000000000000000000148061085a575061085a826118bb565b92915050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5561088a81611952565b6001600160a01b038316600090815260036020526040812054908190036108b15750505050565b6001600160a01b0384166000818152600360205260408120556108d590848361195f565b604080516001600160a01b038087168252851660208201529081018290527f244e51bc38c1452fa8aaf487bcb4bca36c2baa3a5fbdb776b1eabd8dc6d277cd9060600160405180910390a1505b505050565b60008281526020819052604090206001015461094281611952565b61094c8383611a82565b50505050565b6001600160a01b0381163314610994576040517f6697b23200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6109228282611ab7565b7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc46109c881611952565b8251602084012060006109da85611559565b9050600260008381526005602052604090205460ff166004811115610a0157610a01612357565b14610a38576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000828152600660209081526040918290208251808401909352546bffffffffffffffffffffffff811683526c0100000000000000000000000090046001600160a01b03169082018190523314610abb576040517f4af43a9000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80516107089042036bffffffffffffffffffffffff1611610b08576040517f1992d0bd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000838152600560205260409020805460ff1916600317905561010082015115610b645761010082015160808301516001600160a01b031660009081526003602052604081208054909190610b5e908490612868565b90915550505b608082015160c0830151610b826001600160a01b038316888361195f565b604080516001600160a01b03848116825260208201849052891691339188917f582211c35a2139ac3bbaac74663c6a1f56c6cbb658b41fe11fd45a82074ac67891015b60405180910390a45050505050505050565b46816000015163ffffffff1603610c1a576040517f7029fdf900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60a08101511580610c2d575060c0810151155b15610c64576040517fe38820c800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60608101516001600160a01b03161580610c89575060808101516001600160a01b0316155b15610cc0576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610ccc61070842612868565b8161010001511015610d0a576040517f04b7fcc800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000610d1f3083606001518460a00151611ae4565b90506000806002541115610d4c57620f424060025483610d3f919061287b565b610d499190612892565b90505b610d5681836128cd565b915060006040518061018001604052804663ffffffff168152602001856000015163ffffffff16815260200185602001516001600160a01b0316815260200185604001516001600160a01b0316815260200185606001516001600160a01b0316815260200185608001516001600160a01b031681526020018481526020018560c0015181526020018381526020018560e0015115158152602001856101000151815260200160086000815480929190610e0e906128e0565b909155509052604051610e249190602001612736565b604080518083037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0018152828252805160208083019190912060008181526005835293909320805460ff191660011790558701518751606089015160808a015160c08b015160e08c015195985095966001600160a01b039094169587957f120ea0364f36cdac7983bcfdd55270ca09d7f9b314a2ebc425a3b01ab1d6403a95610ed6958b959094909390928e9261293c565b60405180910390a35050505050565b805160208201206000610ef783611559565b3360009081527fd2043bf65931af3dbecf60d0db8f40e4160406d7beb00522f4200cf4944a1eb8602052604090205490915060ff1615610f74578061014001514211610f6f576040517fe15ff9ea00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610fc0565b62093a80816101400151610f889190612868565b4211610fc0576040517fe15ff9ea00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600160008381526005602052604090205460ff166004811115610fe557610fe5612357565b1461101c576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600082815260056020526040808220805460ff19166004179055820151608083015161010084015160c0850151929391926110579190612868565b905061106d6001600160a01b038316848361195f565b604080516001600160a01b0384811682526020820184905285169187917fb4c55c0c9bc613519b920e88748090150b890a875d307f21bea7d4fb2e8bc958910160405180910390a3505050505050565b7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc46110e781611952565b82516020840120600160008281526005602052604090205460ff16600481111561111357611113612357565b1461114a576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008181526005602090815260408083208054600260ff19909116179055805180820182526bffffffffffffffffffffffff4281168252338285018181528787526006865295849020925195516001600160a01b03166c0100000000000000000000000002959091169490941790555185815283917f4ac8af8a2cd87193d64dfc7a3b8d9923b714ec528b18725d080aa1299be0c5e4910160405180910390a350505050565b7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc461121a81611952565b81516020830120600061122c84611559565b90504663ffffffff16816020015163ffffffff1614611277576040517f7029fdf900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8061014001514211156112b6576040517f559895a300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008281526007602052604090205460ff16156112ff576040517fbef7bb7d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000828152600760205260409020805460ff19166001179055606081015160a082015160e083015160045461012085015161134857506000611342848484611ae4565b506113b9565b7fffffffffffffffffffffffff11111111111111111111111111111111111111126001600160a01b0384160161138c5761134284846113878486612868565b611ae4565b611397848484611ae4565b506113b78473eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee83611ae4565b505b845160808087015160a08089015160c0808b015160e08c01516040805163ffffffff90991689526001600160a01b0396871660208a0152938616938801939093526060870152938501528301849052861691339189917ff8ae392d784b1ea5e8881bfa586d81abf07ef4f1e2fc75f7fe51c90f05199a5c9101610bc5565b600082815260016020526040812061144f9083611cb3565b9392505050565b6000600260008481526005602052604090205460ff16600481111561147d5761147d612357565b146114b4576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000838152600660209081526040918290208251808401909352546bffffffffffffffffffffffff811683526001600160a01b036c01000000000000000000000000909104811691830182905284161461153a576040517f4af43a9000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80516107089042036bffffffffffffffffffffffff1611949350505050565b604080516101808101825260008082526020808301829052928201819052606082018190526080820181905260a0820181905260c0820181905260e082018190526101008201819052610120820181905261014082018190526101608201528251909161085a91840181019084016129ed565b7f043c983c49d46f0e102151eaf8085d4a2e6571d5df2d47b013f39bddfd4a639d6115f681611952565b600260008381526005602052604090205460ff16600481111561161b5761161b612357565b14611652576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000828152600660209081526040918290208251808401909352546bffffffffffffffffffffffff8082168085526c010000000000000000000000009092046001600160a01b031693909201929092526107089142031611156116e1576040517f3e908aac00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000828152600560209081526040808320805460ff19166001179055600690915280822082905551339184917f0695cf1d39b3055dcd0fe02d8b47eaf0d5a13e1996de925de59d0ef9b7f7fad49190a35050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5561175f81611952565b6127108211156117d0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f6e657746656552617465203e206d61780000000000000000000000000000000060448201526064015b60405180910390fd5b600280549083905560408051828152602081018590527f14914da2bf76024616fbe1859783fcd4dbddcb179b1f3a854949fbf920dcb95791015b60405180910390a1505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5561184181611952565b600480549083905560408051828152602081018590527f5cf09b12f3f56b4c564d51b25b40360af6d795198adb61ae0806a36c294323fa910161180a565b600081815260016020526040812061085a90611cbf565b6000828152602081905260409020600101546118b181611952565b61094c8383611ab7565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061085a57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff0000000000000000000000000000000000000000000000000000000083161461085a565b61195c8133611cc9565b50565b306001600160a01b0383160361197457505050565b8060000361198157505050565b7fffffffffffffffffffffffff11111111111111111111111111111111111111126001600160a01b03841601611a6e576000826001600160a01b03168260405160006040518083038185875af1925050503d80600081146119fe576040519150601f19603f3d011682016040523d82523d6000602084013e611a03565b606091505b505090508061094c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f455448207472616e73666572206661696c65640000000000000000000000000060448201526064016117c7565b6109226001600160a01b0384168383611d39565b600080611a8f8484611dad565b9050801561144f576000848152600160205260409020611aaf9084611e57565b509392505050565b600080611ac48484611e6c565b9050801561144f576000848152600160205260409020611aaf9084611eef565b60006001600160a01b03831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14611c4d57611b1c836001600160a01b0316611f04565b6040517f70a082310000000000000000000000000000000000000000000000000000000081526001600160a01b0385811660048301528416906370a0823190602401602060405180830381865afa158015611b7b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b9f9190612ab9565b9050611bb66001600160a01b038416338685611faa565b6040517f70a082310000000000000000000000000000000000000000000000000000000081526001600160a01b0385811660048301528291908516906370a0823190602401602060405180830381865afa158015611c18573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c3c9190612ab9565b611c4691906128cd565b905061144f565b348214611c86576040517f81de0bf300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b0384163014611caa57611caa6001600160a01b038416858461195f565b50349392505050565b600061144f8383611fe3565b600061085a825490565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16611d35576040517fe2517d3f0000000000000000000000000000000000000000000000000000000081526001600160a01b0382166004820152602481018390526044016117c7565b5050565b6040516001600160a01b0383811660248301526044820183905261092291859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505061200d565b6000828152602081815260408083206001600160a01b038516845290915281205460ff16611e4f576000838152602081815260408083206001600160a01b03861684529091529020805460ff19166001179055611e073390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a450600161085a565b50600061085a565b600061144f836001600160a01b038416612089565b6000828152602081815260408083206001600160a01b038516845290915281205460ff1615611e4f576000838152602081815260408083206001600160a01b0386168085529252808320805460ff1916905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a450600161085a565b600061144f836001600160a01b0384166120d0565b7fffffffffffffffffffffffff11111111111111111111111111111111111111126001600160a01b03821601611f66576040517f7f523fe800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b806001600160a01b03163b60000361195c576040517f7f523fe800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040516001600160a01b03848116602483015283811660448301526064820183905261094c9186918216906323b872dd90608401611d66565b6000826000018281548110611ffa57611ffa612ad2565b9060005260206000200154905092915050565b60006120226001600160a01b038416836121c3565b905080516000141580156120475750808060200190518101906120459190612b01565b155b15610922576040517f5274afe70000000000000000000000000000000000000000000000000000000081526001600160a01b03841660048201526024016117c7565b6000818152600183016020526040812054611e4f5750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561085a565b600081815260018301602052604081205480156121b95760006120f46001836128cd565b8554909150600090612108906001906128cd565b905080821461216d57600086600001828154811061212857612128612ad2565b906000526020600020015490508087600001848154811061214b5761214b612ad2565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061217e5761217e612b1e565b60019003818190600052602060002001600090559055856001016000868152602001908152602001600020600090556001935050505061085a565b600091505061085a565b606061144f8383600084600080856001600160a01b031684866040516121e99190612b4d565b60006040518083038185875af1925050503d8060008114612226576040519150601f19603f3d011682016040523d82523d6000602084013e61222b565b606091505b509150915061223b868383612245565b9695505050505050565b60608261225a57612255826122ba565b61144f565b815115801561227157506001600160a01b0384163b155b156122b3576040517f9996b3150000000000000000000000000000000000000000000000000000000081526001600160a01b03851660048201526024016117c7565b508061144f565b8051156122ca5780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006020828403121561230e57600080fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811461144f57600080fd5b60006020828403121561235057600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b60208101600583106123c1577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b91905290565b6001600160a01b038116811461195c57600080fd5b80356123e7816123c7565b919050565b600080604083850312156123ff57600080fd5b823561240a816123c7565b9150602083013561241a816123c7565b809150509250929050565b6000806040838503121561243857600080fd5b82359150602083013561241a816123c7565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051610120810167ffffffffffffffff8111828210171561249d5761249d61244a565b60405290565b604051610180810167ffffffffffffffff8111828210171561249d5761249d61244a565b600082601f8301126124d857600080fd5b813567ffffffffffffffff808211156124f3576124f361244a565b604051601f83017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f011681019082821181831017156125395761253961244a565b8160405283815286602085880101111561255257600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000806040838503121561258557600080fd5b823567ffffffffffffffff81111561259c57600080fd5b6125a8858286016124c7565b925050602083013561241a816123c7565b63ffffffff8116811461195c57600080fd5b80356123e7816125b9565b801515811461195c57600080fd5b80356123e7816125d6565b6000610120828403121561260257600080fd5b61260a612479565b612613836125cb565b8152612621602084016123dc565b6020820152612632604084016123dc565b6040820152612643606084016123dc565b6060820152612654608084016123dc565b608082015260a083013560a082015260c083013560c082015261267960e084016125e4565b60e0820152610100928301359281019290925250919050565b6000602082840312156126a457600080fd5b813567ffffffffffffffff8111156126bb57600080fd5b6126c7848285016124c7565b949350505050565b600080604083850312156126e257600080fd5b823567ffffffffffffffff8111156126f957600080fd5b612705858286016124c7565b95602094909401359450505050565b6000806040838503121561272757600080fd5b50508035926020909101359150565b815163ffffffff1681526101808101602083015161275c602084018263ffffffff169052565b50604083015161277760408401826001600160a01b03169052565b50606083015161279260608401826001600160a01b03169052565b5060808301516127ad60808401826001600160a01b03169052565b5060a08301516127c860a08401826001600160a01b03169052565b5060c083015160c083015260e083015160e0830152610100808401518184015250610120808401516127fd8285018215159052565b5050610140838101519083015261016092830151929091019190915290565b60006020828403121561282e57600080fd5b813561144f816123c7565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8082018082111561085a5761085a612839565b808202811582820484141761085a5761085a612839565b6000826128c8577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b8181038181111561085a5761085a612839565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361291157612911612839565b5060010190565b60005b8381101561293357818101518382015260200161291b565b50506000910152565b60e08152600088518060e084015261010061295d8282860160208e01612918565b63ffffffff9990991660208401526001600160a01b039788166040840152959096166060820152608081019390935260a0830191909152151560c0820152601f9091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0160190910192915050565b80516123e7816125b9565b80516123e7816123c7565b80516123e7816125d6565b60006101808284031215612a0057600080fd5b612a086124a3565b612a11836129cc565b8152612a1f602084016129cc565b6020820152612a30604084016129d7565b6040820152612a41606084016129d7565b6060820152612a52608084016129d7565b6080820152612a6360a084016129d7565b60a082015260c083015160c082015260e083015160e0820152610100808401518183015250610120612a968185016129e2565b908201526101408381015190820152610160928301519281019290925250919050565b600060208284031215612acb57600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600060208284031215612b1357600080fd5b815161144f816125d6565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b60008251612b5f818460208701612918565b919091019291505056fea264697066735822122016de8ab3fbbf98dc7b8aefd2c1101a7e56e21e4cb0d5d346e4c36bff34ea738264736f6c63430008140033","runtime-code":"0x60806040526004361061026a5760003560e01c80639010d07c11610153578063add98c70116100cb578063ca15c8731161007f578063d547741f11610064578063d547741f146107a1578063dcf844a7146107c1578063e00a83e0146107ee57600080fd5b8063ca15c8731461074d578063ccc574901461076d57600080fd5b8063b13aa2d6116100b0578063b13aa2d6146106f6578063b250fe6b14610716578063bf333f2c1461073657600080fd5b8063add98c70146106c0578063affed0e0146106e057600080fd5b8063a217fddf11610122578063a5bbe22b11610107578063a5bbe22b1461047f578063aa9641ab14610673578063ac11fb1a1461069357600080fd5b8063a217fddf1461062a578063a3ec191a1461063f57600080fd5b80639010d07c146104f857806391ad50391461053057806391d14854146105b2578063926d7d7f146105f657600080fd5b806341fcb612116101e65780635eb7d946116101b55780638379a24f1161019a5780638379a24f14610495578063886d36ff146104c55780638f0d6f17146104e557600080fd5b80635eb7d9461461045f578063820688d51461047f57600080fd5b806341fcb612146103e2578063458516941461040257806358f85880146104155780635960ccf21461042b57600080fd5b80630f5f6ed71161023d578063248a9ca311610222578063248a9ca3146103725780632f2ff15d146103a257806336568abe146103c257600080fd5b80630f5f6ed714610345578063190da5951461035b57600080fd5b806301ffc9a71461026f57806303ed0ee5146102a4578063051287bc146102e657806306f333f214610323575b600080fd5b34801561027b57600080fd5b5061028f61028a3660046122fc565b610804565b60405190151581526020015b60405180910390f35b3480156102b057600080fd5b506102d87f043c983c49d46f0e102151eaf8085d4a2e6571d5df2d47b013f39bddfd4a639d81565b60405190815260200161029b565b3480156102f257600080fd5b5061031661030136600461233e565b60056020526000908152604090205460ff1681565b60405161029b9190612386565b34801561032f57600080fd5b5061034361033e3660046123ec565b610860565b005b34801561035157600080fd5b506102d861271081565b34801561036757600080fd5b506102d862093a8081565b34801561037e57600080fd5b506102d861038d36600461233e565b60009081526020819052604090206001015490565b3480156103ae57600080fd5b506103436103bd366004612425565b610927565b3480156103ce57600080fd5b506103436103dd366004612425565b610952565b3480156103ee57600080fd5b506103436103fd366004612572565b61099e565b6103436104103660046125ef565b610bd7565b34801561042157600080fd5b506102d860025481565b34801561043757600080fd5b506102d87fdb9556138406326f00296e13ea2ad7db24ba82381212d816b1a40c23b466b32781565b34801561046b57600080fd5b5061034361047a366004612692565b610ee5565b34801561048b57600080fd5b506102d861070881565b3480156104a157600080fd5b5061028f6104b036600461233e565b60076020526000908152604090205460ff1681565b3480156104d157600080fd5b506103436104e03660046126cf565b6110bd565b6103436104f3366004612692565b6111f0565b34801561050457600080fd5b50610518610513366004612714565b611437565b6040516001600160a01b03909116815260200161029b565b34801561053c57600080fd5b5061058661054b36600461233e565b6006602052600090815260409020546bffffffffffffffffffffffff8116906c0100000000000000000000000090046001600160a01b031682565b604080516bffffffffffffffffffffffff90931683526001600160a01b0390911660208301520161029b565b3480156105be57600080fd5b5061028f6105cd366004612425565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b34801561060257600080fd5b506102d87fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc481565b34801561063657600080fd5b506102d8600081565b34801561064b57600080fd5b506102d87f000000000000000000000000000000000000000000000000000000000000000081565b34801561067f57600080fd5b5061028f61068e366004612425565b611456565b34801561069f57600080fd5b506106b36106ae366004612692565b611559565b60405161029b9190612736565b3480156106cc57600080fd5b506103436106db36600461233e565b6115cc565b3480156106ec57600080fd5b506102d860085481565b34801561070257600080fd5b5061034361071136600461233e565b611735565b34801561072257600080fd5b5061034361073136600461233e565b611817565b34801561074257600080fd5b506102d8620f424081565b34801561075957600080fd5b506102d861076836600461233e565b61187f565b34801561077957600080fd5b506102d87f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5581565b3480156107ad57600080fd5b506103436107bc366004612425565b611896565b3480156107cd57600080fd5b506102d86107dc36600461281c565b60036020526000908152604090205481565b3480156107fa57600080fd5b506102d860045481565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f5a05180f00000000000000000000000000000000000000000000000000000000148061085a575061085a826118bb565b92915050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5561088a81611952565b6001600160a01b038316600090815260036020526040812054908190036108b15750505050565b6001600160a01b0384166000818152600360205260408120556108d590848361195f565b604080516001600160a01b038087168252851660208201529081018290527f244e51bc38c1452fa8aaf487bcb4bca36c2baa3a5fbdb776b1eabd8dc6d277cd9060600160405180910390a1505b505050565b60008281526020819052604090206001015461094281611952565b61094c8383611a82565b50505050565b6001600160a01b0381163314610994576040517f6697b23200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6109228282611ab7565b7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc46109c881611952565b8251602084012060006109da85611559565b9050600260008381526005602052604090205460ff166004811115610a0157610a01612357565b14610a38576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000828152600660209081526040918290208251808401909352546bffffffffffffffffffffffff811683526c0100000000000000000000000090046001600160a01b03169082018190523314610abb576040517f4af43a9000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80516107089042036bffffffffffffffffffffffff1611610b08576040517f1992d0bd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000838152600560205260409020805460ff1916600317905561010082015115610b645761010082015160808301516001600160a01b031660009081526003602052604081208054909190610b5e908490612868565b90915550505b608082015160c0830151610b826001600160a01b038316888361195f565b604080516001600160a01b03848116825260208201849052891691339188917f582211c35a2139ac3bbaac74663c6a1f56c6cbb658b41fe11fd45a82074ac67891015b60405180910390a45050505050505050565b46816000015163ffffffff1603610c1a576040517f7029fdf900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60a08101511580610c2d575060c0810151155b15610c64576040517fe38820c800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60608101516001600160a01b03161580610c89575060808101516001600160a01b0316155b15610cc0576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610ccc61070842612868565b8161010001511015610d0a576040517f04b7fcc800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000610d1f3083606001518460a00151611ae4565b90506000806002541115610d4c57620f424060025483610d3f919061287b565b610d499190612892565b90505b610d5681836128cd565b915060006040518061018001604052804663ffffffff168152602001856000015163ffffffff16815260200185602001516001600160a01b0316815260200185604001516001600160a01b0316815260200185606001516001600160a01b0316815260200185608001516001600160a01b031681526020018481526020018560c0015181526020018381526020018560e0015115158152602001856101000151815260200160086000815480929190610e0e906128e0565b909155509052604051610e249190602001612736565b604080518083037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0018152828252805160208083019190912060008181526005835293909320805460ff191660011790558701518751606089015160808a015160c08b015160e08c015195985095966001600160a01b039094169587957f120ea0364f36cdac7983bcfdd55270ca09d7f9b314a2ebc425a3b01ab1d6403a95610ed6958b959094909390928e9261293c565b60405180910390a35050505050565b805160208201206000610ef783611559565b3360009081527fd2043bf65931af3dbecf60d0db8f40e4160406d7beb00522f4200cf4944a1eb8602052604090205490915060ff1615610f74578061014001514211610f6f576040517fe15ff9ea00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610fc0565b62093a80816101400151610f889190612868565b4211610fc0576040517fe15ff9ea00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600160008381526005602052604090205460ff166004811115610fe557610fe5612357565b1461101c576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600082815260056020526040808220805460ff19166004179055820151608083015161010084015160c0850151929391926110579190612868565b905061106d6001600160a01b038316848361195f565b604080516001600160a01b0384811682526020820184905285169187917fb4c55c0c9bc613519b920e88748090150b890a875d307f21bea7d4fb2e8bc958910160405180910390a3505050505050565b7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc46110e781611952565b82516020840120600160008281526005602052604090205460ff16600481111561111357611113612357565b1461114a576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008181526005602090815260408083208054600260ff19909116179055805180820182526bffffffffffffffffffffffff4281168252338285018181528787526006865295849020925195516001600160a01b03166c0100000000000000000000000002959091169490941790555185815283917f4ac8af8a2cd87193d64dfc7a3b8d9923b714ec528b18725d080aa1299be0c5e4910160405180910390a350505050565b7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc461121a81611952565b81516020830120600061122c84611559565b90504663ffffffff16816020015163ffffffff1614611277576040517f7029fdf900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8061014001514211156112b6576040517f559895a300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008281526007602052604090205460ff16156112ff576040517fbef7bb7d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000828152600760205260409020805460ff19166001179055606081015160a082015160e083015160045461012085015161134857506000611342848484611ae4565b506113b9565b7fffffffffffffffffffffffff11111111111111111111111111111111111111126001600160a01b0384160161138c5761134284846113878486612868565b611ae4565b611397848484611ae4565b506113b78473eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee83611ae4565b505b845160808087015160a08089015160c0808b015160e08c01516040805163ffffffff90991689526001600160a01b0396871660208a0152938616938801939093526060870152938501528301849052861691339189917ff8ae392d784b1ea5e8881bfa586d81abf07ef4f1e2fc75f7fe51c90f05199a5c9101610bc5565b600082815260016020526040812061144f9083611cb3565b9392505050565b6000600260008481526005602052604090205460ff16600481111561147d5761147d612357565b146114b4576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000838152600660209081526040918290208251808401909352546bffffffffffffffffffffffff811683526001600160a01b036c01000000000000000000000000909104811691830182905284161461153a576040517f4af43a9000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80516107089042036bffffffffffffffffffffffff1611949350505050565b604080516101808101825260008082526020808301829052928201819052606082018190526080820181905260a0820181905260c0820181905260e082018190526101008201819052610120820181905261014082018190526101608201528251909161085a91840181019084016129ed565b7f043c983c49d46f0e102151eaf8085d4a2e6571d5df2d47b013f39bddfd4a639d6115f681611952565b600260008381526005602052604090205460ff16600481111561161b5761161b612357565b14611652576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000828152600660209081526040918290208251808401909352546bffffffffffffffffffffffff8082168085526c010000000000000000000000009092046001600160a01b031693909201929092526107089142031611156116e1576040517f3e908aac00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000828152600560209081526040808320805460ff19166001179055600690915280822082905551339184917f0695cf1d39b3055dcd0fe02d8b47eaf0d5a13e1996de925de59d0ef9b7f7fad49190a35050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5561175f81611952565b6127108211156117d0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f6e657746656552617465203e206d61780000000000000000000000000000000060448201526064015b60405180910390fd5b600280549083905560408051828152602081018590527f14914da2bf76024616fbe1859783fcd4dbddcb179b1f3a854949fbf920dcb95791015b60405180910390a1505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5561184181611952565b600480549083905560408051828152602081018590527f5cf09b12f3f56b4c564d51b25b40360af6d795198adb61ae0806a36c294323fa910161180a565b600081815260016020526040812061085a90611cbf565b6000828152602081905260409020600101546118b181611952565b61094c8383611ab7565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061085a57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff0000000000000000000000000000000000000000000000000000000083161461085a565b61195c8133611cc9565b50565b306001600160a01b0383160361197457505050565b8060000361198157505050565b7fffffffffffffffffffffffff11111111111111111111111111111111111111126001600160a01b03841601611a6e576000826001600160a01b03168260405160006040518083038185875af1925050503d80600081146119fe576040519150601f19603f3d011682016040523d82523d6000602084013e611a03565b606091505b505090508061094c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f455448207472616e73666572206661696c65640000000000000000000000000060448201526064016117c7565b6109226001600160a01b0384168383611d39565b600080611a8f8484611dad565b9050801561144f576000848152600160205260409020611aaf9084611e57565b509392505050565b600080611ac48484611e6c565b9050801561144f576000848152600160205260409020611aaf9084611eef565b60006001600160a01b03831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14611c4d57611b1c836001600160a01b0316611f04565b6040517f70a082310000000000000000000000000000000000000000000000000000000081526001600160a01b0385811660048301528416906370a0823190602401602060405180830381865afa158015611b7b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b9f9190612ab9565b9050611bb66001600160a01b038416338685611faa565b6040517f70a082310000000000000000000000000000000000000000000000000000000081526001600160a01b0385811660048301528291908516906370a0823190602401602060405180830381865afa158015611c18573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c3c9190612ab9565b611c4691906128cd565b905061144f565b348214611c86576040517f81de0bf300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b0384163014611caa57611caa6001600160a01b038416858461195f565b50349392505050565b600061144f8383611fe3565b600061085a825490565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16611d35576040517fe2517d3f0000000000000000000000000000000000000000000000000000000081526001600160a01b0382166004820152602481018390526044016117c7565b5050565b6040516001600160a01b0383811660248301526044820183905261092291859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505061200d565b6000828152602081815260408083206001600160a01b038516845290915281205460ff16611e4f576000838152602081815260408083206001600160a01b03861684529091529020805460ff19166001179055611e073390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a450600161085a565b50600061085a565b600061144f836001600160a01b038416612089565b6000828152602081815260408083206001600160a01b038516845290915281205460ff1615611e4f576000838152602081815260408083206001600160a01b0386168085529252808320805460ff1916905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a450600161085a565b600061144f836001600160a01b0384166120d0565b7fffffffffffffffffffffffff11111111111111111111111111111111111111126001600160a01b03821601611f66576040517f7f523fe800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b806001600160a01b03163b60000361195c576040517f7f523fe800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040516001600160a01b03848116602483015283811660448301526064820183905261094c9186918216906323b872dd90608401611d66565b6000826000018281548110611ffa57611ffa612ad2565b9060005260206000200154905092915050565b60006120226001600160a01b038416836121c3565b905080516000141580156120475750808060200190518101906120459190612b01565b155b15610922576040517f5274afe70000000000000000000000000000000000000000000000000000000081526001600160a01b03841660048201526024016117c7565b6000818152600183016020526040812054611e4f5750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561085a565b600081815260018301602052604081205480156121b95760006120f46001836128cd565b8554909150600090612108906001906128cd565b905080821461216d57600086600001828154811061212857612128612ad2565b906000526020600020015490508087600001848154811061214b5761214b612ad2565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061217e5761217e612b1e565b60019003818190600052602060002001600090559055856001016000868152602001908152602001600020600090556001935050505061085a565b600091505061085a565b606061144f8383600084600080856001600160a01b031684866040516121e99190612b4d565b60006040518083038185875af1925050503d8060008114612226576040519150601f19603f3d011682016040523d82523d6000602084013e61222b565b606091505b509150915061223b868383612245565b9695505050505050565b60608261225a57612255826122ba565b61144f565b815115801561227157506001600160a01b0384163b155b156122b3576040517f9996b3150000000000000000000000000000000000000000000000000000000081526001600160a01b03851660048201526024016117c7565b508061144f565b8051156122ca5780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006020828403121561230e57600080fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811461144f57600080fd5b60006020828403121561235057600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b60208101600583106123c1577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b91905290565b6001600160a01b038116811461195c57600080fd5b80356123e7816123c7565b919050565b600080604083850312156123ff57600080fd5b823561240a816123c7565b9150602083013561241a816123c7565b809150509250929050565b6000806040838503121561243857600080fd5b82359150602083013561241a816123c7565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051610120810167ffffffffffffffff8111828210171561249d5761249d61244a565b60405290565b604051610180810167ffffffffffffffff8111828210171561249d5761249d61244a565b600082601f8301126124d857600080fd5b813567ffffffffffffffff808211156124f3576124f361244a565b604051601f83017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f011681019082821181831017156125395761253961244a565b8160405283815286602085880101111561255257600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000806040838503121561258557600080fd5b823567ffffffffffffffff81111561259c57600080fd5b6125a8858286016124c7565b925050602083013561241a816123c7565b63ffffffff8116811461195c57600080fd5b80356123e7816125b9565b801515811461195c57600080fd5b80356123e7816125d6565b6000610120828403121561260257600080fd5b61260a612479565b612613836125cb565b8152612621602084016123dc565b6020820152612632604084016123dc565b6040820152612643606084016123dc565b6060820152612654608084016123dc565b608082015260a083013560a082015260c083013560c082015261267960e084016125e4565b60e0820152610100928301359281019290925250919050565b6000602082840312156126a457600080fd5b813567ffffffffffffffff8111156126bb57600080fd5b6126c7848285016124c7565b949350505050565b600080604083850312156126e257600080fd5b823567ffffffffffffffff8111156126f957600080fd5b612705858286016124c7565b95602094909401359450505050565b6000806040838503121561272757600080fd5b50508035926020909101359150565b815163ffffffff1681526101808101602083015161275c602084018263ffffffff169052565b50604083015161277760408401826001600160a01b03169052565b50606083015161279260608401826001600160a01b03169052565b5060808301516127ad60808401826001600160a01b03169052565b5060a08301516127c860a08401826001600160a01b03169052565b5060c083015160c083015260e083015160e0830152610100808401518184015250610120808401516127fd8285018215159052565b5050610140838101519083015261016092830151929091019190915290565b60006020828403121561282e57600080fd5b813561144f816123c7565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8082018082111561085a5761085a612839565b808202811582820484141761085a5761085a612839565b6000826128c8577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b8181038181111561085a5761085a612839565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361291157612911612839565b5060010190565b60005b8381101561293357818101518382015260200161291b565b50506000910152565b60e08152600088518060e084015261010061295d8282860160208e01612918565b63ffffffff9990991660208401526001600160a01b039788166040840152959096166060820152608081019390935260a0830191909152151560c0820152601f9091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0160190910192915050565b80516123e7816125b9565b80516123e7816123c7565b80516123e7816125d6565b60006101808284031215612a0057600080fd5b612a086124a3565b612a11836129cc565b8152612a1f602084016129cc565b6020820152612a30604084016129d7565b6040820152612a41606084016129d7565b6060820152612a52608084016129d7565b6080820152612a6360a084016129d7565b60a082015260c083015160c082015260e083015160e0820152610100808401518183015250610120612a968185016129e2565b908201526101408381015190820152610160928301519281019290925250919050565b600060208284031215612acb57600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600060208284031215612b1357600080fd5b815161144f816125d6565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b60008251612b5f818460208701612918565b919091019291505056fea264697066735822122016de8ab3fbbf98dc7b8aefd2c1101a7e56e21e4cb0d5d346e4c36bff34ea738264736f6c63430008140033","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.20 ^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 pure 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/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// 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/FastBridge.sol\n\ncontract FastBridge is IFastBridge, Admin {\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 enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeStatus) public bridgeStatuses;\n /// @notice Proof of relayed bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeProof) public bridgeProofs;\n /// @notice Whether bridge has been relayed on destination chain\n mapping(bytes32 =\u003e bool) public bridgeRelays;\n\n /// @dev to prevent replays\n uint256 public nonce;\n // @dev 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 /// @notice Pulls a requested token from the user to the requested recipient.\n /// @dev Be careful of re-entrancy issues when msg.value \u003e 0 and recipient != address(this)\n function _pullToken(address recipient, address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token != UniversalTokenLib.ETH_ADDRESS) {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(recipient);\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, recipient, amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(recipient) - amountPulled;\n } else {\n // Otherwise, we need to check that ETH amount matches msg.value\n if (amount != msg.value) revert MsgValueIncorrect();\n // Transfer value to recipient if not this address\n if (recipient != address(this)) token.universalTransfer(recipient, amount);\n // We will forward msg.value in the external call later, if recipient is not this contract\n amountPulled = msg.value;\n }\n }\n\n /// @inheritdoc IFastBridge\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n // check bridge params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\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\n // transfer tokens to bridge contract\n // @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(address(this), 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 BridgeTransaction({\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 sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n\n // check haven't exceeded deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n\n // mark bridge transaction as relayed\n if (bridgeRelays[transactionId]) revert TransactionRelayed();\n bridgeRelays[transactionId] = true;\n\n // transfer tokens to recipient on destination chain and gas rebate if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n uint256 rebate = chainGasAmount;\n if (!transaction.sendChainGas) {\n // forward erc20\n rebate = 0;\n _pullToken(to, token, amount);\n } else if (token == UniversalTokenLib.ETH_ADDRESS) {\n // lump in gas rebate into amount in native gas token\n _pullToken(to, token, amount + rebate);\n } else {\n // forward erc20 then forward gas rebate in native gas token\n _pullToken(to, token, amount);\n _pullToken(to, UniversalTokenLib.ETH_ADDRESS, rebate);\n }\n\n emit BridgeRelayed(\n transactionId,\n msg.sender,\n to,\n transaction.originChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n rebate\n );\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n // update bridge tx status given proof provided\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = BridgeStatus.RELAYER_PROVED;\n bridgeProofs[transactionId] = BridgeProof({timestamp: uint96(block.timestamp), relayer: msg.sender}); // overflow ok\n\n emit BridgeProofProvided(transactionId, msg.sender, destTxHash);\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint96(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint96).max but\n /// proof.timestamp \u003c type(uint96).max via unchecked statement\n /// @param proof The bridge proof\n /// @return delta Time delta since proof submitted\n function _timeSince(BridgeProof memory proof) internal view returns (uint256 delta) {\n unchecked {\n delta = uint96(block.timestamp) - proof.timestamp;\n }\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != relayer) revert SenderIncorrect();\n return _timeSince(proof) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != msg.sender) revert SenderIncorrect();\n if (_timeSince(proof) \u003c= DISPUTE_PERIOD) revert DisputePeriodNotPassed();\n\n bridgeStatuses[transactionId] = 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, msg.sender, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeProofs[transactionId]) \u003e DISPUTE_PERIOD) revert DisputePeriodPassed();\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n delete bridgeProofs[transactionId];\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 BridgeTransaction memory transaction = getBridgeTransaction(request);\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 // set status to refunded if still in requested state\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = 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\n// test/FastBridgeMock.sol\n\ncontract FastBridgeMock is IFastBridge, Admin {\n // @dev 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 /// @dev to prevent replays\n uint256 public nonce;\n\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n // used for testing in go.\n // see: https://ethereum.stackexchange.com/questions/21155/how-to-expose-enum-in-solidity-contract\n // make sure to update fastbridge/status.go if this changes\n // or underliyng enum changes.\n //\n // TODO: a foundry test should be added to ensure this is always in sync.\n function getEnumKeyByValue(FastBridge.BridgeStatus keyValue) public pure returns (string memory) {\n if (FastBridge.BridgeStatus.NULL == keyValue) return \"NULL\";\n if (FastBridge.BridgeStatus.REQUESTED == keyValue) return \"REQUESTED\";\n if (FastBridge.BridgeStatus.RELAYER_PROVED == keyValue) return \"RELAYER_PROVED\";\n if (FastBridge.BridgeStatus.RELAYER_CLAIMED == keyValue) return \"RELAYER_CLAIMED\";\n if (FastBridge.BridgeStatus.REFUNDED == keyValue) return \"REFUNDED\";\n return \"\";\n }\n\n function mockBridgeRequest(bytes32 transactionId, address sender, BridgeParams memory params) external {\n uint256 originFeeAmount = (params.originAmount * protocolFeeRate) / FEE_BPS;\n params.originAmount -= originFeeAmount;\n\n bytes memory request = abi.encode(\n BridgeTransaction({\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: params.originAmount, // includes relayer fee\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n params.originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n function mockBridgeRequestRaw(bytes32 transactionId, address sender, bytes memory request) external {\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n emit BridgeRequested(\n transactionId,\n transaction.originSender,\n request,\n transaction.destChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n transaction.sendChainGas\n );\n }\n\n function mockBridgeRelayer(\n bytes32 transactionId,\n address relayer,\n address to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n )\n external\n {\n emit BridgeRelayed(\n transactionId, relayer, to, originChainId, originToken, destToken, originAmount, destAmount, chainGasAmount\n );\n }\n\n function bridge(BridgeParams memory params) external payable {\n revert(\"not implemented\");\n }\n\n function relay(bytes memory request) external payable {\n revert(\"not implemented\");\n }\n\n function prove(bytes memory request, bytes32 destTxHash) external {\n revert(\"not implemented\");\n }\n\n function canClaim(bytes32 transactionid, address relayer) external view returns (bool) {\n revert(\"not implemented\");\n }\n\n function claim(bytes memory request, address to) external {\n revert(\"not implemented\");\n }\n\n function dispute(bytes32 transactionId) external {\n revert(\"not implemented\");\n }\n\n function refund(bytes memory request) external {\n revert(\"not implemented\");\n }\n}\n","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","compilerOptions":"--combined-json bin,bin-runtime,srcmap,srcmap-runtime,abi,userdoc,devdoc,metadata,hashes --optimize --optimize-runs 10000 --allow-paths ., ./, ../ --evm-version=istanbul","srcMap":"58196:11304:0:-:0;;;59371:85;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;59405:6;57187:38;46359:4;59405:6;57187:10;:38::i;:::-;-1:-1:-1;;59437:12:0::1;59423:26;::::0;-1:-1:-1;58196:11304:0;;55672:257;55758:4;;55789:31;55806:4;55812:7;55789:16;:31::i;:::-;55774:46;;55834:7;55830:69;;;55857:18;;;;:12;:18;;;;;:31;;55880:7;55857:22;:31::i;:::-;;55830:69;55915:7;-1:-1:-1;55672:257:0;;;;;:::o;50306:316::-;50383:4;47081:12;;;;;;;;;;;-1:-1:-1;;;;;47081:29:0;;;;;;;;;;;;50399:217;;50442:6;:12;;;;;;;;;;;-1:-1:-1;;;;;50442:29:0;;;;;;;;;:36;;-1:-1:-1;;50442:36:0;50474:4;50442:36;;;50524:12;22402:10;;22323:96;50524:12;-1:-1:-1;;;;;50497:40:0;50515:7;-1:-1:-1;;;;;50497:40:0;50509:4;50497:40;;;;;;;;;;-1:-1:-1;50558:4:0;50551:11;;50399:217;-1:-1:-1;50600:5:0;50593:12;;31847:150;31917:4;31940:50;31945:3;-1:-1:-1;;;;;31965:23:0;;25835:4;27891:21;;;:14;;;:21;;;;;;25851:321;;-1:-1:-1;25893:23:0;;;;;;;;:11;:23;;;;;;;;;;;;;26075:18;;26051:21;;;:14;;;:21;;;;;;:42;;;;26107: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;58196:11304:0;;;;;;;;;;;;","srcMapRuntime":"58196:11304:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;54332:212;;;;;;;;;;-1:-1:-1;54332:212:0;;;;;:::i;:::-;;:::i;:::-;;;612:14:1;;605:22;587:41;;575:2;560:18;54332:212:0;;;;;;;;56562:60;;;;;;;;;;;;56599:23;56562:60;;;;;785:25:1;;;773:2;758:18;56562:60:0;639:177:1;58923:54:0;;;;;;;;;;-1:-1:-1;58923:54:0;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;:::i;57534:359::-;;;;;;;;;;-1:-1:-1;57534:359:0;;;;;:::i;:::-;;:::i;:::-;;56744:45;;;;;;;;;;;;56783:6;56744:45;;58521;;;;;;;;;;;;58560:6;58521:45;;47937:120;;;;;;;;;;-1:-1:-1;47937:120:0;;;;;:::i;:::-;48002:7;48028:12;;;;;;;;;;:22;;;;47937:120;48353:136;;;;;;;;;;-1:-1:-1;48353:136:0;;;;;:::i;:::-;;:::i;49455:245::-;;;;;;;;;;-1:-1:-1;49455:245:0;;;;;:::i;:::-;;:::i;66598:1146::-;;;;;;;;;;-1:-1:-1;66598:1146:0;;;;;:::i;:::-;;:::i;61056:2114::-;;;;;;:::i;:::-;;:::i;56906:30::-;;;;;;;;;;;;;;;;56490:66;;;;;;;;;;;;56530:26;56490:66;;68345:1153;;;;;;;;;;-1:-1:-1;68345:1153:0;;;;;:::i;:::-;;:::i;58653:56::-;;;;;;;;;;;;58699:10;58653:56;;59168:44;;;;;;;;;;-1:-1:-1;59168:44:0;;;;;:::i;:::-;;;;;;;;;;;;;;;;64964:567;;;;;;;;;;-1:-1:-1;64964:567:0;;;;;:::i;:::-;;:::i;63208:1718::-;;;;;;:::i;:::-;;:::i;55129:142::-;;;;;;;;;;-1:-1:-1;55129:142:0;;;;;:::i;:::-;;:::i;:::-;;;-1:-1:-1;;;;;7391:55:1;;;7373:74;;7361:2;7346:18;55129:142:0;7227:226:1;59042:51:0;;;;;;;;;;-1:-1:-1;59042:51:0;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;59042:51:0;;;;;;;7660:26:1;7648:39;;;7630:58;;-1:-1:-1;;;;;7724:55:1;;;7719:2;7704:18;;7697:83;7603:18;59042:51:0;7458:328:1;46981:136:0;;;;;;;;;;-1:-1:-1;46981:136:0;;;;;:::i;:::-;47058:4;47081:12;;;;;;;;;;;-1:-1:-1;;;;;47081:29:0;;;;;;;;;;;;;;;46981:136;56420:64;;;;;;;;;;;;56459:25;56420:64;;46314:49;;;;;;;;;;-1:-1:-1;46314:49:0;46359:4;46314:49;;59328:36;;;;;;;;;;;;;;;66187:373;;;;;;;;;;-1:-1:-1;66187:373:0;;;;;:::i;:::-;;:::i;60855:163::-;;;;;;;;;;-1:-1:-1;60855:163:0;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;67782:525::-;;;;;;;;;;-1:-1:-1;67782:525:0;;;;;:::i;:::-;;:::i;59251:20::-;;;;;;;;;;;;;;;;57238:290;;;;;;;;;;-1:-1:-1;57238:290:0;;;;;:::i;:::-;;:::i;57899:264::-;;;;;;;;;;-1:-1:-1;57899:264:0;;;;;:::i;:::-;;:::i;56701:37::-;;;;;;;;;;;;56735:3;56701:37;;55439:131;;;;;;;;;;-1:-1:-1;55439:131:0;;;;;:::i;:::-;;:::i;56628:66::-;;;;;;;;;;;;56668:26;56628:66;;48769:138;;;;;;;;;;-1:-1:-1;48769:138:0;;;;;:::i;:::-;;:::i;56992:47::-;;;;;;;;;;-1:-1:-1;56992:47:0;;;;;:::i;:::-;;;;;;;;;;;;;;57113:29;;;;;;;;;;;;;;;;54332:212;54417:4;54440:57;;;54455:42;54440:57;;:97;;;54501:36;54525:11;54501:23;:36::i;:::-;54433:104;54332:212;-1:-1:-1;;54332:212:0:o;57534:359::-;56668:26;46591:16;46602:4;46591:10;:16::i;:::-;-1:-1:-1;;;;;57658:19:0;::::1;57638:17;57658:19:::0;;;:12:::1;:19;::::0;;;;;;57691:14;;;57687:27:::1;;57707:7;57534:359:::0;;;:::o;57687:27::-:1;-1:-1:-1::0;;;;;57755:19:0;::::1;57777:1;57755:19:::0;;;:12:::1;:19;::::0;;;;:23;57788:45:::1;::::0;57812:9;57823;57788:23:::1;:45::i;:::-;57848:38;::::0;;-1:-1:-1;;;;;9986:15:1;;;9968:34;;10038:15;;10033:2;10018:18;;10011:43;10070:18;;;10063:34;;;57848:38:0::1;::::0;9895:2:1;9880:18;57848:38:0::1;;;;;;;57628:265;46617:1;57534:359:::0;;;:::o;48353:136::-;48002:7;48028:12;;;;;;;;;;:22;;;46591:16;46602:4;46591:10;:16::i;:::-;48457:25:::1;48468:4;48474:7;48457:10;:25::i;:::-;;48353:136:::0;;;:::o;49455:245::-;-1:-1:-1;;;;;49548:34:0;;22402:10;49548:34;49544:102;;49605:30;;;;;;;;;;;;;;49544:102;49656:37;49668:4;49674:18;49656:11;:37::i;66598:1146::-;56459:25;46591:16;46602:4;46591:10;:16::i;:::-;66713:18;;::::1;::::0;::::1;::::0;66689:21:::1;66780:29;66723:7:::0;66780:20:::1;:29::i;:::-;66741:68:::0;-1:-1:-1;66927:27:0::1;66894:29;::::0;;;:14:::1;:29;::::0;;;;;::::1;;:60;::::0;::::1;;;;;;:::i;:::-;;66890:90;;66963:17;;;;;;;;;;;;;;66890:90;66991:24;67018:27:::0;;;:12:::1;:27;::::0;;;;;;;;66991:54;;;;::::1;::::0;;;;::::1;::::0;::::1;::::0;;;;::::1;-1:-1:-1::0;;;;;66991:54:0::1;::::0;;::::1;::::0;;;67076:10:::1;67059:27;67055:57;;67095:17;;;;;;;;;;;;;;67055:57;66117:15:::0;;58415:10:::1;::::0;66098:15;66091:41;66083:49;;67126:35:::1;67122:72;;67170:24;;;;;;;;;;;;;;67122:72;67205:29;::::0;;;:14:::1;:29;::::0;;;;:60;;-1:-1:-1;;67205:60:0::1;67237:28;67205:60;::::0;;67340:27:::1;::::0;::::1;::::0;:31;67336:105:::1;;67414:27;::::0;::::1;::::0;67386:23:::1;::::0;::::1;::::0;-1:-1:-1;;;;;67373:37:0::1;;::::0;;;:12:::1;:37;::::0;;;;:68;;:37;;;:68:::1;::::0;67414:27;;67373:68:::1;:::i;:::-;::::0;;;-1:-1:-1;;67336:105:0::1;67536:23;::::0;::::1;::::0;67586:24:::1;::::0;::::1;::::0;67620:35:::1;-1:-1:-1::0;;;;;67620:23:0;::::1;67644:2:::0;67586:24;67620:23:::1;:35::i;:::-;67671:66;::::0;;-1:-1:-1;;;;;10619:55:1;;;10601:74;;10706:2;10691:18;;10684:34;;;67671:66:0;::::1;::::0;67707:10:::1;::::0;67692:13;;67671:66:::1;::::0;10574:18:1;67671:66:0::1;;;;;;;;66679:1065;;;;;66598:1146:::0;;;:::o;61056:2114::-;61183:13;61162:6;:17;;;:34;;;61158:63;;61205:16;;;;;;;;;;;;;;61158:63;61235:19;;;;:24;;:50;;-1:-1:-1;61263:17:0;;;;:22;61235:50;61231:80;;;61294:17;;;;;;;;;;;;;;61231:80;61325:18;;;;-1:-1:-1;;;;;61325:32:0;;;:66;;-1:-1:-1;61361:16:0;;;;-1:-1:-1;;;;;61361:30:0;;61325:66;61321:92;;;61400:13;;;;;;;;;;;;;;61321:92;61445:37;58699:10;61445:15;:37;:::i;:::-;61427:6;:15;;;:55;61423:86;;;61491:18;;;;;;;;;;;;;;61423:86;61644:20;61667:66;61686:4;61693:6;:18;;;61713:6;:19;;;61667:10;:66::i;:::-;61644:89;;61801:23;61856:1;61838:15;;:19;61834:85;;;56735:3;61893:15;;61878:12;:30;;;;:::i;:::-;61877:42;;;;:::i;:::-;61859:60;;61834:85;61929:31;61945:15;61929:31;;:::i;:::-;;;62073:20;62120:618;;;;;;;;62178:13;62120:618;;;;;;62223:6;:17;;;62120:618;;;;;;62272:6;:13;;;-1:-1:-1;;;;;62120:618:0;;;;;62318:6;:9;;;-1:-1:-1;;;;;62120:618:0;;;;;62358:6;:18;;;-1:-1:-1;;;;;62120:618:0;;;;;62405:6;:16;;;-1:-1:-1;;;;;62120:618:0;;;;;62453:12;62120:618;;;;62495:6;:17;;;62120:618;;;;62547:15;62120:618;;;;62594:6;:19;;;62120:618;;;;;;62641:6;:15;;;62120:618;;;;62681:5;;:7;;;;;;;;;:::i;:::-;;;;-1:-1:-1;62120:618:0;;62096:652;;;;;;;;:::i;:::-;;;;;;;;;;;;;;62782:18;;62096:652;62782:18;;;;;;;62758:21;62810:29;;;:14;:29;;;;;;:54;;-1:-1:-1;;62810:54:0;62842:22;62810:54;;;62936:13;;;62984:17;;63015:18;;;;63047:16;;;;63103:17;;;;63134:19;;;;62096:652;;-1:-1:-1;62782:18:0;;-1:-1:-1;;;;;62880:283:0;;;;62782:18;;62880:283;;;;62096:652;;62984:17;;63015:18;;63047:16;;63077:12;;62880:283;:::i;:::-;;;;;;;;61117:2053;;;;61056:2114;:::o;68345:1153::-;68426:18;;;;;;68402:21;68493:29;68436:7;68493:20;:29::i;:::-;68560:10;47058:4;47081:29;;;:12;;:29;:12;:29;;;68454:68;;-1:-1:-1;47081:29:0;;68533:382;;;68668:11;:20;;;68649:15;:39;68645:73;;68697:21;;;;;;;;;;;;;;68645:73;68533:382;;;58560:6;68839:11;:20;;;:35;;;;:::i;:::-;68820:15;:54;68816:88;;68883:21;;;;;;;;;;;;;;68816:88;69024:22;68991:29;;;;:14;:29;;;;;;;;:55;;;;;;;;:::i;:::-;;68987:85;;69055:17;;;;;;;;;;;;;;68987:85;69082:29;;;;:14;:29;;;;;;:53;;-1:-1:-1;;69082:53:0;69114:21;69082:53;;;69221:24;;;69271:23;;;;69348:27;;;;69321:24;;;;69221;;69271:23;;69321:54;;69348:27;69321:54;:::i;:::-;69304:71;-1:-1:-1;69385:35:0;-1:-1:-1;;;;;69385:23:0;;69409:2;69304:71;69385:23;:35::i;:::-;69436:55;;;-1:-1:-1;;;;;10619:55:1;;;10601:74;;10706:2;10691:18;;10684:34;;;69436:55:0;;;69458:13;;69436:55;;10574:18:1;69436:55:0;;;;;;;68392:1106;;;;;68345:1153;:::o;64964:567::-;56459:25;46591:16;46602:4;46591:10;:16::i;:::-;65087:18;;::::1;::::0;::::1;::::0;65208:22:::1;65175:29;::::0;;;:14:::1;:29;::::0;;;;;::::1;;:55;::::0;::::1;;;;;;:::i;:::-;;65171:85;;65239:17;;;;;;;;;;;;;;65171:85;65266:29;::::0;;;:14:::1;:29;::::0;;;;;;;:59;;65298:27:::1;-1:-1:-1::0;;65266:59:0;;::::1;;::::0;;65365:70;;;;::::1;::::0;;::::1;65396:15;65365:70:::0;::::1;::::0;;65423:10:::1;65365:70:::0;;::::1;::::0;;;65335:27;;;:12:::1;:27:::0;;;;;;:100;;;;-1:-1:-1;;;;;65335:100:0::1;::::0;::::1;::::0;;;::::1;::::0;;;::::1;::::0;;65466:58;785:25:1;;;65266:29:0;;65466:58:::1;::::0;758:18:1;65466:58:0::1;;;;;;;65053:478;64964:567:::0;;;:::o;63208:1718::-;56459:25;46591:16;46602:4;46591:10;:16::i;:::-;63319:18;;::::1;::::0;::::1;::::0;63295:21:::1;63386:29;63329:7:::0;63386:20:::1;:29::i;:::-;63347:68;;63463:13;63429:48;;:11;:23;;;:48;;;63425:77;;63486:16;;;;;;;;;;;;;;63425:77;63598:11;:20;;;63580:15;:38;63576:69;;;63627:18;;;;;;;;;;;;;;63576:69;63706:27;::::0;;;:12:::1;:27;::::0;;;;;::::1;;63702:60;;;63742:20;;;;;;;;;;;;;;63702:60;63772:27;::::0;;;:12:::1;:27;::::0;;;;:34;;-1:-1:-1;;63772:34:0::1;63802:4;63772:34;::::0;;63919:25:::1;::::0;::::1;::::0;63970:21:::1;::::0;::::1;::::0;64018:22:::1;::::0;::::1;::::0;64068:14:::1;::::0;64097:24:::1;::::0;::::1;::::0;64092:517:::1;;-1:-1:-1::0;64175:1:0::1;64190:29;64201:2:::0;64205:5;64212:6;64190:10:::1;:29::i;:::-;;64092:517;;;64240:38:::0;-1:-1:-1;;;;;64240:38:0;::::1;::::0;64236:373:::1;;64360:38;64371:2:::0;64375:5;64382:15:::1;64391:6:::0;64382;:15:::1;:::i;:::-;64360:10;:38::i;64236:373::-;64502:29;64513:2;64517:5;64524:6;64502:10;:29::i;:::-;;64545:53;64556:2;51321:42;64591:6;64545:10;:53::i;:::-;;64236:373;64718:25:::0;;64757:23:::1;::::0;;::::1;::::0;64794:21:::1;::::0;;::::1;::::0;64829:24:::1;::::0;;::::1;::::0;64867:22:::1;::::0;::::1;::::0;64624:295:::1;::::0;;13103:10:1;13091:23;;;13073:42;;-1:-1:-1;;;;;13212:15:1;;;13207:2;13192:18;;13185:43;13264:15;;;13244:18;;;13237:43;;;;13311:2;13296:18;;13289:34;13339:19;;;13332:35;13383:19;;13376:35;;;64624:295:0;::::1;::::0;64678:10:::1;::::0;64651:13;;64624:295:::1;::::0;13045:19:1;64624:295:0::1;12788:629:1::0;55129:142:0;55210:7;55236:18;;;:12;:18;;;;;:28;;55258:5;55236:21;:28::i;:::-;55229:35;55129:142;-1:-1:-1;;;55129:142:0:o;66187:373::-;66268:4;66321:27;66288:29;;;;:14;:29;;;;;;;;:60;;;;;;;;:::i;:::-;;66284:90;;66357:17;;;;;;;;;;;;;;66284:90;66384:24;66411:27;;;:12;:27;;;;;;;;;66384:54;;;;;;;;;;;;;;-1:-1:-1;;;;;66384:54:0;;;;;;;;;;;;66452:24;;;66448:54;;66485:17;;;;;;;;;;;;;;66448:54;66117:15;;58415:10;;66098:15;66091:41;66083:49;;66519:34;;66187:373;-1:-1:-1;;;;66187:373:0:o;60855:163::-;-1:-1:-1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;60971:40:0;;-1:-1:-1;;60971:40:0;;;;;;;;;;:::i;67782:525::-;56599:23;46591:16;46602:4;46591:10;:16::i;:::-;67899:27:::1;67866:29;::::0;;;:14:::1;:29;::::0;;;;;::::1;;:60;::::0;::::1;;;;;;:::i;:::-;;67862:90;;67935:17;;;;;;;;;;;;;;67862:90;67977:27;::::0;;;:12:::1;:27;::::0;;;;;;;;67966:39;;;;::::1;::::0;;;;::::1;::::0;;::::1;::::0;;;;;;::::1;-1:-1:-1::0;;;;;67966:39:0::1;::::0;;;::::1;::::0;;;;58415:10:::1;::::0;66098:15;66091:41;66083:49;67966:56:::1;67962:90;;;68031:21;;;;;;;;;;;;;;67962:90;68140:29;::::0;;;:14:::1;:29;::::0;;;;;;;:54;;-1:-1:-1;;68140:54:0::1;68172:22;68140:54;::::0;;68211:12:::1;:27:::0;;;;;;68204:34;;;68254:46;68289:10:::1;::::0;68140:29;;68254:46:::1;::::0;68140:29;68254:46:::1;67782:525:::0;;:::o;57238:290::-;56668:26;46591:16;46602:4;46591:10;:16::i;:::-;56783:6:::1;57337:10;:26;;57329:55;;;::::0;::::1;::::0;;15233:2:1;57329:55:0::1;::::0;::::1;15215:21:1::0;15272:2;15252:18;;;15245:30;15311:18;15291;;;15284:46;15347:18;;57329:55:0::1;;;;;;;;;57415:15;::::0;;57440:28;;;;57483:38:::1;::::0;;15550:25:1;;;15606:2;15591:18;;15584:34;;;57483:38:0::1;::::0;15523:18:1;57483:38:0::1;;;;;;;;57319:209;57238:290:::0;;:::o;57899:264::-;56668:26;46591:16;46602:4;46591:10;:16::i;:::-;58024:14:::1;::::0;;58048:34;;;;58097:59:::1;::::0;;15550:25:1;;;15606:2;15591:18;;15584:34;;;58097:59:0::1;::::0;15523:18:1;58097:59:0::1;15376:248:1::0;55439:131:0;55510:7;55536:18;;;:12;:18;;;;;:27;;:25;:27::i;48769:138::-;48002:7;48028:12;;;;;;;;;;:22;;;46591:16;46602:4;46591:10;:16::i;:::-;48874:26:::1;48886:4;48892:7;48874:11;:26::i;46692:202::-:0;46777:4;46800:47;;;46815:32;46800:47;;:87;;-1:-1:-1;38607:25:0;38592:40;;;;46851:36;38493:146;47326:103;47392:30;47403:4;22402:10;47392;:30::i;:::-;47326:103;:::o;51604:653::-;51779:4;-1:-1:-1;;;;;51765:19:0;;;51761:32;;51604:653;;;:::o;51761:32::-;51865:5;51874:1;51865:10;51861:23;;51604:653;;;:::o;51861:23::-;51897:20;-1:-1:-1;;;;;51897:20:0;;;51893:358;;52077:12;52094:2;-1:-1:-1;;;;;52094:7:0;52109:5;52094:25;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;52076:43;;;52141:7;52133:39;;;;;;;16041:2:1;52133:39:0;;;16023:21:1;16080:2;16060:18;;;16053:30;16119:21;16099:18;;;16092:49;16158:18;;52133:39:0;15839:343:1;51893:358:0;52203:37;-1:-1:-1;;;;;52203:26:0;;52230:2;52234:5;52203:26;:37::i;55672:257::-;55758:4;55774:12;55789:31;55806:4;55812:7;55789:16;:31::i;:::-;55774:46;;55834:7;55830:69;;;55857:18;;;;:12;:18;;;;;:31;;55880:7;55857:22;:31::i;:::-;;55915:7;55672:257;-1:-1:-1;;;55672:257:0:o;56032:262::-;56119:4;56135:12;56150:32;56168:4;56174:7;56150:17;:32::i;:::-;56135:47;;56196:7;56192:72;;;56219:18;;;;:12;:18;;;;;:34;;56245:7;56219:25;:34::i;59640:1177::-;59728:20;-1:-1:-1;;;;;59764:38:0;;51321:42;59764:38;59760:1051;;59818:24;:5;-1:-1:-1;;;;;59818:22:0;;:24::i;:::-;59923:34;;;;;-1:-1:-1;;;;;7391:55:1;;;59923:34:0;;;7373:74:1;59923:23:0;;;;;7346:18:1;;59923:34:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;59908:49;-1:-1:-1;60103:61:0;-1:-1:-1;;;;;60103:30:0;;60134:10;60146:9;60157:6;60103:30;:61::i;:::-;60300:34;;;;;-1:-1:-1;;;;;7391:55:1;;;60300:34:0;;;7373:74:1;60337:12:0;;60300:23;;;;;;7346:18:1;;60300:34:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;:49;;;;:::i;:::-;60285:64;;59760:1051;;;60471:9;60461:6;:19;60457:51;;60489:19;;;;;;;;;;;;;;60457:51;-1:-1:-1;;;;;60589:26:0;;60610:4;60589:26;60585:74;;60617:42;-1:-1:-1;;;;;60617:23:0;;60641:9;60652:6;60617:23;:42::i;:::-;-1:-1:-1;60791:9:0;59640:1177;;;;;:::o;33105:156::-;33179:7;33229:22;33233:3;33245:5;33229:3;:22::i;32648:115::-;32711:7;32737:19;32745:3;28087:18;;28005:107;47559:197;47058:4;47081:12;;;;;;;;;;;-1:-1:-1;;;;;47081:29:0;;;;;;;;;;;;47642:108;;47692:47;;;;;-1:-1:-1;;;;;10619:55:1;;47692:47:0;;;10601:74:1;10691:18;;;10684:34;;;10574:18;;47692:47:0;10427:297:1;47642:108:0;47559:197;;:::o;39809:160::-;39918:43;;-1:-1:-1;;;;;10619:55:1;;;39918:43:0;;;10601:74:1;10691:18;;;10684:34;;;39891:71:0;;39911:5;;39933:14;;;;;10574:18:1;;39918:43:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;39891:19;:71::i;50306:316::-;50383:4;47081:12;;;;;;;;;;;-1:-1:-1;;;;;47081:29:0;;;;;;;;;;;;50399:217;;50442:6;:12;;;;;;;;;;;-1:-1:-1;;;;;50442:29:0;;;;;;;;;:36;;-1:-1:-1;;50442:36:0;50474:4;50442:36;;;50524:12;22402:10;;22323:96;50524:12;-1:-1:-1;;;;;50497:40:0;50515:7;-1:-1:-1;;;;;50497:40:0;50509:4;50497:40;;;;;;;;;;-1:-1:-1;50558:4:0;50551:11;;50399:217;-1:-1:-1;50600:5:0;50593:12;;31847:150;31917:4;31940:50;31945:3;-1:-1:-1;;;;;31965:23:0;;31940:4;:50::i;50857:317::-;50935:4;47081:12;;;;;;;;;;;-1:-1:-1;;;;;47081:29:0;;;;;;;;;;;;50951:217;;;51025:5;50993:12;;;;;;;;;;;-1:-1:-1;;;;;50993:29:0;;;;;;;;;;:37;;-1:-1:-1;;50993:37:0;;;51049:40;22402:10;;50993:12;;51049:40;;51025:5;51049:40;-1:-1:-1;51110:4:0;51103:11;;32165:156;32238:4;32261:53;32269:3;-1:-1:-1;;;;;32289:23:0;;32261:7;:53::i;53421:344::-;53588:38;-1:-1:-1;;;;;53588:38:0;;;53584:69;;53635:18;;;;;;;;;;;;;;53584:69;53709:5;-1:-1:-1;;;;;53709:17:0;;53730:1;53709:22;53705:53;;53740:18;;;;;;;;;;;;;;40208:188;40335:53;;-1:-1:-1;;;;;9986:15:1;;;40335:53:0;;;9968:34:1;10038:15;;;10018:18;;;10011:43;10070:18;;;10063:34;;;40308:81:0;;40328:5;;40350:18;;;;;9880::1;;40335:53:0;9705:398:1;28454:118:0;28521:7;28547:3;:11;;28559:5;28547:18;;;;;;;;:::i;:::-;;;;;;;;;28540:25;;28454:118;;;;:::o;42565:629::-;42984:23;43010:33;-1:-1:-1;;;;;43010:27:0;;43038:4;43010:27;:33::i;:::-;42984:59;;43057:10;:17;43078:1;43057:22;;:57;;;;;43095:10;43084:30;;;;;;;;;;;;:::i;:::-;43083:31;43057:57;43053:135;;;43137:40;;;;;-1:-1:-1;;;;;7391:55:1;;43137:40:0;;;7373:74:1;7346:18;;43137:40:0;7227:226:1;25772:406:0;25835:4;27891:21;;;:14;;;:21;;;;;;25851:321;;-1:-1:-1;25893:23:0;;;;;;;;:11;:23;;;;;;;;;;;;;26075:18;;26051:21;;;:14;;;:21;;;;;;:42;;;;26107:11;;26346:1368;26412:4;26541:21;;;:14;;;:21;;;;;;26577:13;;26573:1135;;26944:18;26965:12;26976:1;26965:8;:12;:::i;:::-;27011:18;;26944:33;;-1:-1:-1;26991:17:0;;27011:22;;27032:1;;27011:22;:::i;:::-;26991:42;;27066:9;27052:10;:23;27048:378;;27095:17;27115:3;:11;;27127:9;27115:22;;;;;;;;:::i;:::-;;;;;;;;;27095:42;;27262:9;27236:3;:11;;27248:10;27236:23;;;;;;;;:::i;:::-;;;;;;;;;;;;:35;;;;27375:25;;;:14;;;:25;;;;;:36;;;27048:378;27504:17;;:3;;:17;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;27607:3;:14;;:21;27622:5;27607:21;;;;;;;;;;;27600:28;;;27650:4;27643:11;;;;;;;26573:1135;27692:5;27685:12;;;;;18108:151;18183:12;18214:38;18236:6;18244:4;18250:1;18183:12;18824;18838:23;18865:6;-1:-1:-1;;;;;18865:11:0;18884:5;18891:4;18865:31;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;18823:73;;;;18913:55;18940:6;18948:7;18957:10;18913:26;:55::i;:::-;18906:62;18583:392;-1:-1:-1;;;;;;18583:392:0:o;20028:582::-;20172:12;20201:7;20196:408;;20224:19;20232:10;20224:7;:19::i;:::-;20196:408;;;20448:17;;:22;:49;;;;-1:-1:-1;;;;;;20474:18:0;;;:23;20448:49;20444:119;;;20524:24;;;;;-1:-1:-1;;;;;7391:55:1;;20524:24:0;;;7373:74:1;7346:18;;20524:24:0;7227:226:1;20444:119:0;-1:-1:-1;20583:10:0;20576:17;;21146:516;21277:17;;:21;21273:383;;21505:10;21499:17;21561:15;21548:10;21544:2;21540:19;21533:44;21273:383;21628: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:402;1344:2;1329:18;;1377:1;1366:13;;1356:201;;1413:77;1410:1;1403:88;1514:4;1511:1;1504:15;1542:4;1539:1;1532:15;1356:201;1566:25;;;1195:402;:::o;1602:154::-;-1:-1:-1;;;;;1681:5:1;1677:54;1670:5;1667:65;1657:93;;1746:1;1743;1736:12;1761:134;1829:20;;1858:31;1829:20;1858:31;:::i;:::-;1761:134;;;:::o;1900:388::-;1968:6;1976;2029:2;2017:9;2008:7;2004:23;2000:32;1997:52;;;2045:1;2042;2035:12;1997:52;2084:9;2071:23;2103:31;2128:5;2103:31;:::i;:::-;2153:5;-1:-1:-1;2210:2:1;2195:18;;2182:32;2223:33;2182:32;2223:33;:::i;:::-;2275:7;2265:17;;;1900:388;;;;;:::o;2475:315::-;2543:6;2551;2604:2;2592:9;2583:7;2579:23;2575:32;2572:52;;;2620:1;2617;2610:12;2572:52;2656:9;2643:23;2633:33;;2716:2;2705:9;2701:18;2688:32;2729:31;2754:5;2729:31;:::i;2795:184::-;2847:77;2844:1;2837:88;2944:4;2941:1;2934:15;2968:4;2965:1;2958:15;2984:252;3056:2;3050:9;3098:3;3086:16;;3132:18;3117:34;;3153:22;;;3114:62;3111:88;;;3179:18;;:::i;:::-;3215:2;3208:22;2984:252;:::o;3241:247::-;3308:2;3302:9;3350:3;3338:16;;3384:18;3369:34;;3405:22;;;3366:62;3363:88;;;3431:18;;:::i;3493:777::-;3535:5;3588:3;3581:4;3573:6;3569:17;3565:27;3555:55;;3606:1;3603;3596:12;3555:55;3642:6;3629:20;3668:18;3705:2;3701;3698:10;3695:36;;;3711:18;;:::i;:::-;3845:2;3839:9;3907:4;3899:13;;3750:66;3895:22;;;3919:2;3891:31;3887:40;3875:53;;;3943:18;;;3963:22;;;3940:46;3937:72;;;3989:18;;:::i;:::-;4029:10;4025:2;4018:22;4064:2;4056:6;4049:18;4110:3;4103:4;4098:2;4090:6;4086:15;4082:26;4079:35;4076:55;;;4127:1;4124;4117:12;4076:55;4191:2;4184:4;4176:6;4172:17;4165:4;4157:6;4153:17;4140:54;4238:1;4231:4;4226:2;4218:6;4214:15;4210:26;4203:37;4258:6;4249:15;;;;;;3493:777;;;;:::o;4275:455::-;4352:6;4360;4413:2;4401:9;4392:7;4388:23;4384:32;4381:52;;;4429:1;4426;4419:12;4381:52;4469:9;4456:23;4502:18;4494:6;4491:30;4488:50;;;4534:1;4531;4524:12;4488:50;4557:49;4598:7;4589:6;4578:9;4574:22;4557:49;:::i;:::-;4547:59;;;4656:2;4645:9;4641:18;4628:32;4669:31;4694:5;4669:31;:::i;4735:121::-;4820:10;4813:5;4809:22;4802:5;4799:33;4789:61;;4846:1;4843;4836:12;4861:132;4928:20;;4957:30;4928:20;4957:30;:::i;4998:118::-;5084:5;5077:13;5070:21;5063:5;5060:32;5050:60;;5106:1;5103;5096:12;5121:128;5186:20;;5215:28;5186:20;5215:28;:::i;5254:865::-;5342:6;5395:3;5383:9;5374:7;5370:23;5366:33;5363:53;;;5412:1;5409;5402:12;5363:53;5438:22;;:::i;:::-;5483:28;5501:9;5483:28;:::i;:::-;5476:5;5469:43;5544:38;5578:2;5567:9;5563:18;5544:38;:::i;:::-;5539:2;5532:5;5528:14;5521:62;5615:38;5649:2;5638:9;5634:18;5615:38;:::i;:::-;5610:2;5603:5;5599:14;5592:62;5686:38;5720:2;5709:9;5705:18;5686:38;:::i;:::-;5681:2;5674:5;5670:14;5663:62;5758:39;5792:3;5781:9;5777:19;5758:39;:::i;:::-;5752:3;5745:5;5741:15;5734:64;5859:3;5848:9;5844:19;5831:33;5825:3;5818:5;5814:15;5807:58;5926:3;5915:9;5911:19;5898:33;5892:3;5885:5;5881:15;5874:58;5965:36;5996:3;5985:9;5981:19;5965:36;:::i;:::-;5959:3;5948:15;;5941:61;6021:3;6069:18;;;6056:32;6040:14;;;6033:56;;;;-1:-1:-1;5952:5:1;5254:865;-1:-1:-1;5254:865:1:o;6124:320::-;6192:6;6245:2;6233:9;6224:7;6220:23;6216:32;6213:52;;;6261:1;6258;6251:12;6213:52;6301:9;6288:23;6334:18;6326:6;6323:30;6320:50;;;6366:1;6363;6356:12;6320:50;6389:49;6430:7;6421:6;6410:9;6406:22;6389:49;:::i;:::-;6379:59;6124:320;-1:-1:-1;;;;6124:320:1:o;6449:388::-;6526:6;6534;6587:2;6575:9;6566:7;6562:23;6558:32;6555:52;;;6603:1;6600;6593:12;6555:52;6643:9;6630:23;6676:18;6668:6;6665:30;6662:50;;;6708:1;6705;6698:12;6662:50;6731:49;6772:7;6763:6;6752:9;6748:22;6731:49;:::i;:::-;6721:59;6827:2;6812:18;;;;6799:32;;-1:-1:-1;;;;6449:388:1:o;6842:248::-;6910:6;6918;6971:2;6959:9;6950:7;6946:23;6942:32;6939:52;;;6987:1;6984;6977:12;6939:52;-1:-1:-1;;7010:23:1;;;7080:2;7065:18;;;7052:32;;-1:-1:-1;6842:248:1:o;7890:1373::-;8121:13;;7867:10;7856:22;7844:35;;8090:3;8075:19;;8193:4;8185:6;8181:17;8175:24;8208:53;8255:4;8244:9;8240:20;8226:12;7867:10;7856:22;7844:35;;7791:94;8208:53;;8310:4;8302:6;8298:17;8292:24;8325:56;8375:4;8364:9;8360:20;8344:14;-1:-1:-1;;;;;7161:54:1;7149:67;;7095:127;8325:56;;8430:4;8422:6;8418:17;8412:24;8445:56;8495:4;8484:9;8480:20;8464:14;-1:-1:-1;;;;;7161:54:1;7149:67;;7095:127;8445:56;;8550:4;8542:6;8538:17;8532:24;8565:56;8615:4;8604:9;8600:20;8584:14;-1:-1:-1;;;;;7161:54:1;7149:67;;7095:127;8565:56;;8670:4;8662:6;8658:17;8652:24;8685:56;8735:4;8724:9;8720:20;8704:14;-1:-1:-1;;;;;7161:54:1;7149:67;;7095:127;8685:56;;8797:4;8789:6;8785:17;8779:24;8772:4;8761:9;8757:20;8750:54;8860:4;8852:6;8848:17;8842:24;8835:4;8824:9;8820:20;8813:54;8886:6;8946:2;8938:6;8934:15;8928:22;8923:2;8912:9;8908:18;8901:50;;8970:6;9025:2;9017:6;9013:15;9007:22;9038:51;9085:2;9074:9;9070:18;9054:14;421:13;414:21;402:34;;351:91;9038:51;-1:-1:-1;;9108:6:1;9156:15;;;9150:22;9130:18;;;9123:50;9192:6;9240:15;;;9234:22;9214:18;;;;9207:50;;;;7890:1373;:::o;9453:247::-;9512:6;9565:2;9553:9;9544:7;9540:23;9536:32;9533:52;;;9581:1;9578;9571:12;9533:52;9620:9;9607:23;9639:31;9664:5;9639:31;:::i;10108:184::-;10160:77;10157:1;10150:88;10257:4;10254:1;10247:15;10281:4;10278:1;10271:15;10297:125;10362:9;;;10383:10;;;10380:36;;;10396:18;;:::i;10729:168::-;10802:9;;;10833;;10850:15;;;10844:22;;10830:37;10820:71;;10871:18;;:::i;10902:274::-;10942:1;10968;10958:189;;11003:77;11000:1;10993:88;11104:4;11101:1;11094:15;11132:4;11129:1;11122:15;10958:189;-1:-1:-1;11161:9:1;;10902:274::o;11181:128::-;11248:9;;;11269:11;;;11266:37;;;11283:18;;:::i;11314:195::-;11353:3;11384:66;11377:5;11374:77;11371:103;;11454:18;;:::i;:::-;-1:-1:-1;11501:1:1;11490:13;;11314:195::o;11514:250::-;11599:1;11609:113;11623:6;11620:1;11617:13;11609:113;;;11699:11;;;11693:18;11680:11;;;11673:39;11645:2;11638:10;11609:113;;;-1:-1:-1;;11756:1:1;11738:16;;11731:27;11514:250::o;11769:1014::-;12076:3;12065:9;12058:22;12039:4;12109:6;12103:13;12153:6;12147:3;12136:9;12132:19;12125:35;12179:3;12191:81;12265:6;12260:2;12249:9;12245:18;12238:4;12230:6;12226:17;12191:81;:::i;:::-;12452:10;12440:23;;;;12433:4;12418:20;;12411:53;-1:-1:-1;;;;;12561:15:1;;;12556:2;12541:18;;12534:43;12613:15;;;;12608:2;12593:18;;12586:43;12660:3;12645:19;;12638:35;;;;12704:3;12689:19;;12682:35;;;;12761:14;12754:22;12748:3;12733:19;;12726:51;12324:2;12312:15;;;-1:-1:-1;12308:88:1;12293:104;12289:113;;;;;-1:-1:-1;;11769:1014:1:o;13422:136::-;13500:13;;13522:30;13500:13;13522:30;:::i;13563:138::-;13642:13;;13664:31;13642:13;13664:31;:::i;13706:132::-;13782:13;;13804:28;13782:13;13804:28;:::i;13843:1183::-;13946:6;13999:3;13987:9;13978:7;13974:23;13970:33;13967:53;;;14016:1;14013;14006:12;13967:53;14042:17;;:::i;:::-;14082:39;14111:9;14082:39;:::i;:::-;14075:5;14068:54;14154:48;14198:2;14187:9;14183:18;14154:48;:::i;:::-;14149:2;14142:5;14138:14;14131:72;14235:49;14280:2;14269:9;14265:18;14235:49;:::i;:::-;14230:2;14223:5;14219:14;14212:73;14317:49;14362:2;14351:9;14347:18;14317:49;:::i;:::-;14312:2;14305:5;14301:14;14294:73;14400:50;14445:3;14434:9;14430:19;14400:50;:::i;:::-;14394:3;14387:5;14383:15;14376:75;14484:50;14529:3;14518:9;14514:19;14484:50;:::i;:::-;14478:3;14471:5;14467:15;14460:75;14589:3;14578:9;14574:19;14568:26;14562:3;14555:5;14551:15;14544:51;14649:3;14638:9;14634:19;14628:26;14622:3;14615:5;14611:15;14604:51;14674:3;14730:2;14719:9;14715:18;14709:25;14704:2;14697:5;14693:14;14686:49;;14754:3;14789:46;14831:2;14820:9;14816:18;14789:46;:::i;:::-;14773:14;;;14766:70;14855:3;14896:18;;;14890:25;14874:14;;;14867:49;14935:3;14976:18;;;14970:25;14954:14;;;14947:49;;;;-1:-1:-1;14777:5:1;13843:1183;-1:-1:-1;13843:1183:1:o;16187:184::-;16257:6;16310:2;16298:9;16289:7;16285:23;16281:32;16278:52;;;16326:1;16323;16316:12;16278:52;-1:-1:-1;16349:16:1;;16187:184;-1:-1:-1;16187:184:1:o;16678:::-;16730:77;16727:1;16720:88;16827:4;16824:1;16817:15;16851:4;16848:1;16841:15;16867:245;16934:6;16987:2;16975:9;16966:7;16962:23;16958:32;16955:52;;;17003:1;17000;16993:12;16955:52;17035:9;17029:16;17054:28;17076:5;17054:28;:::i;17117:184::-;17169:77;17166:1;17159:88;17266:4;17263:1;17256:15;17290:4;17287:1;17280:15;17306:287;17435:3;17473:6;17467:13;17489:66;17548:6;17543:3;17536:4;17528:6;17524:17;17489:66;:::i;:::-;17571:16;;;;;17306:287;-1:-1:-1;;17306:287: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":"AmountIncorrect","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":"FailedInnerCall","type":"error"},{"inputs":[],"name":"MsgValueIncorrect","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":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":"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":[{"internalType":"bytes32","name":"","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":"bridgeRelays","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"bridgeStatuses","outputs":[{"internalType":"enum FastBridge.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":[],"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":[],"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":"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":"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":"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":{"DISPUTE_PERIOD()":{"notice":"Dispute period for relayed transactions"},"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"},"bridgeProofs(bytes32)":{"notice":"Proof of relayed bridge tx on origin chain"},"bridgeRelays(bytes32)":{"notice":"Whether bridge has been relayed on destination chain"},"bridgeStatuses(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,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"},"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"},"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":{"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"}},"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"}},"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"}},"refund(bytes)":{"params":{"request":"The encoded bridge transaction to refund"}},"relay(bytes)":{"params":{"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":"to prevent replays"}},"version":1},"metadata":"{\"compiler\":{\"version\":\"0.8.20+commit.a1b79de6\"},\"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\":\"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\":\"FailedInnerCall\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MsgValueIncorrect\",\"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\":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\":\"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\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"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\":\"bridgeRelays\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"bridgeStatuses\",\"outputs\":[{\"internalType\":\"enum FastBridge.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\":[],\"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\":[],\"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\":\"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\":\"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\":\"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\":{\"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\"}},\"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\"}},\"refund(bytes)\":{\"params\":{\"request\":\"The encoded bridge transaction to refund\"}},\"relay(bytes)\":{\"params\":{\"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\":\"to prevent replays\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"DISPUTE_PERIOD()\":{\"notice\":\"Dispute period for relayed transactions\"},\"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\"},\"bridgeProofs(bytes32)\":{\"notice\":\"Proof of relayed bridge tx on origin chain\"},\"bridgeRelays(bytes32)\":{\"notice\":\"Whether bridge has been relayed on destination chain\"},\"bridgeStatuses(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,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\"},\"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\"},\"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/FastBridgeMock.sol\":\"FastBridge\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeMock.sol\":{\"keccak256\":\"0xb58951ea9ccf93b597bddaa7b405278a10398c87bf748538ac7a67cd65184783\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://bb67eff4aa6731cbb158660257e9091bbc8135d228ceb240943772f9b5ada90e\",\"dweb:/ipfs/QmQbxcMCxtY5dWAJoPBpipMUjrN5zMvhQDCVkcMpRsn9LP\"]}},\"version\":1}"},"hashes":{"DEFAULT_ADMIN_ROLE()":"a217fddf","DISPUTE_PERIOD()":"a5bbe22b","FEE_BPS()":"bf333f2c","FEE_RATE_MAX()":"0f5f6ed7","GOVERNOR_ROLE()":"ccc57490","GUARD_ROLE()":"03ed0ee5","MIN_DEADLINE_PERIOD()":"820688d5","REFUNDER_ROLE()":"5960ccf2","REFUND_DELAY()":"190da595","RELAYER_ROLE()":"926d7d7f","bridge((uint32,address,address,address,address,uint256,uint256,bool,uint256))":"45851694","bridgeProofs(bytes32)":"91ad5039","bridgeRelays(bytes32)":"8379a24f","bridgeStatuses(bytes32)":"051287bc","canClaim(bytes32,address)":"aa9641ab","chainGasAmount()":"e00a83e0","claim(bytes,address)":"41fcb612","deployBlock()":"a3ec191a","dispute(bytes32)":"add98c70","getBridgeTransaction(bytes)":"ac11fb1a","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","refund(bytes)":"5eb7d946","relay(bytes)":"8f0d6f17","renounceRole(bytes32,address)":"36568abe","revokeRole(bytes32,address)":"d547741f","setChainGasAmount(uint256)":"b250fe6b","setProtocolFeeRate(uint256)":"b13aa2d6","supportsInterface(bytes4)":"01ffc9a7","sweepProtocolFees(address,address)":"06f333f2"}},"solidity/FastBridgeMock.sol:FastBridgeMock":{"code":"0x60a06040523480156200001157600080fd5b506040516200254e3803806200254e833981016040819052620000349162000194565b80620000426000826200004f565b50504360805250620001bf565b6000806200005e84846200008c565b90508015620000835760008481526001602052604090206200008190846200013a565b505b90505b92915050565b6000828152602081815260408083206001600160a01b038516845290915281205460ff1662000131576000838152602081815260408083206001600160a01b03861684529091529020805460ff19166001179055620000e83390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a450600162000086565b50600062000086565b600062000083836001600160a01b0384166000818152600183016020526040812054620001315750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915562000086565b600060208284031215620001a757600080fd5b81516001600160a01b03811681146200008357600080fd5b608051612373620001db600039600061053201526123736000f3fe6080604052600436106102345760003560e01c8063926d7d7f11610138578063b13aa2d6116100b0578063ca15c8731161007f578063d547741f11610064578063d547741f146106dd578063dcf844a7146106fd578063e00a83e01461072a57600080fd5b8063ca15c87314610689578063ccc57490146106a957600080fd5b8063b13aa2d614610612578063b250fe6b14610632578063bf333f2c14610652578063c72870cc1461066957600080fd5b8063ac11fb1a11610107578063add98c70116100ec578063add98c70146105c1578063aedf009d146105dc578063affed0e0146105fc57600080fd5b8063ac11fb1a14610574578063acaebbf1146105a157600080fd5b8063926d7d7f146104d7578063a217fddf1461050b578063a3ec191a14610520578063aa9641ab1461055457600080fd5b806345851694116101cb57806385ad903d1161019a5780638f0d6f171161017f5780638f0d6f17146104335780639010d07c1461044157806391d148541461048657600080fd5b806385ad903d146103eb578063886d36ff1461041857600080fd5b8063458516941461037857806358f85880146103865780635960ccf21461039c5780635eb7d946146103d057600080fd5b8063248a9ca311610207578063248a9ca3146102e85780632f2ff15d1461031857806336568abe1461033857806341fcb6121461035857600080fd5b806301ffc9a71461023957806303ed0ee51461026e57806306f333f2146102b05780630f5f6ed7146102d2575b600080fd5b34801561024557600080fd5b5061025961025436600461195d565b610740565b60405190151581526020015b60405180910390f35b34801561027a57600080fd5b506102a27f043c983c49d46f0e102151eaf8085d4a2e6571d5df2d47b013f39bddfd4a639d81565b604051908152602001610265565b3480156102bc57600080fd5b506102d06102cb3660046119d1565b61079c565b005b3480156102de57600080fd5b506102a261271081565b3480156102f457600080fd5b506102a2610303366004611a0a565b60009081526020819052604090206001015490565b34801561032457600080fd5b506102d0610333366004611a23565b61088a565b34801561034457600080fd5b506102d0610353366004611a23565b6108b5565b34801561036457600080fd5b506102d0610373366004611b70565b61090e565b6102d0610373366004611c90565b34801561039257600080fd5b506102a260025481565b3480156103a857600080fd5b506102a27fdb9556138406326f00296e13ea2ad7db24ba82381212d816b1a40c23b466b32781565b3480156103dc57600080fd5b506102d0610373366004611cad565b3480156103f757600080fd5b5061040b610406366004611cea565b610975565b6040516102659190611d79565b34801561042457600080fd5b506102d0610373366004611d8c565b6102d0610373366004611cad565b34801561044d57600080fd5b5061046161045c366004611dd1565b610b25565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610265565b34801561049257600080fd5b506102596104a1366004611a23565b60009182526020828152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b3480156104e357600080fd5b506102a27fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc481565b34801561051757600080fd5b506102a2600081565b34801561052c57600080fd5b506102a27f000000000000000000000000000000000000000000000000000000000000000081565b34801561056057600080fd5b5061025961056f366004611a23565b610b44565b34801561058057600080fd5b5061059461058f366004611cad565b610ba9565b6040516102659190611df3565b3480156105ad57600080fd5b506102d06105bc366004611f0d565b610c1c565b3480156105cd57600080fd5b506102d0610373366004611a0a565b3480156105e857600080fd5b506102d06105f7366004611f4d565b610dec565b34801561060857600080fd5b506102a260055481565b34801561061e57600080fd5b506102d061062d366004611a0a565b610e77565b34801561063e57600080fd5b506102d061064d366004611a0a565b610f54565b34801561065e57600080fd5b506102a2620f424081565b34801561067557600080fd5b506102d0610684366004611fa6565b610fbc565b34801561069557600080fd5b506102a26106a4366004611a0a565b611042565b3480156106b557600080fd5b506102a27f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5581565b3480156106e957600080fd5b506102d06106f8366004611a23565b611059565b34801561070957600080fd5b506102a261071836600461203e565b60036020526000908152604090205481565b34801561073657600080fd5b506102a260045481565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f5a05180f00000000000000000000000000000000000000000000000000000000148061079657506107968261107e565b92915050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f556107c681611115565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260036020526040812054908190036107fa5750505050565b73ffffffffffffffffffffffffffffffffffffffff841660008181526003602052604081205561082b908483611122565b6040805173ffffffffffffffffffffffffffffffffffffffff8087168252851660208201529081018290527f244e51bc38c1452fa8aaf487bcb4bca36c2baa3a5fbdb776b1eabd8dc6d277cd9060600160405180910390a1505b505050565b6000828152602081905260409020600101546108a581611115565b6108af8383611279565b50505050565b73ffffffffffffffffffffffffffffffffffffffff81163314610904576040517f6697b23200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61088582826112ae565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f6e6f7420696d706c656d656e746564000000000000000000000000000000000060448201526064015b60405180910390fd5b60608160048111156109895761098961205b565b6000036109c957505060408051808201909152600481527f4e554c4c00000000000000000000000000000000000000000000000000000000602082015290565b8160048111156109db576109db61205b565b600103610a1b57505060408051808201909152600981527f5245515545535445440000000000000000000000000000000000000000000000602082015290565b816004811115610a2d57610a2d61205b565b600203610a6d57505060408051808201909152600e81527f52454c415945525f50524f564544000000000000000000000000000000000000602082015290565b816004811115610a7f57610a7f61205b565b600303610abf57505060408051808201909152600f81527f52454c415945525f434c41494d45440000000000000000000000000000000000602082015290565b816004811115610ad157610ad161205b565b600403610b1157505060408051808201909152600881527f524546554e444544000000000000000000000000000000000000000000000000602082015290565b505060408051602081019091526000815290565b6000828152600160205260408120610b3d90836112db565b9392505050565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f6e6f7420696d706c656d656e7465640000000000000000000000000000000000604482015260009060640161096c565b604080516101808101825260008082526020808301829052928201819052606082018190526080820181905260a0820181905260c0820181905260e082018190526101008201819052610120820181905261014082018190526101608201528251909161079691840181019084016120ab565b6000620f42406002548360a00151610c3491906121a6565b610c3e91906121bd565b9050808260a001818151610c5291906121f8565b9150818152505060006040518061018001604052804663ffffffff168152602001846000015163ffffffff168152602001846020015173ffffffffffffffffffffffffffffffffffffffff168152602001846040015173ffffffffffffffffffffffffffffffffffffffff168152602001846060015173ffffffffffffffffffffffffffffffffffffffff168152602001846080015173ffffffffffffffffffffffffffffffffffffffff1681526020018460a0015181526020018460c0015181526020018381526020018460e0015115158152602001846101000151815260200160056000815480929190610d479061220b565b909155509052604051610d5d9190602001611df3565b6040516020818303038152906040529050826020015173ffffffffffffffffffffffffffffffffffffffff16857f120ea0364f36cdac7983bcfdd55270ca09d7f9b314a2ebc425a3b01ab1d6403a838660000151876060015188608001518960a001518a60c001518b60e00151604051610ddd9796959493929190612243565b60405180910390a35050505050565b6000610df782610ba9565b9050806040015173ffffffffffffffffffffffffffffffffffffffff16847f120ea0364f36cdac7983bcfdd55270ca09d7f9b314a2ebc425a3b01ab1d6403a84846020015185608001518660a001518760c001518860e00151896101200151604051610e699796959493929190612243565b60405180910390a350505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f55610ea181611115565b612710821115610f0d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f6e657746656552617465203e206d617800000000000000000000000000000000604482015260640161096c565b600280549083905560408051828152602081018590527f14914da2bf76024616fbe1859783fcd4dbddcb179b1f3a854949fbf920dcb95791015b60405180910390a1505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f55610f7e81611115565b600480549083905560408051828152602081018590527f5cf09b12f3f56b4c564d51b25b40360af6d795198adb61ae0806a36c294323fa9101610f47565b6040805163ffffffff8816815273ffffffffffffffffffffffffffffffffffffffff878116602083015286811682840152606082018690526080820185905260a082018490529151898316928b16918c917ff8ae392d784b1ea5e8881bfa586d81abf07ef4f1e2fc75f7fe51c90f05199a5c9181900360c00190a4505050505050505050565b6000818152600160205260408120610796906112e7565b60008281526020819052604090206001015461107481611115565b6108af83836112ae565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061079657507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614610796565b61111f81336112f1565b50565b3073ffffffffffffffffffffffffffffffffffffffff83160361114457505050565b8060000361115157505050565b7fffffffffffffffffffffffff111111111111111111111111111111111111111273ffffffffffffffffffffffffffffffffffffffff8416016112585760008273ffffffffffffffffffffffffffffffffffffffff168260405160006040518083038185875af1925050503d80600081146111e8576040519150601f19603f3d011682016040523d82523d6000602084013e6111ed565b606091505b50509050806108af576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f455448207472616e73666572206661696c656400000000000000000000000000604482015260640161096c565b61088573ffffffffffffffffffffffffffffffffffffffff8416838361137b565b6000806112868484611408565b90508015610b3d5760008481526001602052604090206112a69084611504565b509392505050565b6000806112bb8484611526565b90508015610b3d5760008481526001602052604090206112a690846115e1565b6000610b3d8383611603565b6000610796825490565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16611377576040517fe2517d3f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff821660048201526024810183905260440161096c565b5050565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb0000000000000000000000000000000000000000000000000000000017905261088590849061162d565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915281205460ff166114fc5760008381526020818152604080832073ffffffffffffffffffffffffffffffffffffffff86168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905561149a3390565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a4506001610796565b506000610796565b6000610b3d8373ffffffffffffffffffffffffffffffffffffffff84166116c3565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915281205460ff16156114fc5760008381526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8616808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a4506001610796565b6000610b3d8373ffffffffffffffffffffffffffffffffffffffff841661170a565b600082600001828154811061161a5761161a6122a6565b9060005260206000200154905092915050565b600061164f73ffffffffffffffffffffffffffffffffffffffff8416836117fd565b9050805160001415801561167457508080602001905181019061167291906122d5565b155b15610885576040517f5274afe700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8416600482015260240161096c565b60008181526001830160205260408120546114fc57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610796565b600081815260018301602052604081205480156117f357600061172e6001836121f8565b8554909150600090611742906001906121f8565b90508082146117a7576000866000018281548110611762576117626122a6565b9060005260206000200154905080876000018481548110611785576117856122a6565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806117b8576117b86122f2565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610796565b6000915050610796565b6060610b3d83836000846000808573ffffffffffffffffffffffffffffffffffffffff1684866040516118309190612321565b60006040518083038185875af1925050503d806000811461186d576040519150601f19603f3d011682016040523d82523d6000602084013e611872565b606091505b509150915061188286838361188c565b9695505050505050565b6060826118a15761189c8261191b565b610b3d565b81511580156118c5575073ffffffffffffffffffffffffffffffffffffffff84163b155b15611914576040517f9996b31500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8516600482015260240161096c565b5080610b3d565b80511561192b5780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006020828403121561196f57600080fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114610b3d57600080fd5b73ffffffffffffffffffffffffffffffffffffffff8116811461111f57600080fd5b80356119cc8161199f565b919050565b600080604083850312156119e457600080fd5b82356119ef8161199f565b915060208301356119ff8161199f565b809150509250929050565b600060208284031215611a1c57600080fd5b5035919050565b60008060408385031215611a3657600080fd5b8235915060208301356119ff8161199f565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051610120810167ffffffffffffffff81118282101715611a9b57611a9b611a48565b60405290565b604051610180810167ffffffffffffffff81118282101715611a9b57611a9b611a48565b600082601f830112611ad657600080fd5b813567ffffffffffffffff80821115611af157611af1611a48565b604051601f83017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908282118183101715611b3757611b37611a48565b81604052838152866020858801011115611b5057600080fd5b836020870160208301376000602085830101528094505050505092915050565b60008060408385031215611b8357600080fd5b823567ffffffffffffffff811115611b9a57600080fd5b611ba685828601611ac5565b92505060208301356119ff8161199f565b63ffffffff8116811461111f57600080fd5b80356119cc81611bb7565b801515811461111f57600080fd5b80356119cc81611bd4565b60006101208284031215611c0057600080fd5b611c08611a77565b9050611c1382611bc9565b8152611c21602083016119c1565b6020820152611c32604083016119c1565b6040820152611c43606083016119c1565b6060820152611c54608083016119c1565b608082015260a082013560a082015260c082013560c0820152611c7960e08301611be2565b60e082015261010080830135818301525092915050565b60006101208284031215611ca357600080fd5b610b3d8383611bed565b600060208284031215611cbf57600080fd5b813567ffffffffffffffff811115611cd657600080fd5b611ce284828501611ac5565b949350505050565b600060208284031215611cfc57600080fd5b813560058110610b3d57600080fd5b60005b83811015611d26578181015183820152602001611d0e565b50506000910152565b60008151808452611d47816020860160208601611d0b565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b602081526000610b3d6020830184611d2f565b60008060408385031215611d9f57600080fd5b823567ffffffffffffffff811115611db657600080fd5b611dc285828601611ac5565b95602094909401359450505050565b60008060408385031215611de457600080fd5b50508035926020909101359150565b815163ffffffff16815261018081016020830151611e19602084018263ffffffff169052565b506040830151611e41604084018273ffffffffffffffffffffffffffffffffffffffff169052565b506060830151611e69606084018273ffffffffffffffffffffffffffffffffffffffff169052565b506080830151611e91608084018273ffffffffffffffffffffffffffffffffffffffff169052565b5060a0830151611eb960a084018273ffffffffffffffffffffffffffffffffffffffff169052565b5060c083015160c083015260e083015160e083015261010080840151818401525061012080840151611eee8285018215159052565b5050610140838101519083015261016092830151929091019190915290565b60008060006101608486031215611f2357600080fd5b833592506020840135611f358161199f565b9150611f448560408601611bed565b90509250925092565b600080600060608486031215611f6257600080fd5b833592506020840135611f748161199f565b9150604084013567ffffffffffffffff811115611f9057600080fd5b611f9c86828701611ac5565b9150509250925092565b60008060008060008060008060006101208a8c031215611fc557600080fd5b8935985060208a0135611fd78161199f565b975060408a0135611fe78161199f565b965060608a0135611ff781611bb7565b955060808a01356120078161199f565b945060a08a01356120178161199f565b8094505060c08a0135925060e08a013591506101008a013590509295985092959850929598565b60006020828403121561205057600080fd5b8135610b3d8161199f565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b80516119cc81611bb7565b80516119cc8161199f565b80516119cc81611bd4565b600061018082840312156120be57600080fd5b6120c6611aa1565b6120cf8361208a565b81526120dd6020840161208a565b60208201526120ee60408401612095565b60408201526120ff60608401612095565b606082015261211060808401612095565b608082015261212160a08401612095565b60a082015260c083015160c082015260e083015160e08201526101008084015181830152506101206121548185016120a0565b908201526101408381015190820152610160928301519281019290925250919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b808202811582820484141761079657610796612177565b6000826121f3577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b8181038181111561079657610796612177565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361223c5761223c612177565b5060010190565b60e08152600061225660e083018a611d2f565b63ffffffff9890981660208301525073ffffffffffffffffffffffffffffffffffffffff9586166040820152939094166060840152608083019190915260a082015290151560c090910152919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000602082840312156122e757600080fd5b8151610b3d81611bd4565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b60008251612333818460208701611d0b565b919091019291505056fea26469706673582212201d7ae4ad64395f4be873cab646bc0ae5107f20500d3986f2482df1a500db3bc664736f6c63430008140033","runtime-code":"0x6080604052600436106102345760003560e01c8063926d7d7f11610138578063b13aa2d6116100b0578063ca15c8731161007f578063d547741f11610064578063d547741f146106dd578063dcf844a7146106fd578063e00a83e01461072a57600080fd5b8063ca15c87314610689578063ccc57490146106a957600080fd5b8063b13aa2d614610612578063b250fe6b14610632578063bf333f2c14610652578063c72870cc1461066957600080fd5b8063ac11fb1a11610107578063add98c70116100ec578063add98c70146105c1578063aedf009d146105dc578063affed0e0146105fc57600080fd5b8063ac11fb1a14610574578063acaebbf1146105a157600080fd5b8063926d7d7f146104d7578063a217fddf1461050b578063a3ec191a14610520578063aa9641ab1461055457600080fd5b806345851694116101cb57806385ad903d1161019a5780638f0d6f171161017f5780638f0d6f17146104335780639010d07c1461044157806391d148541461048657600080fd5b806385ad903d146103eb578063886d36ff1461041857600080fd5b8063458516941461037857806358f85880146103865780635960ccf21461039c5780635eb7d946146103d057600080fd5b8063248a9ca311610207578063248a9ca3146102e85780632f2ff15d1461031857806336568abe1461033857806341fcb6121461035857600080fd5b806301ffc9a71461023957806303ed0ee51461026e57806306f333f2146102b05780630f5f6ed7146102d2575b600080fd5b34801561024557600080fd5b5061025961025436600461195d565b610740565b60405190151581526020015b60405180910390f35b34801561027a57600080fd5b506102a27f043c983c49d46f0e102151eaf8085d4a2e6571d5df2d47b013f39bddfd4a639d81565b604051908152602001610265565b3480156102bc57600080fd5b506102d06102cb3660046119d1565b61079c565b005b3480156102de57600080fd5b506102a261271081565b3480156102f457600080fd5b506102a2610303366004611a0a565b60009081526020819052604090206001015490565b34801561032457600080fd5b506102d0610333366004611a23565b61088a565b34801561034457600080fd5b506102d0610353366004611a23565b6108b5565b34801561036457600080fd5b506102d0610373366004611b70565b61090e565b6102d0610373366004611c90565b34801561039257600080fd5b506102a260025481565b3480156103a857600080fd5b506102a27fdb9556138406326f00296e13ea2ad7db24ba82381212d816b1a40c23b466b32781565b3480156103dc57600080fd5b506102d0610373366004611cad565b3480156103f757600080fd5b5061040b610406366004611cea565b610975565b6040516102659190611d79565b34801561042457600080fd5b506102d0610373366004611d8c565b6102d0610373366004611cad565b34801561044d57600080fd5b5061046161045c366004611dd1565b610b25565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610265565b34801561049257600080fd5b506102596104a1366004611a23565b60009182526020828152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b3480156104e357600080fd5b506102a27fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc481565b34801561051757600080fd5b506102a2600081565b34801561052c57600080fd5b506102a27f000000000000000000000000000000000000000000000000000000000000000081565b34801561056057600080fd5b5061025961056f366004611a23565b610b44565b34801561058057600080fd5b5061059461058f366004611cad565b610ba9565b6040516102659190611df3565b3480156105ad57600080fd5b506102d06105bc366004611f0d565b610c1c565b3480156105cd57600080fd5b506102d0610373366004611a0a565b3480156105e857600080fd5b506102d06105f7366004611f4d565b610dec565b34801561060857600080fd5b506102a260055481565b34801561061e57600080fd5b506102d061062d366004611a0a565b610e77565b34801561063e57600080fd5b506102d061064d366004611a0a565b610f54565b34801561065e57600080fd5b506102a2620f424081565b34801561067557600080fd5b506102d0610684366004611fa6565b610fbc565b34801561069557600080fd5b506102a26106a4366004611a0a565b611042565b3480156106b557600080fd5b506102a27f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5581565b3480156106e957600080fd5b506102d06106f8366004611a23565b611059565b34801561070957600080fd5b506102a261071836600461203e565b60036020526000908152604090205481565b34801561073657600080fd5b506102a260045481565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f5a05180f00000000000000000000000000000000000000000000000000000000148061079657506107968261107e565b92915050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f556107c681611115565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260036020526040812054908190036107fa5750505050565b73ffffffffffffffffffffffffffffffffffffffff841660008181526003602052604081205561082b908483611122565b6040805173ffffffffffffffffffffffffffffffffffffffff8087168252851660208201529081018290527f244e51bc38c1452fa8aaf487bcb4bca36c2baa3a5fbdb776b1eabd8dc6d277cd9060600160405180910390a1505b505050565b6000828152602081905260409020600101546108a581611115565b6108af8383611279565b50505050565b73ffffffffffffffffffffffffffffffffffffffff81163314610904576040517f6697b23200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61088582826112ae565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f6e6f7420696d706c656d656e746564000000000000000000000000000000000060448201526064015b60405180910390fd5b60608160048111156109895761098961205b565b6000036109c957505060408051808201909152600481527f4e554c4c00000000000000000000000000000000000000000000000000000000602082015290565b8160048111156109db576109db61205b565b600103610a1b57505060408051808201909152600981527f5245515545535445440000000000000000000000000000000000000000000000602082015290565b816004811115610a2d57610a2d61205b565b600203610a6d57505060408051808201909152600e81527f52454c415945525f50524f564544000000000000000000000000000000000000602082015290565b816004811115610a7f57610a7f61205b565b600303610abf57505060408051808201909152600f81527f52454c415945525f434c41494d45440000000000000000000000000000000000602082015290565b816004811115610ad157610ad161205b565b600403610b1157505060408051808201909152600881527f524546554e444544000000000000000000000000000000000000000000000000602082015290565b505060408051602081019091526000815290565b6000828152600160205260408120610b3d90836112db565b9392505050565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f6e6f7420696d706c656d656e7465640000000000000000000000000000000000604482015260009060640161096c565b604080516101808101825260008082526020808301829052928201819052606082018190526080820181905260a0820181905260c0820181905260e082018190526101008201819052610120820181905261014082018190526101608201528251909161079691840181019084016120ab565b6000620f42406002548360a00151610c3491906121a6565b610c3e91906121bd565b9050808260a001818151610c5291906121f8565b9150818152505060006040518061018001604052804663ffffffff168152602001846000015163ffffffff168152602001846020015173ffffffffffffffffffffffffffffffffffffffff168152602001846040015173ffffffffffffffffffffffffffffffffffffffff168152602001846060015173ffffffffffffffffffffffffffffffffffffffff168152602001846080015173ffffffffffffffffffffffffffffffffffffffff1681526020018460a0015181526020018460c0015181526020018381526020018460e0015115158152602001846101000151815260200160056000815480929190610d479061220b565b909155509052604051610d5d9190602001611df3565b6040516020818303038152906040529050826020015173ffffffffffffffffffffffffffffffffffffffff16857f120ea0364f36cdac7983bcfdd55270ca09d7f9b314a2ebc425a3b01ab1d6403a838660000151876060015188608001518960a001518a60c001518b60e00151604051610ddd9796959493929190612243565b60405180910390a35050505050565b6000610df782610ba9565b9050806040015173ffffffffffffffffffffffffffffffffffffffff16847f120ea0364f36cdac7983bcfdd55270ca09d7f9b314a2ebc425a3b01ab1d6403a84846020015185608001518660a001518760c001518860e00151896101200151604051610e699796959493929190612243565b60405180910390a350505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f55610ea181611115565b612710821115610f0d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f6e657746656552617465203e206d617800000000000000000000000000000000604482015260640161096c565b600280549083905560408051828152602081018590527f14914da2bf76024616fbe1859783fcd4dbddcb179b1f3a854949fbf920dcb95791015b60405180910390a1505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f55610f7e81611115565b600480549083905560408051828152602081018590527f5cf09b12f3f56b4c564d51b25b40360af6d795198adb61ae0806a36c294323fa9101610f47565b6040805163ffffffff8816815273ffffffffffffffffffffffffffffffffffffffff878116602083015286811682840152606082018690526080820185905260a082018490529151898316928b16918c917ff8ae392d784b1ea5e8881bfa586d81abf07ef4f1e2fc75f7fe51c90f05199a5c9181900360c00190a4505050505050505050565b6000818152600160205260408120610796906112e7565b60008281526020819052604090206001015461107481611115565b6108af83836112ae565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061079657507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614610796565b61111f81336112f1565b50565b3073ffffffffffffffffffffffffffffffffffffffff83160361114457505050565b8060000361115157505050565b7fffffffffffffffffffffffff111111111111111111111111111111111111111273ffffffffffffffffffffffffffffffffffffffff8416016112585760008273ffffffffffffffffffffffffffffffffffffffff168260405160006040518083038185875af1925050503d80600081146111e8576040519150601f19603f3d011682016040523d82523d6000602084013e6111ed565b606091505b50509050806108af576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f455448207472616e73666572206661696c656400000000000000000000000000604482015260640161096c565b61088573ffffffffffffffffffffffffffffffffffffffff8416838361137b565b6000806112868484611408565b90508015610b3d5760008481526001602052604090206112a69084611504565b509392505050565b6000806112bb8484611526565b90508015610b3d5760008481526001602052604090206112a690846115e1565b6000610b3d8383611603565b6000610796825490565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16611377576040517fe2517d3f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff821660048201526024810183905260440161096c565b5050565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb0000000000000000000000000000000000000000000000000000000017905261088590849061162d565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915281205460ff166114fc5760008381526020818152604080832073ffffffffffffffffffffffffffffffffffffffff86168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905561149a3390565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a4506001610796565b506000610796565b6000610b3d8373ffffffffffffffffffffffffffffffffffffffff84166116c3565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915281205460ff16156114fc5760008381526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8616808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a4506001610796565b6000610b3d8373ffffffffffffffffffffffffffffffffffffffff841661170a565b600082600001828154811061161a5761161a6122a6565b9060005260206000200154905092915050565b600061164f73ffffffffffffffffffffffffffffffffffffffff8416836117fd565b9050805160001415801561167457508080602001905181019061167291906122d5565b155b15610885576040517f5274afe700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8416600482015260240161096c565b60008181526001830160205260408120546114fc57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610796565b600081815260018301602052604081205480156117f357600061172e6001836121f8565b8554909150600090611742906001906121f8565b90508082146117a7576000866000018281548110611762576117626122a6565b9060005260206000200154905080876000018481548110611785576117856122a6565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806117b8576117b86122f2565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610796565b6000915050610796565b6060610b3d83836000846000808573ffffffffffffffffffffffffffffffffffffffff1684866040516118309190612321565b60006040518083038185875af1925050503d806000811461186d576040519150601f19603f3d011682016040523d82523d6000602084013e611872565b606091505b509150915061188286838361188c565b9695505050505050565b6060826118a15761189c8261191b565b610b3d565b81511580156118c5575073ffffffffffffffffffffffffffffffffffffffff84163b155b15611914576040517f9996b31500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8516600482015260240161096c565b5080610b3d565b80511561192b5780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006020828403121561196f57600080fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114610b3d57600080fd5b73ffffffffffffffffffffffffffffffffffffffff8116811461111f57600080fd5b80356119cc8161199f565b919050565b600080604083850312156119e457600080fd5b82356119ef8161199f565b915060208301356119ff8161199f565b809150509250929050565b600060208284031215611a1c57600080fd5b5035919050565b60008060408385031215611a3657600080fd5b8235915060208301356119ff8161199f565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051610120810167ffffffffffffffff81118282101715611a9b57611a9b611a48565b60405290565b604051610180810167ffffffffffffffff81118282101715611a9b57611a9b611a48565b600082601f830112611ad657600080fd5b813567ffffffffffffffff80821115611af157611af1611a48565b604051601f83017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908282118183101715611b3757611b37611a48565b81604052838152866020858801011115611b5057600080fd5b836020870160208301376000602085830101528094505050505092915050565b60008060408385031215611b8357600080fd5b823567ffffffffffffffff811115611b9a57600080fd5b611ba685828601611ac5565b92505060208301356119ff8161199f565b63ffffffff8116811461111f57600080fd5b80356119cc81611bb7565b801515811461111f57600080fd5b80356119cc81611bd4565b60006101208284031215611c0057600080fd5b611c08611a77565b9050611c1382611bc9565b8152611c21602083016119c1565b6020820152611c32604083016119c1565b6040820152611c43606083016119c1565b6060820152611c54608083016119c1565b608082015260a082013560a082015260c082013560c0820152611c7960e08301611be2565b60e082015261010080830135818301525092915050565b60006101208284031215611ca357600080fd5b610b3d8383611bed565b600060208284031215611cbf57600080fd5b813567ffffffffffffffff811115611cd657600080fd5b611ce284828501611ac5565b949350505050565b600060208284031215611cfc57600080fd5b813560058110610b3d57600080fd5b60005b83811015611d26578181015183820152602001611d0e565b50506000910152565b60008151808452611d47816020860160208601611d0b565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b602081526000610b3d6020830184611d2f565b60008060408385031215611d9f57600080fd5b823567ffffffffffffffff811115611db657600080fd5b611dc285828601611ac5565b95602094909401359450505050565b60008060408385031215611de457600080fd5b50508035926020909101359150565b815163ffffffff16815261018081016020830151611e19602084018263ffffffff169052565b506040830151611e41604084018273ffffffffffffffffffffffffffffffffffffffff169052565b506060830151611e69606084018273ffffffffffffffffffffffffffffffffffffffff169052565b506080830151611e91608084018273ffffffffffffffffffffffffffffffffffffffff169052565b5060a0830151611eb960a084018273ffffffffffffffffffffffffffffffffffffffff169052565b5060c083015160c083015260e083015160e083015261010080840151818401525061012080840151611eee8285018215159052565b5050610140838101519083015261016092830151929091019190915290565b60008060006101608486031215611f2357600080fd5b833592506020840135611f358161199f565b9150611f448560408601611bed565b90509250925092565b600080600060608486031215611f6257600080fd5b833592506020840135611f748161199f565b9150604084013567ffffffffffffffff811115611f9057600080fd5b611f9c86828701611ac5565b9150509250925092565b60008060008060008060008060006101208a8c031215611fc557600080fd5b8935985060208a0135611fd78161199f565b975060408a0135611fe78161199f565b965060608a0135611ff781611bb7565b955060808a01356120078161199f565b945060a08a01356120178161199f565b8094505060c08a0135925060e08a013591506101008a013590509295985092959850929598565b60006020828403121561205057600080fd5b8135610b3d8161199f565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b80516119cc81611bb7565b80516119cc8161199f565b80516119cc81611bd4565b600061018082840312156120be57600080fd5b6120c6611aa1565b6120cf8361208a565b81526120dd6020840161208a565b60208201526120ee60408401612095565b60408201526120ff60608401612095565b606082015261211060808401612095565b608082015261212160a08401612095565b60a082015260c083015160c082015260e083015160e08201526101008084015181830152506101206121548185016120a0565b908201526101408381015190820152610160928301519281019290925250919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b808202811582820484141761079657610796612177565b6000826121f3577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b8181038181111561079657610796612177565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361223c5761223c612177565b5060010190565b60e08152600061225660e083018a611d2f565b63ffffffff9890981660208301525073ffffffffffffffffffffffffffffffffffffffff9586166040820152939094166060840152608083019190915260a082015290151560c090910152919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000602082840312156122e757600080fd5b8151610b3d81611bd4565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b60008251612333818460208701611d0b565b919091019291505056fea26469706673582212201d7ae4ad64395f4be873cab646bc0ae5107f20500d3986f2482df1a500db3bc664736f6c63430008140033","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.20 ^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 pure 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/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// 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/FastBridge.sol\n\ncontract FastBridge is IFastBridge, Admin {\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 enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeStatus) public bridgeStatuses;\n /// @notice Proof of relayed bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeProof) public bridgeProofs;\n /// @notice Whether bridge has been relayed on destination chain\n mapping(bytes32 =\u003e bool) public bridgeRelays;\n\n /// @dev to prevent replays\n uint256 public nonce;\n // @dev 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 /// @notice Pulls a requested token from the user to the requested recipient.\n /// @dev Be careful of re-entrancy issues when msg.value \u003e 0 and recipient != address(this)\n function _pullToken(address recipient, address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token != UniversalTokenLib.ETH_ADDRESS) {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(recipient);\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, recipient, amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(recipient) - amountPulled;\n } else {\n // Otherwise, we need to check that ETH amount matches msg.value\n if (amount != msg.value) revert MsgValueIncorrect();\n // Transfer value to recipient if not this address\n if (recipient != address(this)) token.universalTransfer(recipient, amount);\n // We will forward msg.value in the external call later, if recipient is not this contract\n amountPulled = msg.value;\n }\n }\n\n /// @inheritdoc IFastBridge\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n // check bridge params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\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\n // transfer tokens to bridge contract\n // @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(address(this), 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 BridgeTransaction({\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 sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n\n // check haven't exceeded deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n\n // mark bridge transaction as relayed\n if (bridgeRelays[transactionId]) revert TransactionRelayed();\n bridgeRelays[transactionId] = true;\n\n // transfer tokens to recipient on destination chain and gas rebate if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n uint256 rebate = chainGasAmount;\n if (!transaction.sendChainGas) {\n // forward erc20\n rebate = 0;\n _pullToken(to, token, amount);\n } else if (token == UniversalTokenLib.ETH_ADDRESS) {\n // lump in gas rebate into amount in native gas token\n _pullToken(to, token, amount + rebate);\n } else {\n // forward erc20 then forward gas rebate in native gas token\n _pullToken(to, token, amount);\n _pullToken(to, UniversalTokenLib.ETH_ADDRESS, rebate);\n }\n\n emit BridgeRelayed(\n transactionId,\n msg.sender,\n to,\n transaction.originChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n rebate\n );\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n // update bridge tx status given proof provided\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = BridgeStatus.RELAYER_PROVED;\n bridgeProofs[transactionId] = BridgeProof({timestamp: uint96(block.timestamp), relayer: msg.sender}); // overflow ok\n\n emit BridgeProofProvided(transactionId, msg.sender, destTxHash);\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint96(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint96).max but\n /// proof.timestamp \u003c type(uint96).max via unchecked statement\n /// @param proof The bridge proof\n /// @return delta Time delta since proof submitted\n function _timeSince(BridgeProof memory proof) internal view returns (uint256 delta) {\n unchecked {\n delta = uint96(block.timestamp) - proof.timestamp;\n }\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != relayer) revert SenderIncorrect();\n return _timeSince(proof) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != msg.sender) revert SenderIncorrect();\n if (_timeSince(proof) \u003c= DISPUTE_PERIOD) revert DisputePeriodNotPassed();\n\n bridgeStatuses[transactionId] = 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, msg.sender, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeProofs[transactionId]) \u003e DISPUTE_PERIOD) revert DisputePeriodPassed();\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n delete bridgeProofs[transactionId];\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 BridgeTransaction memory transaction = getBridgeTransaction(request);\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 // set status to refunded if still in requested state\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = 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\n// test/FastBridgeMock.sol\n\ncontract FastBridgeMock is IFastBridge, Admin {\n // @dev 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 /// @dev to prevent replays\n uint256 public nonce;\n\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n // used for testing in go.\n // see: https://ethereum.stackexchange.com/questions/21155/how-to-expose-enum-in-solidity-contract\n // make sure to update fastbridge/status.go if this changes\n // or underliyng enum changes.\n //\n // TODO: a foundry test should be added to ensure this is always in sync.\n function getEnumKeyByValue(FastBridge.BridgeStatus keyValue) public pure returns (string memory) {\n if (FastBridge.BridgeStatus.NULL == keyValue) return \"NULL\";\n if (FastBridge.BridgeStatus.REQUESTED == keyValue) return \"REQUESTED\";\n if (FastBridge.BridgeStatus.RELAYER_PROVED == keyValue) return \"RELAYER_PROVED\";\n if (FastBridge.BridgeStatus.RELAYER_CLAIMED == keyValue) return \"RELAYER_CLAIMED\";\n if (FastBridge.BridgeStatus.REFUNDED == keyValue) return \"REFUNDED\";\n return \"\";\n }\n\n function mockBridgeRequest(bytes32 transactionId, address sender, BridgeParams memory params) external {\n uint256 originFeeAmount = (params.originAmount * protocolFeeRate) / FEE_BPS;\n params.originAmount -= originFeeAmount;\n\n bytes memory request = abi.encode(\n BridgeTransaction({\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: params.originAmount, // includes relayer fee\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n params.originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n function mockBridgeRequestRaw(bytes32 transactionId, address sender, bytes memory request) external {\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n emit BridgeRequested(\n transactionId,\n transaction.originSender,\n request,\n transaction.destChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n transaction.sendChainGas\n );\n }\n\n function mockBridgeRelayer(\n bytes32 transactionId,\n address relayer,\n address to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n )\n external\n {\n emit BridgeRelayed(\n transactionId, relayer, to, originChainId, originToken, destToken, originAmount, destAmount, chainGasAmount\n );\n }\n\n function bridge(BridgeParams memory params) external payable {\n revert(\"not implemented\");\n }\n\n function relay(bytes memory request) external payable {\n revert(\"not implemented\");\n }\n\n function prove(bytes memory request, bytes32 destTxHash) external {\n revert(\"not implemented\");\n }\n\n function canClaim(bytes32 transactionid, address relayer) external view returns (bool) {\n revert(\"not implemented\");\n }\n\n function claim(bytes memory request, address to) external {\n revert(\"not implemented\");\n }\n\n function dispute(bytes32 transactionId) external {\n revert(\"not implemented\");\n }\n\n function refund(bytes memory request) external {\n revert(\"not implemented\");\n }\n}\n","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","compilerOptions":"--combined-json bin,bin-runtime,srcmap,srcmap-runtime,abi,userdoc,devdoc,metadata,hashes --optimize --optimize-runs 10000 --allow-paths ., ./, ../ --evm-version=istanbul","srcMap":"69530:4359:0:-:0;;;69676:85;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;69710:6;57187:38;46359:4;69710:6;57187:10;:38::i;:::-;-1:-1:-1;;69742:12:0::1;69728:26;::::0;-1:-1:-1;69530:4359:0;;55672:257;55758:4;;55789:31;55806:4;55812:7;55789:16;:31::i;:::-;55774:46;;55834:7;55830:69;;;55857:18;;;;:12;:18;;;;;:31;;55880:7;55857:22;:31::i;:::-;;55830:69;55915:7;-1:-1:-1;55672:257:0;;;;;:::o;50306:316::-;50383:4;47081:12;;;;;;;;;;;-1:-1:-1;;;;;47081:29:0;;;;;;;;;;;;50399:217;;50442:6;:12;;;;;;;;;;;-1:-1:-1;;;;;50442:29:0;;;;;;;;;:36;;-1:-1:-1;;50442:36:0;50474:4;50442:36;;;50524:12;22402:10;;22323:96;50524:12;-1:-1:-1;;;;;50497:40:0;50515:7;-1:-1:-1;;;;;50497:40:0;50509:4;50497:40;;;;;;;;;;-1:-1:-1;50558:4:0;50551:11;;50399:217;-1:-1:-1;50600:5:0;50593:12;;31847:150;31917:4;31940:50;31945:3;-1:-1:-1;;;;;31965:23:0;;25835:4;27891:21;;;:14;;;:21;;;;;;25851:321;;-1:-1:-1;25893:23:0;;;;;;;;:11;:23;;;;;;;;;;;;;26075:18;;26051:21;;;:14;;;:21;;;;;;:42;;;;26107: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;69530:4359:0;;;;;;;;;;;;","srcMapRuntime":"69530:4359:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;54332:212;;;;;;;;;;-1:-1:-1;54332:212:0;;;;;:::i;:::-;;:::i;:::-;;;612:14:1;;605:22;587:41;;575:2;560:18;54332:212:0;;;;;;;;56562:60;;;;;;;;;;;;56599:23;56562:60;;;;;785:25:1;;;773:2;758:18;56562:60:0;639:177:1;57534:359:0;;;;;;;;;;-1:-1:-1;57534:359:0;;;;;:::i;:::-;;:::i;:::-;;56744:45;;;;;;;;;;;;56783:6;56744:45;;47937:120;;;;;;;;;;-1:-1:-1;47937:120:0;;;;;:::i;:::-;48002:7;48028:12;;;;;;;;;;:22;;;;47937:120;48353:136;;;;;;;;;;-1:-1:-1;48353:136:0;;;;;:::i;:::-;;:::i;49455:245::-;;;;;;;;;;-1:-1:-1;49455:245:0;;;;;:::i;:::-;;:::i;73595:100::-;;;;;;;;;;-1:-1:-1;73595:100:0;;;;;:::i;:::-;;:::i;73135:103::-;;;;;;:::i;56906:30::-;;;;;;;;;;;;;;;;56490:66;;;;;;;;;;;;56530:26;56490:66;;73798:89;;;;;;;;;;-1:-1:-1;73798:89:0;;;;;:::i;70313:528::-;;;;;;;;;;-1:-1:-1;70313:528:0;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;73346:108::-;;;;;;;;;;-1:-1:-1;73346:108:0;;;;;:::i;73244:96::-;;;;;;:::i;55129:142::-;;;;;;;;;;-1:-1:-1;55129:142:0;;;;;:::i;:::-;;:::i;:::-;;;8086:42:1;8074:55;;;8056:74;;8044:2;8029:18;55129:142:0;7910:226:1;46981:136:0;;;;;;;;;;-1:-1:-1;46981:136:0;;;;;:::i;:::-;47058:4;47081:12;;;;;;;;;;;:29;;;;;;;;;;;;;;;;46981:136;56420:64;;;;;;;;;;;;56459:25;56420:64;;46314:49;;;;;;;;;;-1:-1:-1;46314:49:0;46359:4;46314:49;;69633:36;;;;;;;;;;;;;;;73460:129;;;;;;;;;;-1:-1:-1;73460:129:0;;;;;:::i;:::-;;:::i;69826:163::-;;;;;;;;;;-1:-1:-1;69826:163:0;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;70847:1266::-;;;;;;;;;;-1:-1:-1;70847:1266:0;;;;;:::i;:::-;;:::i;73701:91::-;;;;;;;;;;-1:-1:-1;73701:91:0;;;;;:::i;72119:532::-;;;;;;;;;;-1:-1:-1;72119:532:0;;;;;:::i;:::-;;:::i;69799:20::-;;;;;;;;;;;;;;;;57238:290;;;;;;;;;;-1:-1:-1;57238:290:0;;;;;:::i;:::-;;:::i;57899:264::-;;;;;;;;;;-1:-1:-1;57899:264:0;;;;;:::i;:::-;;:::i;56701:37::-;;;;;;;;;;;;56735:3;56701:37;;72657:472;;;;;;;;;;-1:-1:-1;72657:472:0;;;;;:::i;:::-;;:::i;55439:131::-;;;;;;;;;;-1:-1:-1;55439:131:0;;;;;:::i;:::-;;:::i;56628:66::-;;;;;;;;;;;;56668:26;56628:66;;48769:138;;;;;;;;;;-1:-1:-1;48769:138:0;;;;;:::i;:::-;;:::i;56992:47::-;;;;;;;;;;-1:-1:-1;56992:47:0;;;;;:::i;:::-;;;;;;;;;;;;;;57113:29;;;;;;;;;;;;;;;;54332:212;54417:4;54440:57;;;54455:42;54440:57;;:97;;;54501:36;54525:11;54501:23;:36::i;:::-;54433:104;54332:212;-1:-1:-1;;54332:212:0:o;57534:359::-;56668:26;46591:16;46602:4;46591:10;:16::i;:::-;57658:19:::1;::::0;::::1;57638:17;57658:19:::0;;;:12:::1;:19;::::0;;;;;;57691:14;;;57687:27:::1;;57707:7;57534:359:::0;;;:::o;57687:27::-:1;57755:19;::::0;::::1;57777:1;57755:19:::0;;;:12:::1;:19;::::0;;;;:23;57788:45:::1;::::0;57812:9;57823;57788:23:::1;:45::i;:::-;57848:38;::::0;;12332:42:1;12401:15;;;12383:34;;12453:15;;12448:2;12433:18;;12426:43;12485:18;;;12478:34;;;57848:38:0::1;::::0;12310:2:1;12295:18;57848:38:0::1;;;;;;;57628:265;46617:1;57534:359:::0;;;:::o;48353:136::-;48002:7;48028:12;;;;;;;;;;:22;;;46591:16;46602:4;46591:10;:16::i;:::-;48457:25:::1;48468:4;48474:7;48457:10;:25::i;:::-;;48353:136:::0;;;:::o;49455:245::-;49548:34;;;22402:10;49548:34;49544:102;;49605:30;;;;;;;;;;;;;;49544:102;49656:37;49668:4;49674:18;49656:11;:37::i;73595:100::-;73663:25;;;;;12725:2:1;73663:25:0;;;12707:21:1;12764:2;12744:18;;;12737:30;12803:17;12783:18;;;12776:45;12838:18;;73663:25:0;;;;;;;;70313:528;70395:13;70456:8;70424:40;;;;;;;;:::i;:::-;:28;:40;70420:59;;-1:-1:-1;;70466:13:0;;;;;;;;;;;;;;;;;;70313:528::o;70420:59::-;70530:8;70493:45;;;;;;;;:::i;:::-;:33;:45;70489:69;;-1:-1:-1;;70540:18:0;;;;;;;;;;;;;;;;;;70313:528::o;70489:69::-;70614:8;70572:50;;;;;;;;:::i;:::-;:38;:50;70568:79;;-1:-1:-1;;70624:23:0;;;;;;;;;;;;;;;;;;70313:528::o;70568:79::-;70704:8;70661:51;;;;;;;;:::i;:::-;:39;:51;70657:81;;-1:-1:-1;;70714:24:0;;;;;;;;;;;;;;;;;;70313:528::o;70657:81::-;70788:8;70752:44;;;;;;;;:::i;:::-;:32;:44;70748:67;;-1:-1:-1;;70798:17:0;;;;;;;;;;;;;;;;;;70313:528::o;70748:67::-;-1:-1:-1;;70825:9:0;;;;;;;;;-1:-1:-1;70825:9:0;;;70313:528::o;55129:142::-;55210:7;55236:18;;;:12;:18;;;;;:28;;55258:5;55236:21;:28::i;:::-;55229:35;55129:142;-1:-1:-1;;;55129:142:0:o;73460:129::-;73557:25;;;;;12725:2:1;73557:25:0;;;12707:21:1;12764:2;12744:18;;;12737:30;12803:17;12783:18;;;12776:45;73541:4:0;;12838:18:1;;73557:25:0;12523:339:1;69826:163:0;-1:-1:-1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;69942:40:0;;-1:-1:-1;;69942:40:0;;;;;;;;;;:::i;70847:1266::-;70960:23;56735:3;71009:15;;70987:6;:19;;;:37;;;;:::i;:::-;70986:49;;;;:::i;:::-;70960:75;;71068:15;71045:6;:19;;:38;;;;;;;:::i;:::-;;;;;;;;71094:20;71141:649;;;;;;;;71199:13;71141:649;;;;;;71244:6;:17;;;71141:649;;;;;;71293:6;:13;;;71141:649;;;;;;71339:6;:9;;;71141:649;;;;;;71379:6;:18;;;71141:649;;;;;;71426:6;:16;;;71141:649;;;;;;71474:6;:19;;;71141:649;;;;71547:6;:17;;;71141:649;;;;71599:15;71141:649;;;;71646:6;:19;;;71141:649;;;;;;71693:6;:15;;;71141:649;;;;71733:5;;:7;;;;;;;;;:::i;:::-;;;;-1:-1:-1;71141:649:0;;71117:683;;;;;;;;:::i;:::-;;;;;;;;;;;;;71094:706;;71872:6;:13;;;71816:290;;71845:13;71816:290;71899:7;71920:6;:17;;;71951:6;:18;;;71983:6;:16;;;72013:6;:19;;;72046:6;:17;;;72077:6;:19;;;71816:290;;;;;;;;;;;;:::i;:::-;;;;;;;;70950:1163;;70847:1266;;;:::o;72119:532::-;72229:36;72268:29;72289:7;72268:20;:29::i;:::-;72229:68;;72368:11;:24;;;72312:332;;72341:13;72312:332;72406:7;72427:11;:23;;;72464:11;:23;;;72501:11;:21;;;72536:11;:24;;;72574:11;:22;;;72610:11;:24;;;72312:332;;;;;;;;;;;;:::i;:::-;;;;;;;;72219:432;72119:532;;;:::o;57238:290::-;56668:26;46591:16;46602:4;46591:10;:16::i;:::-;56783:6:::1;57337:10;:26;;57329:55;;;::::0;::::1;::::0;;16599:2:1;57329:55:0::1;::::0;::::1;16581:21:1::0;16638:2;16618:18;;;16611:30;16677:18;16657;;;16650:46;16713:18;;57329:55:0::1;16397:340:1::0;57329:55:0::1;57415:15;::::0;;57440:28;;;;57483:38:::1;::::0;;16916:25:1;;;16972:2;16957:18;;16950:34;;;57483:38:0::1;::::0;16889:18:1;57483:38:0::1;;;;;;;;57319:209;57238:290:::0;;:::o;57899:264::-;56668:26;46591:16;46602:4;46591:10;:16::i;:::-;58024:14:::1;::::0;;58048:34;;;;58097:59:::1;::::0;;16916:25:1;;;16972:2;16957:18;;16950:34;;;58097:59:0::1;::::0;16889:18:1;58097:59:0::1;16742:248:1::0;72657:472:0;72978:144;;;17310:10:1;17298:23;;17280:42;;72978:144:0;17419:15:1;;;17414:2;17399:18;;17392:43;17471:15;;;17451:18;;;17444:43;17518:2;17503:18;;17496:34;;;17561:3;17546:19;;17539:35;;;17605:3;17590:19;;17583:35;;;72978:144:0;;;;;;;;;73005:13;;72978:144;;;;;17267:3:1;72978:144:0;;;72657:472;;;;;;;;;:::o;55439:131::-;55510:7;55536:18;;;:12;:18;;;;;:27;;:25;:27::i;48769:138::-;48002:7;48028:12;;;;;;;;;;:22;;;46591:16;46602:4;46591:10;:16::i;:::-;48874:26:::1;48886:4;48892:7;48874:11;:26::i;46692:202::-:0;46777:4;46800:47;;;46815:32;46800:47;;:87;;-1:-1:-1;38607:25:0;38592:40;;;;46851:36;38493:146;47326:103;47392:30;47403:4;22402:10;47392;:30::i;:::-;47326:103;:::o;51604:653::-;51779:4;51765:19;;;;51761:32;;51604:653;;;:::o;51761:32::-;51865:5;51874:1;51865:10;51861:23;;51604:653;;;:::o;51861:23::-;51897:20;;;;;51893:358;;52077:12;52094:2;:7;;52109:5;52094:25;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;52076:43;;;52141:7;52133:39;;;;;;;18041:2:1;52133:39:0;;;18023:21:1;18080:2;18060:18;;;18053:30;18119:21;18099:18;;;18092:49;18158:18;;52133:39:0;17839:343:1;51893:358:0;52203:37;:26;;;52230:2;52234:5;52203:26;:37::i;55672:257::-;55758:4;55774:12;55789:31;55806:4;55812:7;55789:16;:31::i;:::-;55774:46;;55834:7;55830:69;;;55857:18;;;;:12;:18;;;;;:31;;55880:7;55857:22;:31::i;:::-;;55915:7;55672:257;-1:-1:-1;;;55672:257:0:o;56032:262::-;56119:4;56135:12;56150:32;56168:4;56174:7;56150:17;:32::i;:::-;56135:47;;56196:7;56192:72;;;56219:18;;;;:12;:18;;;;;:34;;56245:7;56219:25;:34::i;33105:156::-;33179:7;33229:22;33233:3;33245:5;33229:3;:22::i;32648:115::-;32711:7;32737:19;32745:3;28087:18;;28005:107;47559:197;47058:4;47081:12;;;;;;;;;;;:29;;;;;;;;;;;;;47642:108;;47692:47;;;;;18391:42:1;18379:55;;47692:47:0;;;18361:74:1;18451:18;;;18444:34;;;18334:18;;47692:47:0;18187:297:1;47642:108:0;47559:197;;:::o;39809:160::-;39918:43;;;39933:14;18379:55:1;;39918:43:0;;;18361:74:1;18451:18;;;;18444:34;;;39918:43:0;;;;;;;;;;18334:18:1;;;;39918:43:0;;;;;;;;;;;;;;39891:71;;39911:5;;39891:19;:71::i;50306:316::-;50383:4;47081:12;;;;;;;;;;;:29;;;;;;;;;;;;;50399:217;;50442:6;:12;;;;;;;;;;;:29;;;;;;;;;;:36;;;;50474:4;50442:36;;;50524:12;22402:10;;22323:96;50524:12;50497:40;;50515:7;50497:40;;50509:4;50497:40;;;;;;;;;;-1:-1:-1;50558:4:0;50551:11;;50399:217;-1:-1:-1;50600:5:0;50593:12;;31847:150;31917:4;31940:50;31945:3;31965:23;;;31940:4;:50::i;50857:317::-;50935:4;47081:12;;;;;;;;;;;:29;;;;;;;;;;;;;50951:217;;;51025:5;50993:12;;;;;;;;;;;:29;;;;;;;;;;;:37;;;;;;51049:40;22402:10;;50993:12;;51049:40;;51025:5;51049:40;-1:-1:-1;51110:4:0;51103:11;;32165:156;32238:4;32261:53;32269:3;32289:23;;;32261:7;:53::i;28454:118::-;28521:7;28547:3;:11;;28559:5;28547:18;;;;;;;;:::i;:::-;;;;;;;;;28540:25;;28454:118;;;;:::o;42565:629::-;42984:23;43010:33;:27;;;43038:4;43010:27;:33::i;:::-;42984:59;;43057:10;:17;43078:1;43057:22;;:57;;;;;43095:10;43084:30;;;;;;;;;;;;:::i;:::-;43083:31;43057:57;43053:135;;;43137:40;;;;;8086:42:1;8074:55;;43137:40:0;;;8056:74:1;8029:18;;43137:40:0;7910:226:1;25772:406:0;25835:4;27891:21;;;:14;;;:21;;;;;;25851:321;;-1:-1:-1;25893:23:0;;;;;;;;:11;:23;;;;;;;;;;;;;26075:18;;26051:21;;;:14;;;:21;;;;;;:42;;;;26107:11;;26346:1368;26412:4;26541:21;;;:14;;;:21;;;;;;26577:13;;26573:1135;;26944:18;26965:12;26976:1;26965:8;:12;:::i;:::-;27011:18;;26944:33;;-1:-1:-1;26991:17:0;;27011:22;;27032:1;;27011:22;:::i;:::-;26991:42;;27066:9;27052:10;:23;27048:378;;27095:17;27115:3;:11;;27127:9;27115:22;;;;;;;;:::i;:::-;;;;;;;;;27095:42;;27262:9;27236:3;:11;;27248:10;27236:23;;;;;;;;:::i;:::-;;;;;;;;;;;;:35;;;;27375:25;;;:14;;;:25;;;;;:36;;;27048:378;27504:17;;:3;;:17;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;27607:3;:14;;:21;27622:5;27607:21;;;;;;;;;;;27600:28;;;27650:4;27643:11;;;;;;;26573:1135;27692:5;27685:12;;;;;18108:151;18183:12;18214:38;18236:6;18244:4;18250:1;18183:12;18824;18838:23;18865:6;:11;;18884:5;18891:4;18865:31;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;18823:73;;;;18913:55;18940:6;18948:7;18957:10;18913:26;:55::i;:::-;18906:62;18583:392;-1:-1:-1;;;;;;18583:392:0:o;20028:582::-;20172:12;20201:7;20196:408;;20224:19;20232:10;20224:7;:19::i;:::-;20196:408;;;20448:17;;:22;:49;;;;-1:-1:-1;20474:18:0;;;;:23;20448:49;20444:119;;;20524:24;;;;;8086:42:1;8074:55;;20524:24:0;;;8056:74:1;8029:18;;20524:24:0;7910:226:1;20444:119:0;-1:-1:-1;20583:10:0;20576:17;;21146:516;21277:17;;:21;21273:383;;21505:10;21499:17;21561:15;21548:10;21544:2;21540:19;21533:44;21273:383;21628: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:154;907:42;900:5;896:54;889:5;886:65;876:93;;965:1;962;955:12;980:134;1048:20;;1077:31;1048:20;1077:31;:::i;:::-;980:134;;;:::o;1119:388::-;1187:6;1195;1248:2;1236:9;1227:7;1223:23;1219:32;1216:52;;;1264:1;1261;1254:12;1216:52;1303:9;1290:23;1322:31;1347:5;1322:31;:::i;:::-;1372:5;-1:-1:-1;1429:2:1;1414:18;;1401:32;1442:33;1401:32;1442:33;:::i;:::-;1494:7;1484:17;;;1119:388;;;;;:::o;1694:180::-;1753:6;1806:2;1794:9;1785:7;1781:23;1777:32;1774:52;;;1822:1;1819;1812:12;1774:52;-1:-1:-1;1845:23:1;;1694:180;-1:-1:-1;1694:180:1:o;1879:315::-;1947:6;1955;2008:2;1996:9;1987:7;1983:23;1979:32;1976:52;;;2024:1;2021;2014:12;1976:52;2060:9;2047:23;2037:33;;2120:2;2109:9;2105:18;2092:32;2133:31;2158:5;2133:31;:::i;2199:184::-;2251:77;2248:1;2241:88;2348:4;2345:1;2338:15;2372:4;2369:1;2362:15;2388:255;2460:2;2454:9;2502:6;2490:19;;2539:18;2524:34;;2560:22;;;2521:62;2518:88;;;2586:18;;:::i;:::-;2622:2;2615:22;2388:255;:::o;2648:247::-;2715:2;2709:9;2757:3;2745:16;;2791:18;2776:34;;2812:22;;;2773:62;2770:88;;;2838:18;;:::i;2900:777::-;2942:5;2995:3;2988:4;2980:6;2976:17;2972:27;2962:55;;3013:1;3010;3003:12;2962:55;3049:6;3036:20;3075:18;3112:2;3108;3105:10;3102:36;;;3118:18;;:::i;:::-;3252:2;3246:9;3314:4;3306:13;;3157:66;3302:22;;;3326:2;3298:31;3294:40;3282:53;;;3350:18;;;3370:22;;;3347:46;3344:72;;;3396:18;;:::i;:::-;3436:10;3432:2;3425:22;3471:2;3463:6;3456:18;3517:3;3510:4;3505:2;3497:6;3493:15;3489:26;3486:35;3483:55;;;3534:1;3531;3524:12;3483:55;3598:2;3591:4;3583:6;3579:17;3572:4;3564:6;3560:17;3547:54;3645:1;3638:4;3633:2;3625:6;3621:15;3617:26;3610:37;3665:6;3656:15;;;;;;2900:777;;;;:::o;3682:455::-;3759:6;3767;3820:2;3808:9;3799:7;3795:23;3791:32;3788:52;;;3836:1;3833;3826:12;3788:52;3876:9;3863:23;3909:18;3901:6;3898:30;3895:50;;;3941:1;3938;3931:12;3895:50;3964:49;4005:7;3996:6;3985:9;3981:22;3964:49;:::i;:::-;3954:59;;;4063:2;4052:9;4048:18;4035:32;4076:31;4101:5;4076:31;:::i;4142:121::-;4227:10;4220:5;4216:22;4209:5;4206:33;4196:61;;4253:1;4250;4243:12;4268:132;4335:20;;4364:30;4335:20;4364:30;:::i;4405:118::-;4491:5;4484:13;4477:21;4470:5;4467:32;4457:60;;4513:1;4510;4503:12;4528:128;4593:20;;4622:28;4593:20;4622:28;:::i;4661:806::-;4720:5;4768:6;4756:9;4751:3;4747:19;4743:32;4740:52;;;4788:1;4785;4778:12;4740:52;4810:22;;:::i;:::-;4801:31;;4855:28;4873:9;4855:28;:::i;:::-;4848:5;4841:43;4916:38;4950:2;4939:9;4935:18;4916:38;:::i;:::-;4911:2;4904:5;4900:14;4893:62;4987:38;5021:2;5010:9;5006:18;4987:38;:::i;:::-;4982:2;4975:5;4971:14;4964:62;5058:38;5092:2;5081:9;5077:18;5058:38;:::i;:::-;5053:2;5046:5;5042:14;5035:62;5130:39;5164:3;5153:9;5149:19;5130:39;:::i;:::-;5124:3;5117:5;5113:15;5106:64;5231:3;5220:9;5216:19;5203:33;5197:3;5190:5;5186:15;5179:58;5298:3;5287:9;5283:19;5270:33;5264:3;5257:5;5253:15;5246:58;5337:36;5368:3;5357:9;5353:19;5337:36;:::i;:::-;5331:3;5324:5;5320:15;5313:61;5393:3;5456:2;5445:9;5441:18;5428:32;5423:2;5416:5;5412:14;5405:56;;4661:806;;;;:::o;5472:237::-;5560:6;5613:3;5601:9;5592:7;5588:23;5584:33;5581:53;;;5630:1;5627;5620:12;5581:53;5653:50;5695:7;5684:9;5653:50;:::i;5714:320::-;5782:6;5835:2;5823:9;5814:7;5810:23;5806:32;5803:52;;;5851:1;5848;5841:12;5803:52;5891:9;5878:23;5924:18;5916:6;5913:30;5910:50;;;5956:1;5953;5946:12;5910:50;5979:49;6020:7;6011:6;6000:9;5996:22;5979:49;:::i;:::-;5969:59;5714:320;-1:-1:-1;;;;5714:320:1:o;6039:273::-;6115:6;6168:2;6156:9;6147:7;6143:23;6139:32;6136:52;;;6184:1;6181;6174:12;6136:52;6223:9;6210:23;6262:1;6255:5;6252:12;6242:40;;6278:1;6275;6268:12;6317:250;6402:1;6412:113;6426:6;6423:1;6420:13;6412:113;;;6502:11;;;6496:18;6483:11;;;6476:39;6448:2;6441:10;6412:113;;;-1:-1:-1;;6559:1:1;6541:16;;6534:27;6317:250::o;6572:330::-;6614:3;6652:5;6646:12;6679:6;6674:3;6667:19;6695:76;6764:6;6757:4;6752:3;6748:14;6741:4;6734:5;6730:16;6695:76;:::i;:::-;6816:2;6804:15;6821:66;6800:88;6791:98;;;;6891:4;6787:109;;6572:330;-1:-1:-1;;6572:330:1:o;6907:220::-;7056:2;7045:9;7038:21;7019:4;7076:45;7117:2;7106:9;7102:18;7094:6;7076:45;:::i;7132:388::-;7209:6;7217;7270:2;7258:9;7249:7;7245:23;7241:32;7238:52;;;7286:1;7283;7276:12;7238:52;7326:9;7313:23;7359:18;7351:6;7348:30;7345:50;;;7391:1;7388;7381:12;7345:50;7414:49;7455:7;7446:6;7435:9;7431:22;7414:49;:::i;:::-;7404:59;7510:2;7495:18;;;;7482:32;;-1:-1:-1;;;;7132:388:1:o;7525:248::-;7593:6;7601;7654:2;7642:9;7633:7;7629:23;7625:32;7622:52;;;7670:1;7667;7660:12;7622:52;-1:-1:-1;;7693:23:1;;;7763:2;7748:18;;;7735:32;;-1:-1:-1;7525:248:1:o;8240:1373::-;8471:13;;8217:10;8206:22;8194:35;;8440:3;8425:19;;8543:4;8535:6;8531:17;8525:24;8558:53;8605:4;8594:9;8590:20;8576:12;8217:10;8206:22;8194:35;;8141:94;8558:53;;8660:4;8652:6;8648:17;8642:24;8675:56;8725:4;8714:9;8710:20;8694:14;7855:42;7844:54;7832:67;;7778:127;8675:56;;8780:4;8772:6;8768:17;8762:24;8795:56;8845:4;8834:9;8830:20;8814:14;7855:42;7844:54;7832:67;;7778:127;8795:56;;8900:4;8892:6;8888:17;8882:24;8915:56;8965:4;8954:9;8950:20;8934:14;7855:42;7844:54;7832:67;;7778:127;8915:56;;9020:4;9012:6;9008:17;9002:24;9035:56;9085:4;9074:9;9070:20;9054:14;7855:42;7844:54;7832:67;;7778:127;9035:56;;9147:4;9139:6;9135:17;9129:24;9122:4;9111:9;9107:20;9100:54;9210:4;9202:6;9198:17;9192:24;9185:4;9174:9;9170:20;9163:54;9236:6;9296:2;9288:6;9284:15;9278:22;9273:2;9262:9;9258:18;9251:50;;9320:6;9375:2;9367:6;9363:15;9357:22;9388:51;9435:2;9424:9;9420:18;9404:14;421:13;414:21;402:34;;351:91;9388:51;-1:-1:-1;;9458:6:1;9506:15;;;9500:22;9480:18;;;9473:50;9542:6;9590:15;;;9584:22;9564:18;;;;9557:50;;;;8240:1373;:::o;9618:440::-;9724:6;9732;9740;9793:3;9781:9;9772:7;9768:23;9764:33;9761:53;;;9810:1;9807;9800:12;9761:53;9846:9;9833:23;9823:33;;9906:2;9895:9;9891:18;9878:32;9919:31;9944:5;9919:31;:::i;:::-;9969:5;-1:-1:-1;9993:59:1;10044:7;10039:2;10024:18;;9993:59;:::i;:::-;9983:69;;9618:440;;;;;:::o;10063:523::-;10149:6;10157;10165;10218:2;10206:9;10197:7;10193:23;10189:32;10186:52;;;10234:1;10231;10224:12;10186:52;10270:9;10257:23;10247:33;;10330:2;10319:9;10315:18;10302:32;10343:31;10368:5;10343:31;:::i;:::-;10393:5;-1:-1:-1;10449:2:1;10434:18;;10421:32;10476:18;10465:30;;10462:50;;;10508:1;10505;10498:12;10462:50;10531:49;10572:7;10563:6;10552:9;10548:22;10531:49;:::i;:::-;10521:59;;;10063:523;;;;;:::o;10776:1087::-;10906:6;10914;10922;10930;10938;10946;10954;10962;10970;11023:3;11011:9;11002:7;10998:23;10994:33;10991:53;;;11040:1;11037;11030:12;10991:53;11076:9;11063:23;11053:33;;11136:2;11125:9;11121:18;11108:32;11149:31;11174:5;11149:31;:::i;:::-;11199:5;-1:-1:-1;11256:2:1;11241:18;;11228:32;11269:33;11228:32;11269:33;:::i;:::-;11321:7;-1:-1:-1;11380:2:1;11365:18;;11352:32;11393;11352;11393;:::i;:::-;11444:7;-1:-1:-1;11503:3:1;11488:19;;11475:33;11517;11475;11517;:::i;:::-;11569:7;-1:-1:-1;11628:3:1;11613:19;;11600:33;11642;11600;11642;:::i;:::-;11694:7;11684:17;;;11748:3;11737:9;11733:19;11720:33;11710:43;;11800:3;11789:9;11785:19;11772:33;11762:43;;11852:3;11841:9;11837:19;11824:33;11814:43;;10776:1087;;;;;;;;;;;:::o;11868:247::-;11927:6;11980:2;11968:9;11959:7;11955:23;11951:32;11948:52;;;11996:1;11993;11986:12;11948:52;12035:9;12022:23;12054:31;12079:5;12054:31;:::i;12867:184::-;12919:77;12916:1;12909:88;13016:4;13013:1;13006:15;13040:4;13037:1;13030:15;13056:136;13134:13;;13156:30;13134:13;13156:30;:::i;13197:138::-;13276:13;;13298:31;13276:13;13298:31;:::i;13340:132::-;13416:13;;13438:28;13416:13;13438:28;:::i;13477:1183::-;13580:6;13633:3;13621:9;13612:7;13608:23;13604:33;13601:53;;;13650:1;13647;13640:12;13601:53;13676:17;;:::i;:::-;13716:39;13745:9;13716:39;:::i;:::-;13709:5;13702:54;13788:48;13832:2;13821:9;13817:18;13788:48;:::i;:::-;13783:2;13776:5;13772:14;13765:72;13869:49;13914:2;13903:9;13899:18;13869:49;:::i;:::-;13864:2;13857:5;13853:14;13846:73;13951:49;13996:2;13985:9;13981:18;13951:49;:::i;:::-;13946:2;13939:5;13935:14;13928:73;14034:50;14079:3;14068:9;14064:19;14034:50;:::i;:::-;14028:3;14021:5;14017:15;14010:75;14118:50;14163:3;14152:9;14148:19;14118:50;:::i;:::-;14112:3;14105:5;14101:15;14094:75;14223:3;14212:9;14208:19;14202:26;14196:3;14189:5;14185:15;14178:51;14283:3;14272:9;14268:19;14262:26;14256:3;14249:5;14245:15;14238:51;14308:3;14364:2;14353:9;14349:18;14343:25;14338:2;14331:5;14327:14;14320:49;;14388:3;14423:46;14465:2;14454:9;14450:18;14423:46;:::i;:::-;14407:14;;;14400:70;14489:3;14530:18;;;14524:25;14508:14;;;14501:49;14569:3;14610:18;;;14604:25;14588:14;;;14581:49;;;;-1:-1:-1;14411:5:1;13477:1183;-1:-1:-1;13477:1183:1:o;14665:184::-;14717:77;14714:1;14707:88;14814:4;14811:1;14804:15;14838:4;14835:1;14828:15;14854:168;14927:9;;;14958;;14975:15;;;14969:22;;14955:37;14945:71;;14996:18;;:::i;15027:274::-;15067:1;15093;15083:189;;15128:77;15125:1;15118:88;15229:4;15226:1;15219:15;15257:4;15254:1;15247:15;15083:189;-1:-1:-1;15286:9:1;;15027:274::o;15306:128::-;15373:9;;;15394:11;;;15391:37;;;15408:18;;:::i;15439:195::-;15478:3;15509:66;15502:5;15499:77;15496:103;;15579:18;;:::i;:::-;-1:-1:-1;15626:1:1;15615:13;;15439:195::o;15639:753::-;15946:3;15935:9;15928:22;15909:4;15967:46;16008:3;15997:9;15993:19;15985:6;15967:46;:::i;:::-;16061:10;16049:23;;;;16044:2;16029:18;;16022:51;-1:-1:-1;16092:42:1;16170:15;;;16165:2;16150:18;;16143:43;16222:15;;;;16217:2;16202:18;;16195:43;16269:3;16254:19;;16247:35;;;;16313:3;16298:19;;16291:35;16370:14;;16363:22;16357:3;16342:19;;;16335:51;15959:54;15639:753;-1:-1:-1;15639:753:1:o;18791:184::-;18843:77;18840:1;18833:88;18940:4;18937:1;18930:15;18964:4;18961:1;18954:15;18980:245;19047:6;19100:2;19088:9;19079:7;19075:23;19071:32;19068:52;;;19116:1;19113;19106:12;19068:52;19148:9;19142:16;19167:28;19189:5;19167:28;:::i;19230:184::-;19282:77;19279:1;19272:88;19379:4;19376:1;19369:15;19403:4;19400:1;19393:15;19419:287;19548:3;19586:6;19580:13;19602:66;19661:6;19656:3;19649:4;19641:6;19637:17;19602:66;:::i;:::-;19684:16;;;;;19419:287;-1:-1:-1;;19419:287: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":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"},{"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":[{"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":[],"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":[],"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":"pure","type":"function"},{"inputs":[{"internalType":"enum FastBridge.BridgeStatus","name":"keyValue","type":"uint8"}],"name":"getEnumKeyByValue","outputs":[{"internalType":"string","name":"","type":"string"}],"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":[{"internalType":"bytes32","name":"transactionId","type":"bytes32"},{"internalType":"address","name":"relayer","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint32","name":"originChainId","type":"uint32"},{"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":"chainGasAmount","type":"uint256"}],"name":"mockBridgeRelayer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"transactionId","type":"bytes32"},{"internalType":"address","name":"sender","type":"address"},{"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":"mockBridgeRequest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"transactionId","type":"bytes32"},{"internalType":"address","name":"sender","type":"address"},{"internalType":"bytes","name":"request","type":"bytes"}],"name":"mockBridgeRequestRaw","outputs":[],"stateMutability":"nonpayable","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":"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":"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":{"bridge((uint32,address,address,address,address,uint256,uint256,bool,uint256))":{"notice":"Initiates bridge on origin chain to be relayed by off-chain relayer"},"chainGasAmount()":{"notice":"Chain gas amount to forward as rebate if requested"},"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"},"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"},"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":{"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"}},"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"}},"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"}},"refund(bytes)":{"params":{"request":"The encoded bridge transaction to refund"}},"relay(bytes)":{"params":{"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":"to prevent replays"}},"version":1},"metadata":"{\"compiler\":{\"version\":\"0.8.20+commit.a1b79de6\"},\"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\":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\"},{\"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\":[{\"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\":[],\"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\":[],\"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\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"enum FastBridge.BridgeStatus\",\"name\":\"keyValue\",\"type\":\"uint8\"}],\"name\":\"getEnumKeyByValue\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"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\":[{\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"originChainId\",\"type\":\"uint32\"},{\"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\":\"chainGasAmount\",\"type\":\"uint256\"}],\"name\":\"mockBridgeRelayer\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"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\":\"mockBridgeRequest\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"request\",\"type\":\"bytes\"}],\"name\":\"mockBridgeRequestRaw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"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\":\"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\":\"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\":{\"bridge((uint32,address,address,address,address,uint256,uint256,bool,uint256))\":{\"params\":{\"params\":\"The parameters required to bridge\"}},\"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\"}},\"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\"}},\"refund(bytes)\":{\"params\":{\"request\":\"The encoded bridge transaction to refund\"}},\"relay(bytes)\":{\"params\":{\"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\":\"to prevent replays\"}},\"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\"},\"chainGasAmount()\":{\"notice\":\"Chain gas amount to forward as rebate if requested\"},\"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\"},\"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\"},\"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/FastBridgeMock.sol\":\"FastBridgeMock\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeMock.sol\":{\"keccak256\":\"0xb58951ea9ccf93b597bddaa7b405278a10398c87bf748538ac7a67cd65184783\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://bb67eff4aa6731cbb158660257e9091bbc8135d228ceb240943772f9b5ada90e\",\"dweb:/ipfs/QmQbxcMCxtY5dWAJoPBpipMUjrN5zMvhQDCVkcMpRsn9LP\"]}},\"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","bridge((uint32,address,address,address,address,uint256,uint256,bool,uint256))":"45851694","canClaim(bytes32,address)":"aa9641ab","chainGasAmount()":"e00a83e0","claim(bytes,address)":"41fcb612","deployBlock()":"a3ec191a","dispute(bytes32)":"add98c70","getBridgeTransaction(bytes)":"ac11fb1a","getEnumKeyByValue(uint8)":"85ad903d","getRoleAdmin(bytes32)":"248a9ca3","getRoleMember(bytes32,uint256)":"9010d07c","getRoleMemberCount(bytes32)":"ca15c873","grantRole(bytes32,address)":"2f2ff15d","hasRole(bytes32,address)":"91d14854","mockBridgeRelayer(bytes32,address,address,uint32,address,address,uint256,uint256,uint256)":"c72870cc","mockBridgeRequest(bytes32,address,(uint32,address,address,address,address,uint256,uint256,bool,uint256))":"acaebbf1","mockBridgeRequestRaw(bytes32,address,bytes)":"aedf009d","nonce()":"affed0e0","protocolFeeRate()":"58f85880","protocolFees(address)":"dcf844a7","prove(bytes,bytes32)":"886d36ff","refund(bytes)":"5eb7d946","relay(bytes)":"8f0d6f17","renounceRole(bytes32,address)":"36568abe","revokeRole(bytes32,address)":"d547741f","setChainGasAmount(uint256)":"b250fe6b","setProtocolFeeRate(uint256)":"b13aa2d6","supportsInterface(bytes4)":"01ffc9a7","sweepProtocolFees(address,address)":"06f333f2"}},"solidity/FastBridgeMock.sol:IAccessControl":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.20 ^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 pure 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/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// 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/FastBridge.sol\n\ncontract FastBridge is IFastBridge, Admin {\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 enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeStatus) public bridgeStatuses;\n /// @notice Proof of relayed bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeProof) public bridgeProofs;\n /// @notice Whether bridge has been relayed on destination chain\n mapping(bytes32 =\u003e bool) public bridgeRelays;\n\n /// @dev to prevent replays\n uint256 public nonce;\n // @dev 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 /// @notice Pulls a requested token from the user to the requested recipient.\n /// @dev Be careful of re-entrancy issues when msg.value \u003e 0 and recipient != address(this)\n function _pullToken(address recipient, address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token != UniversalTokenLib.ETH_ADDRESS) {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(recipient);\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, recipient, amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(recipient) - amountPulled;\n } else {\n // Otherwise, we need to check that ETH amount matches msg.value\n if (amount != msg.value) revert MsgValueIncorrect();\n // Transfer value to recipient if not this address\n if (recipient != address(this)) token.universalTransfer(recipient, amount);\n // We will forward msg.value in the external call later, if recipient is not this contract\n amountPulled = msg.value;\n }\n }\n\n /// @inheritdoc IFastBridge\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n // check bridge params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\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\n // transfer tokens to bridge contract\n // @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(address(this), 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 BridgeTransaction({\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 sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n\n // check haven't exceeded deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n\n // mark bridge transaction as relayed\n if (bridgeRelays[transactionId]) revert TransactionRelayed();\n bridgeRelays[transactionId] = true;\n\n // transfer tokens to recipient on destination chain and gas rebate if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n uint256 rebate = chainGasAmount;\n if (!transaction.sendChainGas) {\n // forward erc20\n rebate = 0;\n _pullToken(to, token, amount);\n } else if (token == UniversalTokenLib.ETH_ADDRESS) {\n // lump in gas rebate into amount in native gas token\n _pullToken(to, token, amount + rebate);\n } else {\n // forward erc20 then forward gas rebate in native gas token\n _pullToken(to, token, amount);\n _pullToken(to, UniversalTokenLib.ETH_ADDRESS, rebate);\n }\n\n emit BridgeRelayed(\n transactionId,\n msg.sender,\n to,\n transaction.originChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n rebate\n );\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n // update bridge tx status given proof provided\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = BridgeStatus.RELAYER_PROVED;\n bridgeProofs[transactionId] = BridgeProof({timestamp: uint96(block.timestamp), relayer: msg.sender}); // overflow ok\n\n emit BridgeProofProvided(transactionId, msg.sender, destTxHash);\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint96(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint96).max but\n /// proof.timestamp \u003c type(uint96).max via unchecked statement\n /// @param proof The bridge proof\n /// @return delta Time delta since proof submitted\n function _timeSince(BridgeProof memory proof) internal view returns (uint256 delta) {\n unchecked {\n delta = uint96(block.timestamp) - proof.timestamp;\n }\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != relayer) revert SenderIncorrect();\n return _timeSince(proof) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != msg.sender) revert SenderIncorrect();\n if (_timeSince(proof) \u003c= DISPUTE_PERIOD) revert DisputePeriodNotPassed();\n\n bridgeStatuses[transactionId] = 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, msg.sender, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeProofs[transactionId]) \u003e DISPUTE_PERIOD) revert DisputePeriodPassed();\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n delete bridgeProofs[transactionId];\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 BridgeTransaction memory transaction = getBridgeTransaction(request);\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 // set status to refunded if still in requested state\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = 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\n// test/FastBridgeMock.sol\n\ncontract FastBridgeMock is IFastBridge, Admin {\n // @dev 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 /// @dev to prevent replays\n uint256 public nonce;\n\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n // used for testing in go.\n // see: https://ethereum.stackexchange.com/questions/21155/how-to-expose-enum-in-solidity-contract\n // make sure to update fastbridge/status.go if this changes\n // or underliyng enum changes.\n //\n // TODO: a foundry test should be added to ensure this is always in sync.\n function getEnumKeyByValue(FastBridge.BridgeStatus keyValue) public pure returns (string memory) {\n if (FastBridge.BridgeStatus.NULL == keyValue) return \"NULL\";\n if (FastBridge.BridgeStatus.REQUESTED == keyValue) return \"REQUESTED\";\n if (FastBridge.BridgeStatus.RELAYER_PROVED == keyValue) return \"RELAYER_PROVED\";\n if (FastBridge.BridgeStatus.RELAYER_CLAIMED == keyValue) return \"RELAYER_CLAIMED\";\n if (FastBridge.BridgeStatus.REFUNDED == keyValue) return \"REFUNDED\";\n return \"\";\n }\n\n function mockBridgeRequest(bytes32 transactionId, address sender, BridgeParams memory params) external {\n uint256 originFeeAmount = (params.originAmount * protocolFeeRate) / FEE_BPS;\n params.originAmount -= originFeeAmount;\n\n bytes memory request = abi.encode(\n BridgeTransaction({\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: params.originAmount, // includes relayer fee\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n params.originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n function mockBridgeRequestRaw(bytes32 transactionId, address sender, bytes memory request) external {\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n emit BridgeRequested(\n transactionId,\n transaction.originSender,\n request,\n transaction.destChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n transaction.sendChainGas\n );\n }\n\n function mockBridgeRelayer(\n bytes32 transactionId,\n address relayer,\n address to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n )\n external\n {\n emit BridgeRelayed(\n transactionId, relayer, to, originChainId, originToken, destToken, originAmount, destAmount, chainGasAmount\n );\n }\n\n function bridge(BridgeParams memory params) external payable {\n revert(\"not implemented\");\n }\n\n function relay(bytes memory request) external payable {\n revert(\"not implemented\");\n }\n\n function prove(bytes memory request, bytes32 destTxHash) external {\n revert(\"not implemented\");\n }\n\n function canClaim(bytes32 transactionid, address relayer) external view returns (bool) {\n revert(\"not implemented\");\n }\n\n function claim(bytes memory request, address to) external {\n revert(\"not implemented\");\n }\n\n function dispute(bytes32 transactionId) external {\n revert(\"not implemented\");\n }\n\n function refund(bytes memory request) external {\n revert(\"not implemented\");\n }\n}\n","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","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.20+commit.a1b79de6\"},\"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/FastBridgeMock.sol\":\"IAccessControl\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeMock.sol\":{\"keccak256\":\"0xb58951ea9ccf93b597bddaa7b405278a10398c87bf748538ac7a67cd65184783\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://bb67eff4aa6731cbb158660257e9091bbc8135d228ceb240943772f9b5ada90e\",\"dweb:/ipfs/QmQbxcMCxtY5dWAJoPBpipMUjrN5zMvhQDCVkcMpRsn9LP\"]}},\"version\":1}"},"hashes":{"getRoleAdmin(bytes32)":"248a9ca3","grantRole(bytes32,address)":"2f2ff15d","hasRole(bytes32,address)":"91d14854","renounceRole(bytes32,address)":"36568abe","revokeRole(bytes32,address)":"d547741f"}},"solidity/FastBridgeMock.sol:IAccessControlEnumerable":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.20 ^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 pure 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/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// 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/FastBridge.sol\n\ncontract FastBridge is IFastBridge, Admin {\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 enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeStatus) public bridgeStatuses;\n /// @notice Proof of relayed bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeProof) public bridgeProofs;\n /// @notice Whether bridge has been relayed on destination chain\n mapping(bytes32 =\u003e bool) public bridgeRelays;\n\n /// @dev to prevent replays\n uint256 public nonce;\n // @dev 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 /// @notice Pulls a requested token from the user to the requested recipient.\n /// @dev Be careful of re-entrancy issues when msg.value \u003e 0 and recipient != address(this)\n function _pullToken(address recipient, address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token != UniversalTokenLib.ETH_ADDRESS) {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(recipient);\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, recipient, amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(recipient) - amountPulled;\n } else {\n // Otherwise, we need to check that ETH amount matches msg.value\n if (amount != msg.value) revert MsgValueIncorrect();\n // Transfer value to recipient if not this address\n if (recipient != address(this)) token.universalTransfer(recipient, amount);\n // We will forward msg.value in the external call later, if recipient is not this contract\n amountPulled = msg.value;\n }\n }\n\n /// @inheritdoc IFastBridge\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n // check bridge params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\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\n // transfer tokens to bridge contract\n // @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(address(this), 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 BridgeTransaction({\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 sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n\n // check haven't exceeded deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n\n // mark bridge transaction as relayed\n if (bridgeRelays[transactionId]) revert TransactionRelayed();\n bridgeRelays[transactionId] = true;\n\n // transfer tokens to recipient on destination chain and gas rebate if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n uint256 rebate = chainGasAmount;\n if (!transaction.sendChainGas) {\n // forward erc20\n rebate = 0;\n _pullToken(to, token, amount);\n } else if (token == UniversalTokenLib.ETH_ADDRESS) {\n // lump in gas rebate into amount in native gas token\n _pullToken(to, token, amount + rebate);\n } else {\n // forward erc20 then forward gas rebate in native gas token\n _pullToken(to, token, amount);\n _pullToken(to, UniversalTokenLib.ETH_ADDRESS, rebate);\n }\n\n emit BridgeRelayed(\n transactionId,\n msg.sender,\n to,\n transaction.originChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n rebate\n );\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n // update bridge tx status given proof provided\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = BridgeStatus.RELAYER_PROVED;\n bridgeProofs[transactionId] = BridgeProof({timestamp: uint96(block.timestamp), relayer: msg.sender}); // overflow ok\n\n emit BridgeProofProvided(transactionId, msg.sender, destTxHash);\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint96(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint96).max but\n /// proof.timestamp \u003c type(uint96).max via unchecked statement\n /// @param proof The bridge proof\n /// @return delta Time delta since proof submitted\n function _timeSince(BridgeProof memory proof) internal view returns (uint256 delta) {\n unchecked {\n delta = uint96(block.timestamp) - proof.timestamp;\n }\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != relayer) revert SenderIncorrect();\n return _timeSince(proof) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != msg.sender) revert SenderIncorrect();\n if (_timeSince(proof) \u003c= DISPUTE_PERIOD) revert DisputePeriodNotPassed();\n\n bridgeStatuses[transactionId] = 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, msg.sender, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeProofs[transactionId]) \u003e DISPUTE_PERIOD) revert DisputePeriodPassed();\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n delete bridgeProofs[transactionId];\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 BridgeTransaction memory transaction = getBridgeTransaction(request);\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 // set status to refunded if still in requested state\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = 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\n// test/FastBridgeMock.sol\n\ncontract FastBridgeMock is IFastBridge, Admin {\n // @dev 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 /// @dev to prevent replays\n uint256 public nonce;\n\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n // used for testing in go.\n // see: https://ethereum.stackexchange.com/questions/21155/how-to-expose-enum-in-solidity-contract\n // make sure to update fastbridge/status.go if this changes\n // or underliyng enum changes.\n //\n // TODO: a foundry test should be added to ensure this is always in sync.\n function getEnumKeyByValue(FastBridge.BridgeStatus keyValue) public pure returns (string memory) {\n if (FastBridge.BridgeStatus.NULL == keyValue) return \"NULL\";\n if (FastBridge.BridgeStatus.REQUESTED == keyValue) return \"REQUESTED\";\n if (FastBridge.BridgeStatus.RELAYER_PROVED == keyValue) return \"RELAYER_PROVED\";\n if (FastBridge.BridgeStatus.RELAYER_CLAIMED == keyValue) return \"RELAYER_CLAIMED\";\n if (FastBridge.BridgeStatus.REFUNDED == keyValue) return \"REFUNDED\";\n return \"\";\n }\n\n function mockBridgeRequest(bytes32 transactionId, address sender, BridgeParams memory params) external {\n uint256 originFeeAmount = (params.originAmount * protocolFeeRate) / FEE_BPS;\n params.originAmount -= originFeeAmount;\n\n bytes memory request = abi.encode(\n BridgeTransaction({\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: params.originAmount, // includes relayer fee\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n params.originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n function mockBridgeRequestRaw(bytes32 transactionId, address sender, bytes memory request) external {\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n emit BridgeRequested(\n transactionId,\n transaction.originSender,\n request,\n transaction.destChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n transaction.sendChainGas\n );\n }\n\n function mockBridgeRelayer(\n bytes32 transactionId,\n address relayer,\n address to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n )\n external\n {\n emit BridgeRelayed(\n transactionId, relayer, to, originChainId, originToken, destToken, originAmount, destAmount, chainGasAmount\n );\n }\n\n function bridge(BridgeParams memory params) external payable {\n revert(\"not implemented\");\n }\n\n function relay(bytes memory request) external payable {\n revert(\"not implemented\");\n }\n\n function prove(bytes memory request, bytes32 destTxHash) external {\n revert(\"not implemented\");\n }\n\n function canClaim(bytes32 transactionid, address relayer) external view returns (bool) {\n revert(\"not implemented\");\n }\n\n function claim(bytes memory request, address to) external {\n revert(\"not implemented\");\n }\n\n function dispute(bytes32 transactionId) external {\n revert(\"not implemented\");\n }\n\n function refund(bytes memory request) external {\n revert(\"not implemented\");\n }\n}\n","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","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.20+commit.a1b79de6\"},\"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/FastBridgeMock.sol\":\"IAccessControlEnumerable\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeMock.sol\":{\"keccak256\":\"0xb58951ea9ccf93b597bddaa7b405278a10398c87bf748538ac7a67cd65184783\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://bb67eff4aa6731cbb158660257e9091bbc8135d228ceb240943772f9b5ada90e\",\"dweb:/ipfs/QmQbxcMCxtY5dWAJoPBpipMUjrN5zMvhQDCVkcMpRsn9LP\"]}},\"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/FastBridgeMock.sol:IAdmin":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.20 ^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 pure 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/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// 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/FastBridge.sol\n\ncontract FastBridge is IFastBridge, Admin {\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 enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeStatus) public bridgeStatuses;\n /// @notice Proof of relayed bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeProof) public bridgeProofs;\n /// @notice Whether bridge has been relayed on destination chain\n mapping(bytes32 =\u003e bool) public bridgeRelays;\n\n /// @dev to prevent replays\n uint256 public nonce;\n // @dev 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 /// @notice Pulls a requested token from the user to the requested recipient.\n /// @dev Be careful of re-entrancy issues when msg.value \u003e 0 and recipient != address(this)\n function _pullToken(address recipient, address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token != UniversalTokenLib.ETH_ADDRESS) {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(recipient);\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, recipient, amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(recipient) - amountPulled;\n } else {\n // Otherwise, we need to check that ETH amount matches msg.value\n if (amount != msg.value) revert MsgValueIncorrect();\n // Transfer value to recipient if not this address\n if (recipient != address(this)) token.universalTransfer(recipient, amount);\n // We will forward msg.value in the external call later, if recipient is not this contract\n amountPulled = msg.value;\n }\n }\n\n /// @inheritdoc IFastBridge\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n // check bridge params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\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\n // transfer tokens to bridge contract\n // @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(address(this), 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 BridgeTransaction({\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 sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n\n // check haven't exceeded deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n\n // mark bridge transaction as relayed\n if (bridgeRelays[transactionId]) revert TransactionRelayed();\n bridgeRelays[transactionId] = true;\n\n // transfer tokens to recipient on destination chain and gas rebate if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n uint256 rebate = chainGasAmount;\n if (!transaction.sendChainGas) {\n // forward erc20\n rebate = 0;\n _pullToken(to, token, amount);\n } else if (token == UniversalTokenLib.ETH_ADDRESS) {\n // lump in gas rebate into amount in native gas token\n _pullToken(to, token, amount + rebate);\n } else {\n // forward erc20 then forward gas rebate in native gas token\n _pullToken(to, token, amount);\n _pullToken(to, UniversalTokenLib.ETH_ADDRESS, rebate);\n }\n\n emit BridgeRelayed(\n transactionId,\n msg.sender,\n to,\n transaction.originChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n rebate\n );\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n // update bridge tx status given proof provided\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = BridgeStatus.RELAYER_PROVED;\n bridgeProofs[transactionId] = BridgeProof({timestamp: uint96(block.timestamp), relayer: msg.sender}); // overflow ok\n\n emit BridgeProofProvided(transactionId, msg.sender, destTxHash);\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint96(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint96).max but\n /// proof.timestamp \u003c type(uint96).max via unchecked statement\n /// @param proof The bridge proof\n /// @return delta Time delta since proof submitted\n function _timeSince(BridgeProof memory proof) internal view returns (uint256 delta) {\n unchecked {\n delta = uint96(block.timestamp) - proof.timestamp;\n }\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != relayer) revert SenderIncorrect();\n return _timeSince(proof) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != msg.sender) revert SenderIncorrect();\n if (_timeSince(proof) \u003c= DISPUTE_PERIOD) revert DisputePeriodNotPassed();\n\n bridgeStatuses[transactionId] = 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, msg.sender, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeProofs[transactionId]) \u003e DISPUTE_PERIOD) revert DisputePeriodPassed();\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n delete bridgeProofs[transactionId];\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 BridgeTransaction memory transaction = getBridgeTransaction(request);\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 // set status to refunded if still in requested state\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = 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\n// test/FastBridgeMock.sol\n\ncontract FastBridgeMock is IFastBridge, Admin {\n // @dev 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 /// @dev to prevent replays\n uint256 public nonce;\n\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n // used for testing in go.\n // see: https://ethereum.stackexchange.com/questions/21155/how-to-expose-enum-in-solidity-contract\n // make sure to update fastbridge/status.go if this changes\n // or underliyng enum changes.\n //\n // TODO: a foundry test should be added to ensure this is always in sync.\n function getEnumKeyByValue(FastBridge.BridgeStatus keyValue) public pure returns (string memory) {\n if (FastBridge.BridgeStatus.NULL == keyValue) return \"NULL\";\n if (FastBridge.BridgeStatus.REQUESTED == keyValue) return \"REQUESTED\";\n if (FastBridge.BridgeStatus.RELAYER_PROVED == keyValue) return \"RELAYER_PROVED\";\n if (FastBridge.BridgeStatus.RELAYER_CLAIMED == keyValue) return \"RELAYER_CLAIMED\";\n if (FastBridge.BridgeStatus.REFUNDED == keyValue) return \"REFUNDED\";\n return \"\";\n }\n\n function mockBridgeRequest(bytes32 transactionId, address sender, BridgeParams memory params) external {\n uint256 originFeeAmount = (params.originAmount * protocolFeeRate) / FEE_BPS;\n params.originAmount -= originFeeAmount;\n\n bytes memory request = abi.encode(\n BridgeTransaction({\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: params.originAmount, // includes relayer fee\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n params.originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n function mockBridgeRequestRaw(bytes32 transactionId, address sender, bytes memory request) external {\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n emit BridgeRequested(\n transactionId,\n transaction.originSender,\n request,\n transaction.destChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n transaction.sendChainGas\n );\n }\n\n function mockBridgeRelayer(\n bytes32 transactionId,\n address relayer,\n address to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n )\n external\n {\n emit BridgeRelayed(\n transactionId, relayer, to, originChainId, originToken, destToken, originAmount, destAmount, chainGasAmount\n );\n }\n\n function bridge(BridgeParams memory params) external payable {\n revert(\"not implemented\");\n }\n\n function relay(bytes memory request) external payable {\n revert(\"not implemented\");\n }\n\n function prove(bytes memory request, bytes32 destTxHash) external {\n revert(\"not implemented\");\n }\n\n function canClaim(bytes32 transactionid, address relayer) external view returns (bool) {\n revert(\"not implemented\");\n }\n\n function claim(bytes memory request, address to) external {\n revert(\"not implemented\");\n }\n\n function dispute(bytes32 transactionId) external {\n revert(\"not implemented\");\n }\n\n function refund(bytes memory request) external {\n revert(\"not implemented\");\n }\n}\n","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","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.20+commit.a1b79de6\"},\"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/FastBridgeMock.sol\":\"IAdmin\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeMock.sol\":{\"keccak256\":\"0xb58951ea9ccf93b597bddaa7b405278a10398c87bf748538ac7a67cd65184783\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://bb67eff4aa6731cbb158660257e9091bbc8135d228ceb240943772f9b5ada90e\",\"dweb:/ipfs/QmQbxcMCxtY5dWAJoPBpipMUjrN5zMvhQDCVkcMpRsn9LP\"]}},\"version\":1}"},"hashes":{"setChainGasAmount(uint256)":"b250fe6b","setProtocolFeeRate(uint256)":"b13aa2d6","sweepProtocolFees(address,address)":"06f333f2"}},"solidity/FastBridgeMock.sol:IERC165":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.20 ^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 pure 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/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// 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/FastBridge.sol\n\ncontract FastBridge is IFastBridge, Admin {\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 enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeStatus) public bridgeStatuses;\n /// @notice Proof of relayed bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeProof) public bridgeProofs;\n /// @notice Whether bridge has been relayed on destination chain\n mapping(bytes32 =\u003e bool) public bridgeRelays;\n\n /// @dev to prevent replays\n uint256 public nonce;\n // @dev 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 /// @notice Pulls a requested token from the user to the requested recipient.\n /// @dev Be careful of re-entrancy issues when msg.value \u003e 0 and recipient != address(this)\n function _pullToken(address recipient, address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token != UniversalTokenLib.ETH_ADDRESS) {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(recipient);\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, recipient, amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(recipient) - amountPulled;\n } else {\n // Otherwise, we need to check that ETH amount matches msg.value\n if (amount != msg.value) revert MsgValueIncorrect();\n // Transfer value to recipient if not this address\n if (recipient != address(this)) token.universalTransfer(recipient, amount);\n // We will forward msg.value in the external call later, if recipient is not this contract\n amountPulled = msg.value;\n }\n }\n\n /// @inheritdoc IFastBridge\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n // check bridge params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\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\n // transfer tokens to bridge contract\n // @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(address(this), 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 BridgeTransaction({\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 sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n\n // check haven't exceeded deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n\n // mark bridge transaction as relayed\n if (bridgeRelays[transactionId]) revert TransactionRelayed();\n bridgeRelays[transactionId] = true;\n\n // transfer tokens to recipient on destination chain and gas rebate if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n uint256 rebate = chainGasAmount;\n if (!transaction.sendChainGas) {\n // forward erc20\n rebate = 0;\n _pullToken(to, token, amount);\n } else if (token == UniversalTokenLib.ETH_ADDRESS) {\n // lump in gas rebate into amount in native gas token\n _pullToken(to, token, amount + rebate);\n } else {\n // forward erc20 then forward gas rebate in native gas token\n _pullToken(to, token, amount);\n _pullToken(to, UniversalTokenLib.ETH_ADDRESS, rebate);\n }\n\n emit BridgeRelayed(\n transactionId,\n msg.sender,\n to,\n transaction.originChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n rebate\n );\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n // update bridge tx status given proof provided\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = BridgeStatus.RELAYER_PROVED;\n bridgeProofs[transactionId] = BridgeProof({timestamp: uint96(block.timestamp), relayer: msg.sender}); // overflow ok\n\n emit BridgeProofProvided(transactionId, msg.sender, destTxHash);\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint96(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint96).max but\n /// proof.timestamp \u003c type(uint96).max via unchecked statement\n /// @param proof The bridge proof\n /// @return delta Time delta since proof submitted\n function _timeSince(BridgeProof memory proof) internal view returns (uint256 delta) {\n unchecked {\n delta = uint96(block.timestamp) - proof.timestamp;\n }\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != relayer) revert SenderIncorrect();\n return _timeSince(proof) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != msg.sender) revert SenderIncorrect();\n if (_timeSince(proof) \u003c= DISPUTE_PERIOD) revert DisputePeriodNotPassed();\n\n bridgeStatuses[transactionId] = 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, msg.sender, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeProofs[transactionId]) \u003e DISPUTE_PERIOD) revert DisputePeriodPassed();\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n delete bridgeProofs[transactionId];\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 BridgeTransaction memory transaction = getBridgeTransaction(request);\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 // set status to refunded if still in requested state\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = 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\n// test/FastBridgeMock.sol\n\ncontract FastBridgeMock is IFastBridge, Admin {\n // @dev 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 /// @dev to prevent replays\n uint256 public nonce;\n\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n // used for testing in go.\n // see: https://ethereum.stackexchange.com/questions/21155/how-to-expose-enum-in-solidity-contract\n // make sure to update fastbridge/status.go if this changes\n // or underliyng enum changes.\n //\n // TODO: a foundry test should be added to ensure this is always in sync.\n function getEnumKeyByValue(FastBridge.BridgeStatus keyValue) public pure returns (string memory) {\n if (FastBridge.BridgeStatus.NULL == keyValue) return \"NULL\";\n if (FastBridge.BridgeStatus.REQUESTED == keyValue) return \"REQUESTED\";\n if (FastBridge.BridgeStatus.RELAYER_PROVED == keyValue) return \"RELAYER_PROVED\";\n if (FastBridge.BridgeStatus.RELAYER_CLAIMED == keyValue) return \"RELAYER_CLAIMED\";\n if (FastBridge.BridgeStatus.REFUNDED == keyValue) return \"REFUNDED\";\n return \"\";\n }\n\n function mockBridgeRequest(bytes32 transactionId, address sender, BridgeParams memory params) external {\n uint256 originFeeAmount = (params.originAmount * protocolFeeRate) / FEE_BPS;\n params.originAmount -= originFeeAmount;\n\n bytes memory request = abi.encode(\n BridgeTransaction({\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: params.originAmount, // includes relayer fee\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n params.originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n function mockBridgeRequestRaw(bytes32 transactionId, address sender, bytes memory request) external {\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n emit BridgeRequested(\n transactionId,\n transaction.originSender,\n request,\n transaction.destChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n transaction.sendChainGas\n );\n }\n\n function mockBridgeRelayer(\n bytes32 transactionId,\n address relayer,\n address to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n )\n external\n {\n emit BridgeRelayed(\n transactionId, relayer, to, originChainId, originToken, destToken, originAmount, destAmount, chainGasAmount\n );\n }\n\n function bridge(BridgeParams memory params) external payable {\n revert(\"not implemented\");\n }\n\n function relay(bytes memory request) external payable {\n revert(\"not implemented\");\n }\n\n function prove(bytes memory request, bytes32 destTxHash) external {\n revert(\"not implemented\");\n }\n\n function canClaim(bytes32 transactionid, address relayer) external view returns (bool) {\n revert(\"not implemented\");\n }\n\n function claim(bytes memory request, address to) external {\n revert(\"not implemented\");\n }\n\n function dispute(bytes32 transactionId) external {\n revert(\"not implemented\");\n }\n\n function refund(bytes memory request) external {\n revert(\"not implemented\");\n }\n}\n","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","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.20+commit.a1b79de6\"},\"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/FastBridgeMock.sol\":\"IERC165\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeMock.sol\":{\"keccak256\":\"0xb58951ea9ccf93b597bddaa7b405278a10398c87bf748538ac7a67cd65184783\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://bb67eff4aa6731cbb158660257e9091bbc8135d228ceb240943772f9b5ada90e\",\"dweb:/ipfs/QmQbxcMCxtY5dWAJoPBpipMUjrN5zMvhQDCVkcMpRsn9LP\"]}},\"version\":1}"},"hashes":{"supportsInterface(bytes4)":"01ffc9a7"}},"solidity/FastBridgeMock.sol:IERC20":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.20 ^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 pure 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/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// 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/FastBridge.sol\n\ncontract FastBridge is IFastBridge, Admin {\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 enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeStatus) public bridgeStatuses;\n /// @notice Proof of relayed bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeProof) public bridgeProofs;\n /// @notice Whether bridge has been relayed on destination chain\n mapping(bytes32 =\u003e bool) public bridgeRelays;\n\n /// @dev to prevent replays\n uint256 public nonce;\n // @dev 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 /// @notice Pulls a requested token from the user to the requested recipient.\n /// @dev Be careful of re-entrancy issues when msg.value \u003e 0 and recipient != address(this)\n function _pullToken(address recipient, address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token != UniversalTokenLib.ETH_ADDRESS) {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(recipient);\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, recipient, amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(recipient) - amountPulled;\n } else {\n // Otherwise, we need to check that ETH amount matches msg.value\n if (amount != msg.value) revert MsgValueIncorrect();\n // Transfer value to recipient if not this address\n if (recipient != address(this)) token.universalTransfer(recipient, amount);\n // We will forward msg.value in the external call later, if recipient is not this contract\n amountPulled = msg.value;\n }\n }\n\n /// @inheritdoc IFastBridge\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n // check bridge params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\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\n // transfer tokens to bridge contract\n // @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(address(this), 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 BridgeTransaction({\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 sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n\n // check haven't exceeded deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n\n // mark bridge transaction as relayed\n if (bridgeRelays[transactionId]) revert TransactionRelayed();\n bridgeRelays[transactionId] = true;\n\n // transfer tokens to recipient on destination chain and gas rebate if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n uint256 rebate = chainGasAmount;\n if (!transaction.sendChainGas) {\n // forward erc20\n rebate = 0;\n _pullToken(to, token, amount);\n } else if (token == UniversalTokenLib.ETH_ADDRESS) {\n // lump in gas rebate into amount in native gas token\n _pullToken(to, token, amount + rebate);\n } else {\n // forward erc20 then forward gas rebate in native gas token\n _pullToken(to, token, amount);\n _pullToken(to, UniversalTokenLib.ETH_ADDRESS, rebate);\n }\n\n emit BridgeRelayed(\n transactionId,\n msg.sender,\n to,\n transaction.originChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n rebate\n );\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n // update bridge tx status given proof provided\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = BridgeStatus.RELAYER_PROVED;\n bridgeProofs[transactionId] = BridgeProof({timestamp: uint96(block.timestamp), relayer: msg.sender}); // overflow ok\n\n emit BridgeProofProvided(transactionId, msg.sender, destTxHash);\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint96(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint96).max but\n /// proof.timestamp \u003c type(uint96).max via unchecked statement\n /// @param proof The bridge proof\n /// @return delta Time delta since proof submitted\n function _timeSince(BridgeProof memory proof) internal view returns (uint256 delta) {\n unchecked {\n delta = uint96(block.timestamp) - proof.timestamp;\n }\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != relayer) revert SenderIncorrect();\n return _timeSince(proof) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != msg.sender) revert SenderIncorrect();\n if (_timeSince(proof) \u003c= DISPUTE_PERIOD) revert DisputePeriodNotPassed();\n\n bridgeStatuses[transactionId] = 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, msg.sender, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeProofs[transactionId]) \u003e DISPUTE_PERIOD) revert DisputePeriodPassed();\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n delete bridgeProofs[transactionId];\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 BridgeTransaction memory transaction = getBridgeTransaction(request);\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 // set status to refunded if still in requested state\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = 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\n// test/FastBridgeMock.sol\n\ncontract FastBridgeMock is IFastBridge, Admin {\n // @dev 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 /// @dev to prevent replays\n uint256 public nonce;\n\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n // used for testing in go.\n // see: https://ethereum.stackexchange.com/questions/21155/how-to-expose-enum-in-solidity-contract\n // make sure to update fastbridge/status.go if this changes\n // or underliyng enum changes.\n //\n // TODO: a foundry test should be added to ensure this is always in sync.\n function getEnumKeyByValue(FastBridge.BridgeStatus keyValue) public pure returns (string memory) {\n if (FastBridge.BridgeStatus.NULL == keyValue) return \"NULL\";\n if (FastBridge.BridgeStatus.REQUESTED == keyValue) return \"REQUESTED\";\n if (FastBridge.BridgeStatus.RELAYER_PROVED == keyValue) return \"RELAYER_PROVED\";\n if (FastBridge.BridgeStatus.RELAYER_CLAIMED == keyValue) return \"RELAYER_CLAIMED\";\n if (FastBridge.BridgeStatus.REFUNDED == keyValue) return \"REFUNDED\";\n return \"\";\n }\n\n function mockBridgeRequest(bytes32 transactionId, address sender, BridgeParams memory params) external {\n uint256 originFeeAmount = (params.originAmount * protocolFeeRate) / FEE_BPS;\n params.originAmount -= originFeeAmount;\n\n bytes memory request = abi.encode(\n BridgeTransaction({\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: params.originAmount, // includes relayer fee\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n params.originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n function mockBridgeRequestRaw(bytes32 transactionId, address sender, bytes memory request) external {\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n emit BridgeRequested(\n transactionId,\n transaction.originSender,\n request,\n transaction.destChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n transaction.sendChainGas\n );\n }\n\n function mockBridgeRelayer(\n bytes32 transactionId,\n address relayer,\n address to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n )\n external\n {\n emit BridgeRelayed(\n transactionId, relayer, to, originChainId, originToken, destToken, originAmount, destAmount, chainGasAmount\n );\n }\n\n function bridge(BridgeParams memory params) external payable {\n revert(\"not implemented\");\n }\n\n function relay(bytes memory request) external payable {\n revert(\"not implemented\");\n }\n\n function prove(bytes memory request, bytes32 destTxHash) external {\n revert(\"not implemented\");\n }\n\n function canClaim(bytes32 transactionid, address relayer) external view returns (bool) {\n revert(\"not implemented\");\n }\n\n function claim(bytes memory request, address to) external {\n revert(\"not implemented\");\n }\n\n function dispute(bytes32 transactionId) external {\n revert(\"not implemented\");\n }\n\n function refund(bytes memory request) external {\n revert(\"not implemented\");\n }\n}\n","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","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.20+commit.a1b79de6\"},\"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/FastBridgeMock.sol\":\"IERC20\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeMock.sol\":{\"keccak256\":\"0xb58951ea9ccf93b597bddaa7b405278a10398c87bf748538ac7a67cd65184783\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://bb67eff4aa6731cbb158660257e9091bbc8135d228ceb240943772f9b5ada90e\",\"dweb:/ipfs/QmQbxcMCxtY5dWAJoPBpipMUjrN5zMvhQDCVkcMpRsn9LP\"]}},\"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/FastBridgeMock.sol:IERC20Permit":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.20 ^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 pure 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/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// 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/FastBridge.sol\n\ncontract FastBridge is IFastBridge, Admin {\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 enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeStatus) public bridgeStatuses;\n /// @notice Proof of relayed bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeProof) public bridgeProofs;\n /// @notice Whether bridge has been relayed on destination chain\n mapping(bytes32 =\u003e bool) public bridgeRelays;\n\n /// @dev to prevent replays\n uint256 public nonce;\n // @dev 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 /// @notice Pulls a requested token from the user to the requested recipient.\n /// @dev Be careful of re-entrancy issues when msg.value \u003e 0 and recipient != address(this)\n function _pullToken(address recipient, address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token != UniversalTokenLib.ETH_ADDRESS) {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(recipient);\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, recipient, amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(recipient) - amountPulled;\n } else {\n // Otherwise, we need to check that ETH amount matches msg.value\n if (amount != msg.value) revert MsgValueIncorrect();\n // Transfer value to recipient if not this address\n if (recipient != address(this)) token.universalTransfer(recipient, amount);\n // We will forward msg.value in the external call later, if recipient is not this contract\n amountPulled = msg.value;\n }\n }\n\n /// @inheritdoc IFastBridge\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n // check bridge params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\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\n // transfer tokens to bridge contract\n // @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(address(this), 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 BridgeTransaction({\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 sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n\n // check haven't exceeded deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n\n // mark bridge transaction as relayed\n if (bridgeRelays[transactionId]) revert TransactionRelayed();\n bridgeRelays[transactionId] = true;\n\n // transfer tokens to recipient on destination chain and gas rebate if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n uint256 rebate = chainGasAmount;\n if (!transaction.sendChainGas) {\n // forward erc20\n rebate = 0;\n _pullToken(to, token, amount);\n } else if (token == UniversalTokenLib.ETH_ADDRESS) {\n // lump in gas rebate into amount in native gas token\n _pullToken(to, token, amount + rebate);\n } else {\n // forward erc20 then forward gas rebate in native gas token\n _pullToken(to, token, amount);\n _pullToken(to, UniversalTokenLib.ETH_ADDRESS, rebate);\n }\n\n emit BridgeRelayed(\n transactionId,\n msg.sender,\n to,\n transaction.originChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n rebate\n );\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n // update bridge tx status given proof provided\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = BridgeStatus.RELAYER_PROVED;\n bridgeProofs[transactionId] = BridgeProof({timestamp: uint96(block.timestamp), relayer: msg.sender}); // overflow ok\n\n emit BridgeProofProvided(transactionId, msg.sender, destTxHash);\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint96(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint96).max but\n /// proof.timestamp \u003c type(uint96).max via unchecked statement\n /// @param proof The bridge proof\n /// @return delta Time delta since proof submitted\n function _timeSince(BridgeProof memory proof) internal view returns (uint256 delta) {\n unchecked {\n delta = uint96(block.timestamp) - proof.timestamp;\n }\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != relayer) revert SenderIncorrect();\n return _timeSince(proof) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != msg.sender) revert SenderIncorrect();\n if (_timeSince(proof) \u003c= DISPUTE_PERIOD) revert DisputePeriodNotPassed();\n\n bridgeStatuses[transactionId] = 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, msg.sender, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeProofs[transactionId]) \u003e DISPUTE_PERIOD) revert DisputePeriodPassed();\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n delete bridgeProofs[transactionId];\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 BridgeTransaction memory transaction = getBridgeTransaction(request);\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 // set status to refunded if still in requested state\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = 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\n// test/FastBridgeMock.sol\n\ncontract FastBridgeMock is IFastBridge, Admin {\n // @dev 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 /// @dev to prevent replays\n uint256 public nonce;\n\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n // used for testing in go.\n // see: https://ethereum.stackexchange.com/questions/21155/how-to-expose-enum-in-solidity-contract\n // make sure to update fastbridge/status.go if this changes\n // or underliyng enum changes.\n //\n // TODO: a foundry test should be added to ensure this is always in sync.\n function getEnumKeyByValue(FastBridge.BridgeStatus keyValue) public pure returns (string memory) {\n if (FastBridge.BridgeStatus.NULL == keyValue) return \"NULL\";\n if (FastBridge.BridgeStatus.REQUESTED == keyValue) return \"REQUESTED\";\n if (FastBridge.BridgeStatus.RELAYER_PROVED == keyValue) return \"RELAYER_PROVED\";\n if (FastBridge.BridgeStatus.RELAYER_CLAIMED == keyValue) return \"RELAYER_CLAIMED\";\n if (FastBridge.BridgeStatus.REFUNDED == keyValue) return \"REFUNDED\";\n return \"\";\n }\n\n function mockBridgeRequest(bytes32 transactionId, address sender, BridgeParams memory params) external {\n uint256 originFeeAmount = (params.originAmount * protocolFeeRate) / FEE_BPS;\n params.originAmount -= originFeeAmount;\n\n bytes memory request = abi.encode(\n BridgeTransaction({\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: params.originAmount, // includes relayer fee\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n params.originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n function mockBridgeRequestRaw(bytes32 transactionId, address sender, bytes memory request) external {\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n emit BridgeRequested(\n transactionId,\n transaction.originSender,\n request,\n transaction.destChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n transaction.sendChainGas\n );\n }\n\n function mockBridgeRelayer(\n bytes32 transactionId,\n address relayer,\n address to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n )\n external\n {\n emit BridgeRelayed(\n transactionId, relayer, to, originChainId, originToken, destToken, originAmount, destAmount, chainGasAmount\n );\n }\n\n function bridge(BridgeParams memory params) external payable {\n revert(\"not implemented\");\n }\n\n function relay(bytes memory request) external payable {\n revert(\"not implemented\");\n }\n\n function prove(bytes memory request, bytes32 destTxHash) external {\n revert(\"not implemented\");\n }\n\n function canClaim(bytes32 transactionid, address relayer) external view returns (bool) {\n revert(\"not implemented\");\n }\n\n function claim(bytes memory request, address to) external {\n revert(\"not implemented\");\n }\n\n function dispute(bytes32 transactionId) external {\n revert(\"not implemented\");\n }\n\n function refund(bytes memory request) external {\n revert(\"not implemented\");\n }\n}\n","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","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.20+commit.a1b79de6\"},\"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/FastBridgeMock.sol\":\"IERC20Permit\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeMock.sol\":{\"keccak256\":\"0xb58951ea9ccf93b597bddaa7b405278a10398c87bf748538ac7a67cd65184783\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://bb67eff4aa6731cbb158660257e9091bbc8135d228ceb240943772f9b5ada90e\",\"dweb:/ipfs/QmQbxcMCxtY5dWAJoPBpipMUjrN5zMvhQDCVkcMpRsn9LP\"]}},\"version\":1}"},"hashes":{"DOMAIN_SEPARATOR()":"3644e515","nonces(address)":"7ecebe00","permit(address,address,uint256,uint256,uint8,bytes32,bytes32)":"d505accf"}},"solidity/FastBridgeMock.sol:IFastBridge":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.20 ^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 pure 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/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// 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/FastBridge.sol\n\ncontract FastBridge is IFastBridge, Admin {\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 enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeStatus) public bridgeStatuses;\n /// @notice Proof of relayed bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeProof) public bridgeProofs;\n /// @notice Whether bridge has been relayed on destination chain\n mapping(bytes32 =\u003e bool) public bridgeRelays;\n\n /// @dev to prevent replays\n uint256 public nonce;\n // @dev 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 /// @notice Pulls a requested token from the user to the requested recipient.\n /// @dev Be careful of re-entrancy issues when msg.value \u003e 0 and recipient != address(this)\n function _pullToken(address recipient, address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token != UniversalTokenLib.ETH_ADDRESS) {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(recipient);\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, recipient, amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(recipient) - amountPulled;\n } else {\n // Otherwise, we need to check that ETH amount matches msg.value\n if (amount != msg.value) revert MsgValueIncorrect();\n // Transfer value to recipient if not this address\n if (recipient != address(this)) token.universalTransfer(recipient, amount);\n // We will forward msg.value in the external call later, if recipient is not this contract\n amountPulled = msg.value;\n }\n }\n\n /// @inheritdoc IFastBridge\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n // check bridge params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\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\n // transfer tokens to bridge contract\n // @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(address(this), 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 BridgeTransaction({\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 sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n\n // check haven't exceeded deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n\n // mark bridge transaction as relayed\n if (bridgeRelays[transactionId]) revert TransactionRelayed();\n bridgeRelays[transactionId] = true;\n\n // transfer tokens to recipient on destination chain and gas rebate if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n uint256 rebate = chainGasAmount;\n if (!transaction.sendChainGas) {\n // forward erc20\n rebate = 0;\n _pullToken(to, token, amount);\n } else if (token == UniversalTokenLib.ETH_ADDRESS) {\n // lump in gas rebate into amount in native gas token\n _pullToken(to, token, amount + rebate);\n } else {\n // forward erc20 then forward gas rebate in native gas token\n _pullToken(to, token, amount);\n _pullToken(to, UniversalTokenLib.ETH_ADDRESS, rebate);\n }\n\n emit BridgeRelayed(\n transactionId,\n msg.sender,\n to,\n transaction.originChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n rebate\n );\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n // update bridge tx status given proof provided\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = BridgeStatus.RELAYER_PROVED;\n bridgeProofs[transactionId] = BridgeProof({timestamp: uint96(block.timestamp), relayer: msg.sender}); // overflow ok\n\n emit BridgeProofProvided(transactionId, msg.sender, destTxHash);\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint96(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint96).max but\n /// proof.timestamp \u003c type(uint96).max via unchecked statement\n /// @param proof The bridge proof\n /// @return delta Time delta since proof submitted\n function _timeSince(BridgeProof memory proof) internal view returns (uint256 delta) {\n unchecked {\n delta = uint96(block.timestamp) - proof.timestamp;\n }\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != relayer) revert SenderIncorrect();\n return _timeSince(proof) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != msg.sender) revert SenderIncorrect();\n if (_timeSince(proof) \u003c= DISPUTE_PERIOD) revert DisputePeriodNotPassed();\n\n bridgeStatuses[transactionId] = 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, msg.sender, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeProofs[transactionId]) \u003e DISPUTE_PERIOD) revert DisputePeriodPassed();\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n delete bridgeProofs[transactionId];\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 BridgeTransaction memory transaction = getBridgeTransaction(request);\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 // set status to refunded if still in requested state\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = 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\n// test/FastBridgeMock.sol\n\ncontract FastBridgeMock is IFastBridge, Admin {\n // @dev 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 /// @dev to prevent replays\n uint256 public nonce;\n\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n // used for testing in go.\n // see: https://ethereum.stackexchange.com/questions/21155/how-to-expose-enum-in-solidity-contract\n // make sure to update fastbridge/status.go if this changes\n // or underliyng enum changes.\n //\n // TODO: a foundry test should be added to ensure this is always in sync.\n function getEnumKeyByValue(FastBridge.BridgeStatus keyValue) public pure returns (string memory) {\n if (FastBridge.BridgeStatus.NULL == keyValue) return \"NULL\";\n if (FastBridge.BridgeStatus.REQUESTED == keyValue) return \"REQUESTED\";\n if (FastBridge.BridgeStatus.RELAYER_PROVED == keyValue) return \"RELAYER_PROVED\";\n if (FastBridge.BridgeStatus.RELAYER_CLAIMED == keyValue) return \"RELAYER_CLAIMED\";\n if (FastBridge.BridgeStatus.REFUNDED == keyValue) return \"REFUNDED\";\n return \"\";\n }\n\n function mockBridgeRequest(bytes32 transactionId, address sender, BridgeParams memory params) external {\n uint256 originFeeAmount = (params.originAmount * protocolFeeRate) / FEE_BPS;\n params.originAmount -= originFeeAmount;\n\n bytes memory request = abi.encode(\n BridgeTransaction({\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: params.originAmount, // includes relayer fee\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n params.originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n function mockBridgeRequestRaw(bytes32 transactionId, address sender, bytes memory request) external {\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n emit BridgeRequested(\n transactionId,\n transaction.originSender,\n request,\n transaction.destChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n transaction.sendChainGas\n );\n }\n\n function mockBridgeRelayer(\n bytes32 transactionId,\n address relayer,\n address to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n )\n external\n {\n emit BridgeRelayed(\n transactionId, relayer, to, originChainId, originToken, destToken, originAmount, destAmount, chainGasAmount\n );\n }\n\n function bridge(BridgeParams memory params) external payable {\n revert(\"not implemented\");\n }\n\n function relay(bytes memory request) external payable {\n revert(\"not implemented\");\n }\n\n function prove(bytes memory request, bytes32 destTxHash) external {\n revert(\"not implemented\");\n }\n\n function canClaim(bytes32 transactionid, address relayer) external view returns (bool) {\n revert(\"not implemented\");\n }\n\n function claim(bytes memory request, address to) external {\n revert(\"not implemented\");\n }\n\n function dispute(bytes32 transactionId) external {\n revert(\"not implemented\");\n }\n\n function refund(bytes memory request) external {\n revert(\"not implemented\");\n }\n}\n","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","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":"pure","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.20+commit.a1b79de6\"},\"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\":\"pure\",\"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/FastBridgeMock.sol\":\"IFastBridge\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeMock.sol\":{\"keccak256\":\"0xb58951ea9ccf93b597bddaa7b405278a10398c87bf748538ac7a67cd65184783\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://bb67eff4aa6731cbb158660257e9091bbc8135d228ceb240943772f9b5ada90e\",\"dweb:/ipfs/QmQbxcMCxtY5dWAJoPBpipMUjrN5zMvhQDCVkcMpRsn9LP\"]}},\"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/FastBridgeMock.sol:SafeERC20":{"code":"0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220be43a1ff38e79e6a2033a41cc8a252d3eb127b7334d123eac31b1ff4a05b94a464736f6c63430008140033","runtime-code":"0x73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220be43a1ff38e79e6a2033a41cc8a252d3eb127b7334d123eac31b1ff4a05b94a464736f6c63430008140033","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.20 ^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 pure 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/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// 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/FastBridge.sol\n\ncontract FastBridge is IFastBridge, Admin {\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 enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeStatus) public bridgeStatuses;\n /// @notice Proof of relayed bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeProof) public bridgeProofs;\n /// @notice Whether bridge has been relayed on destination chain\n mapping(bytes32 =\u003e bool) public bridgeRelays;\n\n /// @dev to prevent replays\n uint256 public nonce;\n // @dev 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 /// @notice Pulls a requested token from the user to the requested recipient.\n /// @dev Be careful of re-entrancy issues when msg.value \u003e 0 and recipient != address(this)\n function _pullToken(address recipient, address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token != UniversalTokenLib.ETH_ADDRESS) {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(recipient);\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, recipient, amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(recipient) - amountPulled;\n } else {\n // Otherwise, we need to check that ETH amount matches msg.value\n if (amount != msg.value) revert MsgValueIncorrect();\n // Transfer value to recipient if not this address\n if (recipient != address(this)) token.universalTransfer(recipient, amount);\n // We will forward msg.value in the external call later, if recipient is not this contract\n amountPulled = msg.value;\n }\n }\n\n /// @inheritdoc IFastBridge\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n // check bridge params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\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\n // transfer tokens to bridge contract\n // @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(address(this), 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 BridgeTransaction({\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 sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n\n // check haven't exceeded deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n\n // mark bridge transaction as relayed\n if (bridgeRelays[transactionId]) revert TransactionRelayed();\n bridgeRelays[transactionId] = true;\n\n // transfer tokens to recipient on destination chain and gas rebate if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n uint256 rebate = chainGasAmount;\n if (!transaction.sendChainGas) {\n // forward erc20\n rebate = 0;\n _pullToken(to, token, amount);\n } else if (token == UniversalTokenLib.ETH_ADDRESS) {\n // lump in gas rebate into amount in native gas token\n _pullToken(to, token, amount + rebate);\n } else {\n // forward erc20 then forward gas rebate in native gas token\n _pullToken(to, token, amount);\n _pullToken(to, UniversalTokenLib.ETH_ADDRESS, rebate);\n }\n\n emit BridgeRelayed(\n transactionId,\n msg.sender,\n to,\n transaction.originChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n rebate\n );\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n // update bridge tx status given proof provided\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = BridgeStatus.RELAYER_PROVED;\n bridgeProofs[transactionId] = BridgeProof({timestamp: uint96(block.timestamp), relayer: msg.sender}); // overflow ok\n\n emit BridgeProofProvided(transactionId, msg.sender, destTxHash);\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint96(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint96).max but\n /// proof.timestamp \u003c type(uint96).max via unchecked statement\n /// @param proof The bridge proof\n /// @return delta Time delta since proof submitted\n function _timeSince(BridgeProof memory proof) internal view returns (uint256 delta) {\n unchecked {\n delta = uint96(block.timestamp) - proof.timestamp;\n }\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != relayer) revert SenderIncorrect();\n return _timeSince(proof) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != msg.sender) revert SenderIncorrect();\n if (_timeSince(proof) \u003c= DISPUTE_PERIOD) revert DisputePeriodNotPassed();\n\n bridgeStatuses[transactionId] = 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, msg.sender, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeProofs[transactionId]) \u003e DISPUTE_PERIOD) revert DisputePeriodPassed();\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n delete bridgeProofs[transactionId];\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 BridgeTransaction memory transaction = getBridgeTransaction(request);\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 // set status to refunded if still in requested state\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = 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\n// test/FastBridgeMock.sol\n\ncontract FastBridgeMock is IFastBridge, Admin {\n // @dev 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 /// @dev to prevent replays\n uint256 public nonce;\n\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n // used for testing in go.\n // see: https://ethereum.stackexchange.com/questions/21155/how-to-expose-enum-in-solidity-contract\n // make sure to update fastbridge/status.go if this changes\n // or underliyng enum changes.\n //\n // TODO: a foundry test should be added to ensure this is always in sync.\n function getEnumKeyByValue(FastBridge.BridgeStatus keyValue) public pure returns (string memory) {\n if (FastBridge.BridgeStatus.NULL == keyValue) return \"NULL\";\n if (FastBridge.BridgeStatus.REQUESTED == keyValue) return \"REQUESTED\";\n if (FastBridge.BridgeStatus.RELAYER_PROVED == keyValue) return \"RELAYER_PROVED\";\n if (FastBridge.BridgeStatus.RELAYER_CLAIMED == keyValue) return \"RELAYER_CLAIMED\";\n if (FastBridge.BridgeStatus.REFUNDED == keyValue) return \"REFUNDED\";\n return \"\";\n }\n\n function mockBridgeRequest(bytes32 transactionId, address sender, BridgeParams memory params) external {\n uint256 originFeeAmount = (params.originAmount * protocolFeeRate) / FEE_BPS;\n params.originAmount -= originFeeAmount;\n\n bytes memory request = abi.encode(\n BridgeTransaction({\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: params.originAmount, // includes relayer fee\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n params.originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n function mockBridgeRequestRaw(bytes32 transactionId, address sender, bytes memory request) external {\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n emit BridgeRequested(\n transactionId,\n transaction.originSender,\n request,\n transaction.destChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n transaction.sendChainGas\n );\n }\n\n function mockBridgeRelayer(\n bytes32 transactionId,\n address relayer,\n address to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n )\n external\n {\n emit BridgeRelayed(\n transactionId, relayer, to, originChainId, originToken, destToken, originAmount, destAmount, chainGasAmount\n );\n }\n\n function bridge(BridgeParams memory params) external payable {\n revert(\"not implemented\");\n }\n\n function relay(bytes memory request) external payable {\n revert(\"not implemented\");\n }\n\n function prove(bytes memory request, bytes32 destTxHash) external {\n revert(\"not implemented\");\n }\n\n function canClaim(bytes32 transactionid, address relayer) external view returns (bool) {\n revert(\"not implemented\");\n }\n\n function claim(bytes memory request, address to) external {\n revert(\"not implemented\");\n }\n\n function dispute(bytes32 transactionId) external {\n revert(\"not implemented\");\n }\n\n function refund(bytes memory request) external {\n revert(\"not implemented\");\n }\n}\n","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","compilerOptions":"--combined-json bin,bin-runtime,srcmap,srcmap-runtime,abi,userdoc,devdoc,metadata,hashes --optimize --optimize-runs 10000 --allow-paths ., ./, ../ --evm-version=istanbul","srcMap":"39257:5018:0:-:0;;;;;;;;;;;;;;;-1:-1:-1;;;39257:5018:0;;;;;;;;;;;;;;;;;","srcMapRuntime":"39257: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.20+commit.a1b79de6\"},\"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/FastBridgeMock.sol\":\"SafeERC20\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeMock.sol\":{\"keccak256\":\"0xb58951ea9ccf93b597bddaa7b405278a10398c87bf748538ac7a67cd65184783\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://bb67eff4aa6731cbb158660257e9091bbc8135d228ceb240943772f9b5ada90e\",\"dweb:/ipfs/QmQbxcMCxtY5dWAJoPBpipMUjrN5zMvhQDCVkcMpRsn9LP\"]}},\"version\":1}"},"hashes":{}},"solidity/FastBridgeMock.sol:UniversalTokenLib":{"code":"0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220606dedacc186512fbfa88e9a001df8533c52e60258d832c4081dc4e5c1aba09a64736f6c63430008140033","runtime-code":"0x73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220606dedacc186512fbfa88e9a001df8533c52e60258d832c4081dc4e5c1aba09a64736f6c63430008140033","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.20 ^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 pure 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/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// 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/FastBridge.sol\n\ncontract FastBridge is IFastBridge, Admin {\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 enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeStatus) public bridgeStatuses;\n /// @notice Proof of relayed bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeProof) public bridgeProofs;\n /// @notice Whether bridge has been relayed on destination chain\n mapping(bytes32 =\u003e bool) public bridgeRelays;\n\n /// @dev to prevent replays\n uint256 public nonce;\n // @dev 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 /// @notice Pulls a requested token from the user to the requested recipient.\n /// @dev Be careful of re-entrancy issues when msg.value \u003e 0 and recipient != address(this)\n function _pullToken(address recipient, address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token != UniversalTokenLib.ETH_ADDRESS) {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(recipient);\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, recipient, amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(recipient) - amountPulled;\n } else {\n // Otherwise, we need to check that ETH amount matches msg.value\n if (amount != msg.value) revert MsgValueIncorrect();\n // Transfer value to recipient if not this address\n if (recipient != address(this)) token.universalTransfer(recipient, amount);\n // We will forward msg.value in the external call later, if recipient is not this contract\n amountPulled = msg.value;\n }\n }\n\n /// @inheritdoc IFastBridge\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n // check bridge params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\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\n // transfer tokens to bridge contract\n // @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(address(this), 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 BridgeTransaction({\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 sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n\n // check haven't exceeded deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n\n // mark bridge transaction as relayed\n if (bridgeRelays[transactionId]) revert TransactionRelayed();\n bridgeRelays[transactionId] = true;\n\n // transfer tokens to recipient on destination chain and gas rebate if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n uint256 rebate = chainGasAmount;\n if (!transaction.sendChainGas) {\n // forward erc20\n rebate = 0;\n _pullToken(to, token, amount);\n } else if (token == UniversalTokenLib.ETH_ADDRESS) {\n // lump in gas rebate into amount in native gas token\n _pullToken(to, token, amount + rebate);\n } else {\n // forward erc20 then forward gas rebate in native gas token\n _pullToken(to, token, amount);\n _pullToken(to, UniversalTokenLib.ETH_ADDRESS, rebate);\n }\n\n emit BridgeRelayed(\n transactionId,\n msg.sender,\n to,\n transaction.originChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n rebate\n );\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n // update bridge tx status given proof provided\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = BridgeStatus.RELAYER_PROVED;\n bridgeProofs[transactionId] = BridgeProof({timestamp: uint96(block.timestamp), relayer: msg.sender}); // overflow ok\n\n emit BridgeProofProvided(transactionId, msg.sender, destTxHash);\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint96(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint96).max but\n /// proof.timestamp \u003c type(uint96).max via unchecked statement\n /// @param proof The bridge proof\n /// @return delta Time delta since proof submitted\n function _timeSince(BridgeProof memory proof) internal view returns (uint256 delta) {\n unchecked {\n delta = uint96(block.timestamp) - proof.timestamp;\n }\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != relayer) revert SenderIncorrect();\n return _timeSince(proof) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) external onlyRole(RELAYER_ROLE) {\n bytes32 transactionId = keccak256(request);\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n BridgeProof memory proof = bridgeProofs[transactionId];\n if (proof.relayer != msg.sender) revert SenderIncorrect();\n if (_timeSince(proof) \u003c= DISPUTE_PERIOD) revert DisputePeriodNotPassed();\n\n bridgeStatuses[transactionId] = 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, msg.sender, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeStatuses[transactionId] != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeProofs[transactionId]) \u003e DISPUTE_PERIOD) revert DisputePeriodPassed();\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeStatuses[transactionId] = BridgeStatus.REQUESTED;\n delete bridgeProofs[transactionId];\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 BridgeTransaction memory transaction = getBridgeTransaction(request);\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 // set status to refunded if still in requested state\n if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeStatuses[transactionId] = 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\n// test/FastBridgeMock.sol\n\ncontract FastBridgeMock is IFastBridge, Admin {\n // @dev 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 /// @dev to prevent replays\n uint256 public nonce;\n\n function getBridgeTransaction(bytes memory request) public pure returns (BridgeTransaction memory) {\n return abi.decode(request, (BridgeTransaction));\n }\n\n // used for testing in go.\n // see: https://ethereum.stackexchange.com/questions/21155/how-to-expose-enum-in-solidity-contract\n // make sure to update fastbridge/status.go if this changes\n // or underliyng enum changes.\n //\n // TODO: a foundry test should be added to ensure this is always in sync.\n function getEnumKeyByValue(FastBridge.BridgeStatus keyValue) public pure returns (string memory) {\n if (FastBridge.BridgeStatus.NULL == keyValue) return \"NULL\";\n if (FastBridge.BridgeStatus.REQUESTED == keyValue) return \"REQUESTED\";\n if (FastBridge.BridgeStatus.RELAYER_PROVED == keyValue) return \"RELAYER_PROVED\";\n if (FastBridge.BridgeStatus.RELAYER_CLAIMED == keyValue) return \"RELAYER_CLAIMED\";\n if (FastBridge.BridgeStatus.REFUNDED == keyValue) return \"REFUNDED\";\n return \"\";\n }\n\n function mockBridgeRequest(bytes32 transactionId, address sender, BridgeParams memory params) external {\n uint256 originFeeAmount = (params.originAmount * protocolFeeRate) / FEE_BPS;\n params.originAmount -= originFeeAmount;\n\n bytes memory request = abi.encode(\n BridgeTransaction({\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: params.originAmount, // includes relayer fee\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n sendChainGas: params.sendChainGas,\n deadline: params.deadline,\n nonce: nonce++ // increment nonce on every bridge\n })\n );\n\n emit BridgeRequested(\n transactionId,\n params.sender,\n request,\n params.dstChainId,\n params.originToken,\n params.destToken,\n params.originAmount,\n params.destAmount,\n params.sendChainGas\n );\n }\n\n function mockBridgeRequestRaw(bytes32 transactionId, address sender, bytes memory request) external {\n BridgeTransaction memory transaction = getBridgeTransaction(request);\n emit BridgeRequested(\n transactionId,\n transaction.originSender,\n request,\n transaction.destChainId,\n transaction.originToken,\n transaction.destToken,\n transaction.originAmount,\n transaction.destAmount,\n transaction.sendChainGas\n );\n }\n\n function mockBridgeRelayer(\n bytes32 transactionId,\n address relayer,\n address to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n )\n external\n {\n emit BridgeRelayed(\n transactionId, relayer, to, originChainId, originToken, destToken, originAmount, destAmount, chainGasAmount\n );\n }\n\n function bridge(BridgeParams memory params) external payable {\n revert(\"not implemented\");\n }\n\n function relay(bytes memory request) external payable {\n revert(\"not implemented\");\n }\n\n function prove(bytes memory request, bytes32 destTxHash) external {\n revert(\"not implemented\");\n }\n\n function canClaim(bytes32 transactionid, address relayer) external view returns (bool) {\n revert(\"not implemented\");\n }\n\n function claim(bytes memory request, address to) external {\n revert(\"not implemented\");\n }\n\n function dispute(bytes32 transactionId) external {\n revert(\"not implemented\");\n }\n\n function refund(bytes memory request) external {\n revert(\"not implemented\");\n }\n}\n","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","compilerOptions":"--combined-json bin,bin-runtime,srcmap,srcmap-runtime,abi,userdoc,devdoc,metadata,hashes --optimize --optimize-runs 10000 --allow-paths ., ./, ../ --evm-version=istanbul","srcMap":"51216:2551:0:-:0;;;;;;;;;;;;;;;-1:-1:-1;;;51216:2551:0;;;;;;;;;;;;;;;;;","srcMapRuntime":"51216:2551:0:-:0;;;;;;;;","abiDefinition":[],"userDoc":{"kind":"user","methods":{},"version":1},"developerDoc":{"kind":"dev","methods":{},"version":1},"metadata":"{\"compiler\":{\"version\":\"0.8.20+commit.a1b79de6\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/FastBridgeMock.sol\":\"UniversalTokenLib\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeMock.sol\":{\"keccak256\":\"0xb58951ea9ccf93b597bddaa7b405278a10398c87bf748538ac7a67cd65184783\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://bb67eff4aa6731cbb158660257e9091bbc8135d228ceb240943772f9b5ada90e\",\"dweb:/ipfs/QmQbxcMCxtY5dWAJoPBpipMUjrN5zMvhQDCVkcMpRsn9LP\"]}},\"version\":1}"},"hashes":{}}} \ No newline at end of file diff --git a/services/rfq/contracts/testcontracts/mockerc20/mockerc20.abigen.go b/services/rfq/contracts/testcontracts/mockerc20/mockerc20.abigen.go index 58ee222fc5..750b03ce96 100644 --- a/services/rfq/contracts/testcontracts/mockerc20/mockerc20.abigen.go +++ b/services/rfq/contracts/testcontracts/mockerc20/mockerc20.abigen.go @@ -2722,7 +2722,7 @@ var MockERC20MetaData = &bind.MetaData{ "a9059cbb": "transfer(address,uint256)", "23b872dd": "transferFrom(address,address,uint256)", }, - Bin: "0x60806040523480156200001157600080fd5b5060405162000d4f38038062000d4f8339810160408190526200003491620000a0565b8180600362000044828262000217565b50600462000053828262000217565b50506005805460ff191660ff939093169290921790915550620002e39050565b634e487b7160e01b600052604160045260246000fd5b805160ff811681146200009b57600080fd5b919050565b60008060408385031215620000b457600080fd5b82516001600160401b0380821115620000cc57600080fd5b818501915085601f830112620000e157600080fd5b815181811115620000f657620000f662000073565b604051601f8201601f19908116603f0116810190838211818310171562000121576200012162000073565b816040528281526020935088848487010111156200013e57600080fd5b600091505b8282101562000162578482018401518183018501529083019062000143565b60008484830101528096505050506200017d81860162000089565b925050509250929050565b600181811c908216806200019d57607f821691505b602082108103620001be57634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200021257600081815260208120601f850160051c81016020861015620001ed5750805b601f850160051c820191505b818110156200020e57828155600101620001f9565b5050505b505050565b81516001600160401b0381111562000233576200023362000073565b6200024b8162000244845462000188565b84620001c4565b602080601f8311600181146200028357600084156200026a5750858301515b600019600386901b1c1916600185901b1785556200020e565b600085815260208120601f198616915b82811015620002b45788860151825594840194600190910190840162000293565b5085821015620002d35787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b610a5c80620002f36000396000f3fe608060405234801561001057600080fd5b50600436106100c95760003560e01c806340c10f19116100815780639dc29fac1161005b5780639dc29fac1461019c578063a9059cbb146101af578063dd62ed3e146101c257600080fd5b806340c10f191461014957806370a082311461015e57806395d89b411461019457600080fd5b806318160ddd116100b257806318160ddd1461010f57806323b872dd14610121578063313ce5671461013457600080fd5b806306fdde03146100ce578063095ea7b3146100ec575b600080fd5b6100d6610208565b6040516100e39190610849565b60405180910390f35b6100ff6100fa3660046108de565b61029a565b60405190151581526020016100e3565b6002545b6040519081526020016100e3565b6100ff61012f366004610908565b6102b4565b60055460405160ff90911681526020016100e3565b61015c6101573660046108de565b6102d8565b005b61011361016c366004610944565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090205490565b6100d66102e6565b61015c6101aa3660046108de565b6102f5565b6100ff6101bd3660046108de565b6102ff565b6101136101d0366004610966565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260016020908152604080832093909416825291909152205490565b60606003805461021790610999565b80601f016020809104026020016040519081016040528092919081815260200182805461024390610999565b80156102905780601f1061026557610100808354040283529160200191610290565b820191906000526020600020905b81548152906001019060200180831161027357829003601f168201915b5050505050905090565b6000336102a881858561030d565b60019150505b92915050565b6000336102c285828561031f565b6102cd8585856103f3565b506001949350505050565b6102e2828261049e565b5050565b60606004805461021790610999565b6102e282826104fa565b6000336102a88185856103f3565b61031a8383836001610556565b505050565b73ffffffffffffffffffffffffffffffffffffffff8381166000908152600160209081526040808320938616835292905220547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146103ed57818110156103de576040517ffb8f41b200000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8416600482015260248101829052604481018390526064015b60405180910390fd5b6103ed84848484036000610556565b50505050565b73ffffffffffffffffffffffffffffffffffffffff8316610443576040517f96c6fd1e000000000000000000000000000000000000000000000000000000008152600060048201526024016103d5565b73ffffffffffffffffffffffffffffffffffffffff8216610493576040517fec442f05000000000000000000000000000000000000000000000000000000008152600060048201526024016103d5565b61031a83838361069e565b73ffffffffffffffffffffffffffffffffffffffff82166104ee576040517fec442f05000000000000000000000000000000000000000000000000000000008152600060048201526024016103d5565b6102e26000838361069e565b73ffffffffffffffffffffffffffffffffffffffff821661054a576040517f96c6fd1e000000000000000000000000000000000000000000000000000000008152600060048201526024016103d5565b6102e28260008361069e565b73ffffffffffffffffffffffffffffffffffffffff84166105a6576040517fe602df05000000000000000000000000000000000000000000000000000000008152600060048201526024016103d5565b73ffffffffffffffffffffffffffffffffffffffff83166105f6576040517f94280d62000000000000000000000000000000000000000000000000000000008152600060048201526024016103d5565b73ffffffffffffffffffffffffffffffffffffffff808516600090815260016020908152604080832093871683529290522082905580156103ed578273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258460405161069091815260200190565b60405180910390a350505050565b73ffffffffffffffffffffffffffffffffffffffff83166106d65780600260008282546106cb91906109ec565b909155506107889050565b73ffffffffffffffffffffffffffffffffffffffff83166000908152602081905260409020548181101561075c576040517fe450d38c00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8516600482015260248101829052604481018390526064016103d5565b73ffffffffffffffffffffffffffffffffffffffff841660009081526020819052604090209082900390555b73ffffffffffffffffffffffffffffffffffffffff82166107b1576002805482900390556107dd565b73ffffffffffffffffffffffffffffffffffffffff821660009081526020819052604090208054820190555b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161083c91815260200190565b60405180910390a3505050565b600060208083528351808285015260005b818110156108765785810183015185820160400152820161085a565b5060006040828601015260407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8301168501019250505092915050565b803573ffffffffffffffffffffffffffffffffffffffff811681146108d957600080fd5b919050565b600080604083850312156108f157600080fd5b6108fa836108b5565b946020939093013593505050565b60008060006060848603121561091d57600080fd5b610926846108b5565b9250610934602085016108b5565b9150604084013590509250925092565b60006020828403121561095657600080fd5b61095f826108b5565b9392505050565b6000806040838503121561097957600080fd5b610982836108b5565b9150610990602084016108b5565b90509250929050565b600181811c908216806109ad57607f821691505b6020821081036109e6577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b808201808211156102ae577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fdfea264697066735822122026f64d6f95f0703c9301963e6c1938a90571f9265dae22ab806cad3a0261fad664736f6c63430008140033", + Bin: "0x60806040523480156200001157600080fd5b5060405162000d4f38038062000d4f8339810160408190526200003491620000a0565b8180600362000044828262000217565b50600462000053828262000217565b50506005805460ff191660ff939093169290921790915550620002e39050565b634e487b7160e01b600052604160045260246000fd5b805160ff811681146200009b57600080fd5b919050565b60008060408385031215620000b457600080fd5b82516001600160401b0380821115620000cc57600080fd5b818501915085601f830112620000e157600080fd5b815181811115620000f657620000f662000073565b604051601f8201601f19908116603f0116810190838211818310171562000121576200012162000073565b816040528281526020935088848487010111156200013e57600080fd5b600091505b8282101562000162578482018401518183018501529083019062000143565b60008484830101528096505050506200017d81860162000089565b925050509250929050565b600181811c908216806200019d57607f821691505b602082108103620001be57634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200021257600081815260208120601f850160051c81016020861015620001ed5750805b601f850160051c820191505b818110156200020e57828155600101620001f9565b5050505b505050565b81516001600160401b0381111562000233576200023362000073565b6200024b8162000244845462000188565b84620001c4565b602080601f8311600181146200028357600084156200026a5750858301515b600019600386901b1c1916600185901b1785556200020e565b600085815260208120601f198616915b82811015620002b45788860151825594840194600190910190840162000293565b5085821015620002d35787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b610a5c80620002f36000396000f3fe608060405234801561001057600080fd5b50600436106100c95760003560e01c806340c10f19116100815780639dc29fac1161005b5780639dc29fac1461019c578063a9059cbb146101af578063dd62ed3e146101c257600080fd5b806340c10f191461014957806370a082311461015e57806395d89b411461019457600080fd5b806318160ddd116100b257806318160ddd1461010f57806323b872dd14610121578063313ce5671461013457600080fd5b806306fdde03146100ce578063095ea7b3146100ec575b600080fd5b6100d6610208565b6040516100e39190610849565b60405180910390f35b6100ff6100fa3660046108de565b61029a565b60405190151581526020016100e3565b6002545b6040519081526020016100e3565b6100ff61012f366004610908565b6102b4565b60055460405160ff90911681526020016100e3565b61015c6101573660046108de565b6102d8565b005b61011361016c366004610944565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090205490565b6100d66102e6565b61015c6101aa3660046108de565b6102f5565b6100ff6101bd3660046108de565b6102ff565b6101136101d0366004610966565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260016020908152604080832093909416825291909152205490565b60606003805461021790610999565b80601f016020809104026020016040519081016040528092919081815260200182805461024390610999565b80156102905780601f1061026557610100808354040283529160200191610290565b820191906000526020600020905b81548152906001019060200180831161027357829003601f168201915b5050505050905090565b6000336102a881858561030d565b60019150505b92915050565b6000336102c285828561031f565b6102cd8585856103f3565b506001949350505050565b6102e2828261049e565b5050565b60606004805461021790610999565b6102e282826104fa565b6000336102a88185856103f3565b61031a8383836001610556565b505050565b73ffffffffffffffffffffffffffffffffffffffff8381166000908152600160209081526040808320938616835292905220547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146103ed57818110156103de576040517ffb8f41b200000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8416600482015260248101829052604481018390526064015b60405180910390fd5b6103ed84848484036000610556565b50505050565b73ffffffffffffffffffffffffffffffffffffffff8316610443576040517f96c6fd1e000000000000000000000000000000000000000000000000000000008152600060048201526024016103d5565b73ffffffffffffffffffffffffffffffffffffffff8216610493576040517fec442f05000000000000000000000000000000000000000000000000000000008152600060048201526024016103d5565b61031a83838361069e565b73ffffffffffffffffffffffffffffffffffffffff82166104ee576040517fec442f05000000000000000000000000000000000000000000000000000000008152600060048201526024016103d5565b6102e26000838361069e565b73ffffffffffffffffffffffffffffffffffffffff821661054a576040517f96c6fd1e000000000000000000000000000000000000000000000000000000008152600060048201526024016103d5565b6102e28260008361069e565b73ffffffffffffffffffffffffffffffffffffffff84166105a6576040517fe602df05000000000000000000000000000000000000000000000000000000008152600060048201526024016103d5565b73ffffffffffffffffffffffffffffffffffffffff83166105f6576040517f94280d62000000000000000000000000000000000000000000000000000000008152600060048201526024016103d5565b73ffffffffffffffffffffffffffffffffffffffff808516600090815260016020908152604080832093871683529290522082905580156103ed578273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258460405161069091815260200190565b60405180910390a350505050565b73ffffffffffffffffffffffffffffffffffffffff83166106d65780600260008282546106cb91906109ec565b909155506107889050565b73ffffffffffffffffffffffffffffffffffffffff83166000908152602081905260409020548181101561075c576040517fe450d38c00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8516600482015260248101829052604481018390526064016103d5565b73ffffffffffffffffffffffffffffffffffffffff841660009081526020819052604090209082900390555b73ffffffffffffffffffffffffffffffffffffffff82166107b1576002805482900390556107dd565b73ffffffffffffffffffffffffffffffffffffffff821660009081526020819052604090208054820190555b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161083c91815260200190565b60405180910390a3505050565b600060208083528351808285015260005b818110156108765785810183015185820160400152820161085a565b5060006040828601015260407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8301168501019250505092915050565b803573ffffffffffffffffffffffffffffffffffffffff811681146108d957600080fd5b919050565b600080604083850312156108f157600080fd5b6108fa836108b5565b946020939093013593505050565b60008060006060848603121561091d57600080fd5b610926846108b5565b9250610934602085016108b5565b9150604084013590509250925092565b60006020828403121561095657600080fd5b61095f826108b5565b9392505050565b6000806040838503121561097957600080fd5b610982836108b5565b9150610990602084016108b5565b90509250929050565b600181811c908216806109ad57607f821691505b6020821081036109e6577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b808201808211156102ae577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fdfea2646970667358221220428220e8be4ebcf1fe446b01bd00b8071f21b3f673aaea3b2d7b75204390a40664736f6c63430008140033", } // MockERC20ABI is the input ABI used to generate the binding from. diff --git a/services/rfq/contracts/testcontracts/mockerc20/mockerc20.contractinfo.json b/services/rfq/contracts/testcontracts/mockerc20/mockerc20.contractinfo.json index b4c1719aca..8ae4477206 100644 --- a/services/rfq/contracts/testcontracts/mockerc20/mockerc20.contractinfo.json +++ b/services/rfq/contracts/testcontracts/mockerc20/mockerc20.contractinfo.json @@ -1 +1 @@ -{"solidity/MockERC20.sol:Context":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17 ^0.8.20;\n\n// lib/openzeppelin-contracts/contracts/interfaces/draft-IERC6093.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol)\n\n/**\n * @dev Standard ERC-20 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-20 tokens.\n */\ninterface IERC20Errors {\n /**\n * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n * @param balance Current balance for the interacting account.\n * @param needed Minimum amount required to perform a transfer.\n */\n error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);\n\n /**\n * @dev Indicates a failure with the token `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n */\n error ERC20InvalidSender(address sender);\n\n /**\n * @dev Indicates a failure with the token `receiver`. Used in transfers.\n * @param receiver Address to which tokens are being transferred.\n */\n error ERC20InvalidReceiver(address receiver);\n\n /**\n * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.\n * @param spender Address that may be allowed to operate on tokens without being their owner.\n * @param allowance Amount of tokens a `spender` is allowed to operate with.\n * @param needed Minimum amount required to perform a transfer.\n */\n error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);\n\n /**\n * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n * @param approver Address initiating an approval operation.\n */\n error ERC20InvalidApprover(address approver);\n\n /**\n * @dev Indicates a failure with the `spender` to be approved. Used in approvals.\n * @param spender Address that may be allowed to operate on tokens without being their owner.\n */\n error ERC20InvalidSpender(address spender);\n}\n\n/**\n * @dev Standard ERC-721 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-721 tokens.\n */\ninterface IERC721Errors {\n /**\n * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in ERC-20.\n * Used in balance queries.\n * @param owner Address of the current owner of a token.\n */\n error ERC721InvalidOwner(address owner);\n\n /**\n * @dev Indicates a `tokenId` whose `owner` is the zero address.\n * @param tokenId Identifier number of a token.\n */\n error ERC721NonexistentToken(uint256 tokenId);\n\n /**\n * @dev Indicates an error related to the ownership over a particular token. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n * @param tokenId Identifier number of a token.\n * @param owner Address of the current owner of a token.\n */\n error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);\n\n /**\n * @dev Indicates a failure with the token `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n */\n error ERC721InvalidSender(address sender);\n\n /**\n * @dev Indicates a failure with the token `receiver`. Used in transfers.\n * @param receiver Address to which tokens are being transferred.\n */\n error ERC721InvalidReceiver(address receiver);\n\n /**\n * @dev Indicates a failure with the `operator`’s approval. Used in transfers.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n * @param tokenId Identifier number of a token.\n */\n error ERC721InsufficientApproval(address operator, uint256 tokenId);\n\n /**\n * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n * @param approver Address initiating an approval operation.\n */\n error ERC721InvalidApprover(address approver);\n\n /**\n * @dev Indicates a failure with the `operator` to be approved. Used in approvals.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n */\n error ERC721InvalidOperator(address operator);\n}\n\n/**\n * @dev Standard ERC-1155 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-1155 tokens.\n */\ninterface IERC1155Errors {\n /**\n * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n * @param balance Current balance for the interacting account.\n * @param needed Minimum amount required to perform a transfer.\n * @param tokenId Identifier number of a token.\n */\n error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);\n\n /**\n * @dev Indicates a failure with the token `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n */\n error ERC1155InvalidSender(address sender);\n\n /**\n * @dev Indicates a failure with the token `receiver`. Used in transfers.\n * @param receiver Address to which tokens are being transferred.\n */\n error ERC1155InvalidReceiver(address receiver);\n\n /**\n * @dev Indicates a failure with the `operator`’s approval. Used in transfers.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n * @param owner Address of the current owner of a token.\n */\n error ERC1155MissingApprovalForAll(address operator, address owner);\n\n /**\n * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n * @param approver Address initiating an approval operation.\n */\n error ERC1155InvalidApprover(address approver);\n\n /**\n * @dev Indicates a failure with the `operator` to be approved. Used in approvals.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n */\n error ERC1155InvalidOperator(address operator);\n\n /**\n * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.\n * Used in batch transfers.\n * @param idsLength Length of the array of token identifiers\n * @param valuesLength Length of the array of token amounts\n */\n error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);\n}\n\n// lib/openzeppelin-contracts/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 ERC-20 standard as defined in the ERC.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the value of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the value of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 value) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n * caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 value) external returns (bool);\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\n * allowance mechanism. `value` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n\n// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol)\n\n/**\n * @dev Interface for the optional metadata functions from the ERC-20 standard.\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n\n// lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/ERC20.sol)\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * The default value of {decimals} is 18. To change this, you should override\n * this function so it returns a different value.\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC-20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the ERC may not emit\n * these events, as it isn't required by the specification.\n */\nabstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors {\n mapping(address account =\u003e uint256) private _balances;\n\n mapping(address account =\u003e mapping(address spender =\u003e uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the default value returned by this function, unless\n * it's overridden.\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `value`.\n */\n function transfer(address to, uint256 value) public virtual returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, value);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 value) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, value);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the ERC. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `value`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `value`.\n */\n function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, value);\n _transfer(from, to, value);\n return true;\n }\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * NOTE: This function is not virtual, {_update} should be overridden instead.\n */\n function _transfer(address from, address to, uint256 value) internal {\n if (from == address(0)) {\n revert ERC20InvalidSender(address(0));\n }\n if (to == address(0)) {\n revert ERC20InvalidReceiver(address(0));\n }\n _update(from, to, value);\n }\n\n /**\n * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from`\n * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding\n * this function.\n *\n * Emits a {Transfer} event.\n */\n function _update(address from, address to, uint256 value) internal virtual {\n if (from == address(0)) {\n // Overflow check required: The rest of the code assumes that totalSupply never overflows\n _totalSupply += value;\n } else {\n uint256 fromBalance = _balances[from];\n if (fromBalance \u003c value) {\n revert ERC20InsufficientBalance(from, fromBalance, value);\n }\n unchecked {\n // Overflow not possible: value \u003c= fromBalance \u003c= totalSupply.\n _balances[from] = fromBalance - value;\n }\n }\n\n if (to == address(0)) {\n unchecked {\n // Overflow not possible: value \u003c= totalSupply or value \u003c= fromBalance \u003c= totalSupply.\n _totalSupply -= value;\n }\n } else {\n unchecked {\n // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.\n _balances[to] += value;\n }\n }\n\n emit Transfer(from, to, value);\n }\n\n /**\n * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).\n * Relies on the `_update` mechanism\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * NOTE: This function is not virtual, {_update} should be overridden instead.\n */\n function _mint(address account, uint256 value) internal {\n if (account == address(0)) {\n revert ERC20InvalidReceiver(address(0));\n }\n _update(address(0), account, value);\n }\n\n /**\n * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply.\n * Relies on the `_update` mechanism.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * NOTE: This function is not virtual, {_update} should be overridden instead\n */\n function _burn(address account, uint256 value) internal {\n if (account == address(0)) {\n revert ERC20InvalidSender(address(0));\n }\n _update(account, address(0), value);\n }\n\n /**\n * @dev Sets `value` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n *\n * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.\n */\n function _approve(address owner, address spender, uint256 value) internal {\n _approve(owner, spender, value, true);\n }\n\n /**\n * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event.\n *\n * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by\n * `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any\n * `Approval` event during `transferFrom` operations.\n *\n * Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to\n * true using the following override:\n * ```\n * function _approve(address owner, address spender, uint256 value, bool) internal virtual override {\n * super._approve(owner, spender, value, true);\n * }\n * ```\n *\n * Requirements are the same as {_approve}.\n */\n function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {\n if (owner == address(0)) {\n revert ERC20InvalidApprover(address(0));\n }\n if (spender == address(0)) {\n revert ERC20InvalidSpender(address(0));\n }\n _allowances[owner][spender] = value;\n if (emitEvent) {\n emit Approval(owner, spender, value);\n }\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `value`.\n *\n * Does not update the allowance value in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Does not emit an {Approval} event.\n */\n function _spendAllowance(address owner, address spender, uint256 value) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n if (currentAllowance \u003c value) {\n revert ERC20InsufficientAllowance(spender, currentAllowance, value);\n }\n unchecked {\n _approve(owner, spender, currentAllowance - value, false);\n }\n }\n }\n}\n\n// test/MockERC20.sol\n\ncontract MockERC20 is ERC20 {\n uint8 private _decimals;\n\n constructor(string memory name_, uint8 decimals_) ERC20(name_, name_) {\n _decimals = decimals_;\n }\n\n function decimals() public view override returns (uint8) {\n return _decimals;\n }\n\n function burn(address account, uint256 amount) external {\n _burn(account, amount);\n }\n\n function mint(address account, uint256 amount) external {\n _mint(account, amount);\n }\n}\n","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","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.20+commit.a1b79de6\"},\"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/MockERC20.sol\":\"Context\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/MockERC20.sol\":{\"keccak256\":\"0xf65c9d7a8c41c471bcbffaf66e7b9353696ec5f2946643acc4f44e0fea54071a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://4a127daf5ac1aec89a139d3e60e127b1bf2347057f27379b9cbea0a1709e9bd0\",\"dweb:/ipfs/QmNQ9B9Fo3Z95JCHRhPX4UdVdpHwgtX8sWcaq1UQzCmxBc\"]}},\"version\":1}"},"hashes":{}},"solidity/MockERC20.sol:ERC20":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17 ^0.8.20;\n\n// lib/openzeppelin-contracts/contracts/interfaces/draft-IERC6093.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol)\n\n/**\n * @dev Standard ERC-20 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-20 tokens.\n */\ninterface IERC20Errors {\n /**\n * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n * @param balance Current balance for the interacting account.\n * @param needed Minimum amount required to perform a transfer.\n */\n error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);\n\n /**\n * @dev Indicates a failure with the token `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n */\n error ERC20InvalidSender(address sender);\n\n /**\n * @dev Indicates a failure with the token `receiver`. Used in transfers.\n * @param receiver Address to which tokens are being transferred.\n */\n error ERC20InvalidReceiver(address receiver);\n\n /**\n * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.\n * @param spender Address that may be allowed to operate on tokens without being their owner.\n * @param allowance Amount of tokens a `spender` is allowed to operate with.\n * @param needed Minimum amount required to perform a transfer.\n */\n error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);\n\n /**\n * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n * @param approver Address initiating an approval operation.\n */\n error ERC20InvalidApprover(address approver);\n\n /**\n * @dev Indicates a failure with the `spender` to be approved. Used in approvals.\n * @param spender Address that may be allowed to operate on tokens without being their owner.\n */\n error ERC20InvalidSpender(address spender);\n}\n\n/**\n * @dev Standard ERC-721 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-721 tokens.\n */\ninterface IERC721Errors {\n /**\n * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in ERC-20.\n * Used in balance queries.\n * @param owner Address of the current owner of a token.\n */\n error ERC721InvalidOwner(address owner);\n\n /**\n * @dev Indicates a `tokenId` whose `owner` is the zero address.\n * @param tokenId Identifier number of a token.\n */\n error ERC721NonexistentToken(uint256 tokenId);\n\n /**\n * @dev Indicates an error related to the ownership over a particular token. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n * @param tokenId Identifier number of a token.\n * @param owner Address of the current owner of a token.\n */\n error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);\n\n /**\n * @dev Indicates a failure with the token `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n */\n error ERC721InvalidSender(address sender);\n\n /**\n * @dev Indicates a failure with the token `receiver`. Used in transfers.\n * @param receiver Address to which tokens are being transferred.\n */\n error ERC721InvalidReceiver(address receiver);\n\n /**\n * @dev Indicates a failure with the `operator`’s approval. Used in transfers.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n * @param tokenId Identifier number of a token.\n */\n error ERC721InsufficientApproval(address operator, uint256 tokenId);\n\n /**\n * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n * @param approver Address initiating an approval operation.\n */\n error ERC721InvalidApprover(address approver);\n\n /**\n * @dev Indicates a failure with the `operator` to be approved. Used in approvals.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n */\n error ERC721InvalidOperator(address operator);\n}\n\n/**\n * @dev Standard ERC-1155 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-1155 tokens.\n */\ninterface IERC1155Errors {\n /**\n * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n * @param balance Current balance for the interacting account.\n * @param needed Minimum amount required to perform a transfer.\n * @param tokenId Identifier number of a token.\n */\n error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);\n\n /**\n * @dev Indicates a failure with the token `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n */\n error ERC1155InvalidSender(address sender);\n\n /**\n * @dev Indicates a failure with the token `receiver`. Used in transfers.\n * @param receiver Address to which tokens are being transferred.\n */\n error ERC1155InvalidReceiver(address receiver);\n\n /**\n * @dev Indicates a failure with the `operator`’s approval. Used in transfers.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n * @param owner Address of the current owner of a token.\n */\n error ERC1155MissingApprovalForAll(address operator, address owner);\n\n /**\n * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n * @param approver Address initiating an approval operation.\n */\n error ERC1155InvalidApprover(address approver);\n\n /**\n * @dev Indicates a failure with the `operator` to be approved. Used in approvals.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n */\n error ERC1155InvalidOperator(address operator);\n\n /**\n * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.\n * Used in batch transfers.\n * @param idsLength Length of the array of token identifiers\n * @param valuesLength Length of the array of token amounts\n */\n error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);\n}\n\n// lib/openzeppelin-contracts/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 ERC-20 standard as defined in the ERC.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the value of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the value of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 value) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n * caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 value) external returns (bool);\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\n * allowance mechanism. `value` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n\n// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol)\n\n/**\n * @dev Interface for the optional metadata functions from the ERC-20 standard.\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n\n// lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/ERC20.sol)\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * The default value of {decimals} is 18. To change this, you should override\n * this function so it returns a different value.\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC-20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the ERC may not emit\n * these events, as it isn't required by the specification.\n */\nabstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors {\n mapping(address account =\u003e uint256) private _balances;\n\n mapping(address account =\u003e mapping(address spender =\u003e uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the default value returned by this function, unless\n * it's overridden.\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `value`.\n */\n function transfer(address to, uint256 value) public virtual returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, value);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 value) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, value);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the ERC. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `value`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `value`.\n */\n function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, value);\n _transfer(from, to, value);\n return true;\n }\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * NOTE: This function is not virtual, {_update} should be overridden instead.\n */\n function _transfer(address from, address to, uint256 value) internal {\n if (from == address(0)) {\n revert ERC20InvalidSender(address(0));\n }\n if (to == address(0)) {\n revert ERC20InvalidReceiver(address(0));\n }\n _update(from, to, value);\n }\n\n /**\n * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from`\n * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding\n * this function.\n *\n * Emits a {Transfer} event.\n */\n function _update(address from, address to, uint256 value) internal virtual {\n if (from == address(0)) {\n // Overflow check required: The rest of the code assumes that totalSupply never overflows\n _totalSupply += value;\n } else {\n uint256 fromBalance = _balances[from];\n if (fromBalance \u003c value) {\n revert ERC20InsufficientBalance(from, fromBalance, value);\n }\n unchecked {\n // Overflow not possible: value \u003c= fromBalance \u003c= totalSupply.\n _balances[from] = fromBalance - value;\n }\n }\n\n if (to == address(0)) {\n unchecked {\n // Overflow not possible: value \u003c= totalSupply or value \u003c= fromBalance \u003c= totalSupply.\n _totalSupply -= value;\n }\n } else {\n unchecked {\n // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.\n _balances[to] += value;\n }\n }\n\n emit Transfer(from, to, value);\n }\n\n /**\n * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).\n * Relies on the `_update` mechanism\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * NOTE: This function is not virtual, {_update} should be overridden instead.\n */\n function _mint(address account, uint256 value) internal {\n if (account == address(0)) {\n revert ERC20InvalidReceiver(address(0));\n }\n _update(address(0), account, value);\n }\n\n /**\n * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply.\n * Relies on the `_update` mechanism.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * NOTE: This function is not virtual, {_update} should be overridden instead\n */\n function _burn(address account, uint256 value) internal {\n if (account == address(0)) {\n revert ERC20InvalidSender(address(0));\n }\n _update(account, address(0), value);\n }\n\n /**\n * @dev Sets `value` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n *\n * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.\n */\n function _approve(address owner, address spender, uint256 value) internal {\n _approve(owner, spender, value, true);\n }\n\n /**\n * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event.\n *\n * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by\n * `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any\n * `Approval` event during `transferFrom` operations.\n *\n * Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to\n * true using the following override:\n * ```\n * function _approve(address owner, address spender, uint256 value, bool) internal virtual override {\n * super._approve(owner, spender, value, true);\n * }\n * ```\n *\n * Requirements are the same as {_approve}.\n */\n function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {\n if (owner == address(0)) {\n revert ERC20InvalidApprover(address(0));\n }\n if (spender == address(0)) {\n revert ERC20InvalidSpender(address(0));\n }\n _allowances[owner][spender] = value;\n if (emitEvent) {\n emit Approval(owner, spender, value);\n }\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `value`.\n *\n * Does not update the allowance value in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Does not emit an {Approval} event.\n */\n function _spendAllowance(address owner, address spender, uint256 value) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n if (currentAllowance \u003c value) {\n revert ERC20InsufficientAllowance(spender, currentAllowance, value);\n }\n unchecked {\n _approve(owner, spender, currentAllowance - value, false);\n }\n }\n }\n}\n\n// test/MockERC20.sol\n\ncontract MockERC20 is ERC20 {\n uint8 private _decimals;\n\n constructor(string memory name_, uint8 decimals_) ERC20(name_, name_) {\n _decimals = decimals_;\n }\n\n function decimals() public view override returns (uint8) {\n return _decimals;\n }\n\n function burn(address account, uint256 amount) external {\n _burn(account, amount);\n }\n\n function mint(address account, uint256 amount) external {\n _mint(account, amount);\n }\n}\n","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","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":"spender","type":"address"},{"internalType":"uint256","name":"allowance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"ERC20InsufficientAllowance","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"ERC20InsufficientBalance","type":"error"},{"inputs":[{"internalType":"address","name":"approver","type":"address"}],"name":"ERC20InvalidApprover","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC20InvalidReceiver","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"ERC20InvalidSender","type":"error"},{"inputs":[{"internalType":"address","name":"spender","type":"address"}],"name":"ERC20InvalidSpender","type":"error"},{"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":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"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":"Implementation of the {IERC20} interface. This implementation is agnostic to the way tokens are created. This means that a supply mechanism has to be added in a derived contract using {_mint}. TIP: For a detailed writeup see our guide https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How to implement supply mechanisms]. The default value of {decimals} is 18. To change this, you should override this function so it returns a different value. We have followed general OpenZeppelin Contracts guidelines: functions revert instead returning `false` on failure. This behavior is nonetheless conventional and does not conflict with the expectations of ERC-20 applications. Additionally, an {Approval} event is emitted on calls to {transferFrom}. This allows applications to reconstruct the allowance for all accounts just by listening to said events. Other implementations of the ERC may not emit these events, as it isn't required by the specification.","errors":{"ERC20InsufficientAllowance(address,uint256,uint256)":[{"details":"Indicates a failure with the `spender`’s `allowance`. Used in transfers.","params":{"allowance":"Amount of tokens a `spender` is allowed to operate with.","needed":"Minimum amount required to perform a transfer.","spender":"Address that may be allowed to operate on tokens without being their owner."}}],"ERC20InsufficientBalance(address,uint256,uint256)":[{"details":"Indicates an error related to the current `balance` of a `sender`. Used in transfers.","params":{"balance":"Current balance for the interacting account.","needed":"Minimum amount required to perform a transfer.","sender":"Address whose tokens are being transferred."}}],"ERC20InvalidApprover(address)":[{"details":"Indicates a failure with the `approver` of a token to be approved. Used in approvals.","params":{"approver":"Address initiating an approval operation."}}],"ERC20InvalidReceiver(address)":[{"details":"Indicates a failure with the token `receiver`. Used in transfers.","params":{"receiver":"Address to which tokens are being transferred."}}],"ERC20InvalidSender(address)":[{"details":"Indicates a failure with the token `sender`. Used in transfers.","params":{"sender":"Address whose tokens are being transferred."}}],"ERC20InvalidSpender(address)":[{"details":"Indicates a failure with the `spender` to be approved. Used in approvals.","params":{"spender":"Address that may be allowed to operate on tokens without being their owner."}}]},"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":"See {IERC20-allowance}."},"approve(address,uint256)":{"details":"See {IERC20-approve}. NOTE: If `value` is the maximum `uint256`, the allowance is not updated on `transferFrom`. This is semantically equivalent to an infinite approval. Requirements: - `spender` cannot be the zero address."},"balanceOf(address)":{"details":"See {IERC20-balanceOf}."},"constructor":{"details":"Sets the values for {name} and {symbol}. All two of these values are immutable: they can only be set once during construction."},"decimals()":{"details":"Returns the number of decimals used to get its user representation. For example, if `decimals` equals `2`, a balance of `505` tokens should be displayed to a user as `5.05` (`505 / 10 ** 2`). Tokens usually opt for a value of 18, imitating the relationship between Ether and Wei. This is the default value returned by this function, unless it's overridden. NOTE: This information is only used for _display_ purposes: it in no way affects any of the arithmetic of the contract, including {IERC20-balanceOf} and {IERC20-transfer}."},"name()":{"details":"Returns the name of the token."},"symbol()":{"details":"Returns the symbol of the token, usually a shorter version of the name."},"totalSupply()":{"details":"See {IERC20-totalSupply}."},"transfer(address,uint256)":{"details":"See {IERC20-transfer}. Requirements: - `to` cannot be the zero address. - the caller must have a balance of at least `value`."},"transferFrom(address,address,uint256)":{"details":"See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the ERC. See the note at the beginning of {ERC20}. NOTE: Does not update the allowance if the current allowance is the maximum `uint256`. Requirements: - `from` and `to` cannot be the zero address. - `from` must have a balance of at least `value`. - the caller must have allowance for ``from``'s tokens of at least `value`."}},"version":1},"metadata":"{\"compiler\":{\"version\":\"0.8.20+commit.a1b79de6\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"allowance\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"needed\",\"type\":\"uint256\"}],\"name\":\"ERC20InsufficientAllowance\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"balance\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"needed\",\"type\":\"uint256\"}],\"name\":\"ERC20InsufficientBalance\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"approver\",\"type\":\"address\"}],\"name\":\"ERC20InvalidApprover\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"}],\"name\":\"ERC20InvalidReceiver\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"ERC20InvalidSender\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"}],\"name\":\"ERC20InvalidSpender\",\"type\":\"error\"},{\"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\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"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\":\"Implementation of the {IERC20} interface. This implementation is agnostic to the way tokens are created. This means that a supply mechanism has to be added in a derived contract using {_mint}. TIP: For a detailed writeup see our guide https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How to implement supply mechanisms]. The default value of {decimals} is 18. To change this, you should override this function so it returns a different value. We have followed general OpenZeppelin Contracts guidelines: functions revert instead returning `false` on failure. This behavior is nonetheless conventional and does not conflict with the expectations of ERC-20 applications. Additionally, an {Approval} event is emitted on calls to {transferFrom}. This allows applications to reconstruct the allowance for all accounts just by listening to said events. Other implementations of the ERC may not emit these events, as it isn't required by the specification.\",\"errors\":{\"ERC20InsufficientAllowance(address,uint256,uint256)\":[{\"details\":\"Indicates a failure with the `spender`\\u2019s `allowance`. Used in transfers.\",\"params\":{\"allowance\":\"Amount of tokens a `spender` is allowed to operate with.\",\"needed\":\"Minimum amount required to perform a transfer.\",\"spender\":\"Address that may be allowed to operate on tokens without being their owner.\"}}],\"ERC20InsufficientBalance(address,uint256,uint256)\":[{\"details\":\"Indicates an error related to the current `balance` of a `sender`. Used in transfers.\",\"params\":{\"balance\":\"Current balance for the interacting account.\",\"needed\":\"Minimum amount required to perform a transfer.\",\"sender\":\"Address whose tokens are being transferred.\"}}],\"ERC20InvalidApprover(address)\":[{\"details\":\"Indicates a failure with the `approver` of a token to be approved. Used in approvals.\",\"params\":{\"approver\":\"Address initiating an approval operation.\"}}],\"ERC20InvalidReceiver(address)\":[{\"details\":\"Indicates a failure with the token `receiver`. Used in transfers.\",\"params\":{\"receiver\":\"Address to which tokens are being transferred.\"}}],\"ERC20InvalidSender(address)\":[{\"details\":\"Indicates a failure with the token `sender`. Used in transfers.\",\"params\":{\"sender\":\"Address whose tokens are being transferred.\"}}],\"ERC20InvalidSpender(address)\":[{\"details\":\"Indicates a failure with the `spender` to be approved. Used in approvals.\",\"params\":{\"spender\":\"Address that may be allowed to operate on tokens without being their owner.\"}}]},\"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\":\"See {IERC20-allowance}.\"},\"approve(address,uint256)\":{\"details\":\"See {IERC20-approve}. NOTE: If `value` is the maximum `uint256`, the allowance is not updated on `transferFrom`. This is semantically equivalent to an infinite approval. Requirements: - `spender` cannot be the zero address.\"},\"balanceOf(address)\":{\"details\":\"See {IERC20-balanceOf}.\"},\"constructor\":{\"details\":\"Sets the values for {name} and {symbol}. All two of these values are immutable: they can only be set once during construction.\"},\"decimals()\":{\"details\":\"Returns the number of decimals used to get its user representation. For example, if `decimals` equals `2`, a balance of `505` tokens should be displayed to a user as `5.05` (`505 / 10 ** 2`). Tokens usually opt for a value of 18, imitating the relationship between Ether and Wei. This is the default value returned by this function, unless it's overridden. NOTE: This information is only used for _display_ purposes: it in no way affects any of the arithmetic of the contract, including {IERC20-balanceOf} and {IERC20-transfer}.\"},\"name()\":{\"details\":\"Returns the name of the token.\"},\"symbol()\":{\"details\":\"Returns the symbol of the token, usually a shorter version of the name.\"},\"totalSupply()\":{\"details\":\"See {IERC20-totalSupply}.\"},\"transfer(address,uint256)\":{\"details\":\"See {IERC20-transfer}. Requirements: - `to` cannot be the zero address. - the caller must have a balance of at least `value`.\"},\"transferFrom(address,address,uint256)\":{\"details\":\"See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the ERC. See the note at the beginning of {ERC20}. NOTE: Does not update the allowance if the current allowance is the maximum `uint256`. Requirements: - `from` and `to` cannot be the zero address. - `from` must have a balance of at least `value`. - the caller must have allowance for ``from``'s tokens of at least `value`.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/MockERC20.sol\":\"ERC20\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/MockERC20.sol\":{\"keccak256\":\"0xf65c9d7a8c41c471bcbffaf66e7b9353696ec5f2946643acc4f44e0fea54071a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://4a127daf5ac1aec89a139d3e60e127b1bf2347057f27379b9cbea0a1709e9bd0\",\"dweb:/ipfs/QmNQ9B9Fo3Z95JCHRhPX4UdVdpHwgtX8sWcaq1UQzCmxBc\"]}},\"version\":1}"},"hashes":{"allowance(address,address)":"dd62ed3e","approve(address,uint256)":"095ea7b3","balanceOf(address)":"70a08231","decimals()":"313ce567","name()":"06fdde03","symbol()":"95d89b41","totalSupply()":"18160ddd","transfer(address,uint256)":"a9059cbb","transferFrom(address,address,uint256)":"23b872dd"}},"solidity/MockERC20.sol:IERC1155Errors":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17 ^0.8.20;\n\n// lib/openzeppelin-contracts/contracts/interfaces/draft-IERC6093.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol)\n\n/**\n * @dev Standard ERC-20 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-20 tokens.\n */\ninterface IERC20Errors {\n /**\n * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n * @param balance Current balance for the interacting account.\n * @param needed Minimum amount required to perform a transfer.\n */\n error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);\n\n /**\n * @dev Indicates a failure with the token `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n */\n error ERC20InvalidSender(address sender);\n\n /**\n * @dev Indicates a failure with the token `receiver`. Used in transfers.\n * @param receiver Address to which tokens are being transferred.\n */\n error ERC20InvalidReceiver(address receiver);\n\n /**\n * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.\n * @param spender Address that may be allowed to operate on tokens without being their owner.\n * @param allowance Amount of tokens a `spender` is allowed to operate with.\n * @param needed Minimum amount required to perform a transfer.\n */\n error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);\n\n /**\n * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n * @param approver Address initiating an approval operation.\n */\n error ERC20InvalidApprover(address approver);\n\n /**\n * @dev Indicates a failure with the `spender` to be approved. Used in approvals.\n * @param spender Address that may be allowed to operate on tokens without being their owner.\n */\n error ERC20InvalidSpender(address spender);\n}\n\n/**\n * @dev Standard ERC-721 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-721 tokens.\n */\ninterface IERC721Errors {\n /**\n * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in ERC-20.\n * Used in balance queries.\n * @param owner Address of the current owner of a token.\n */\n error ERC721InvalidOwner(address owner);\n\n /**\n * @dev Indicates a `tokenId` whose `owner` is the zero address.\n * @param tokenId Identifier number of a token.\n */\n error ERC721NonexistentToken(uint256 tokenId);\n\n /**\n * @dev Indicates an error related to the ownership over a particular token. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n * @param tokenId Identifier number of a token.\n * @param owner Address of the current owner of a token.\n */\n error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);\n\n /**\n * @dev Indicates a failure with the token `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n */\n error ERC721InvalidSender(address sender);\n\n /**\n * @dev Indicates a failure with the token `receiver`. Used in transfers.\n * @param receiver Address to which tokens are being transferred.\n */\n error ERC721InvalidReceiver(address receiver);\n\n /**\n * @dev Indicates a failure with the `operator`’s approval. Used in transfers.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n * @param tokenId Identifier number of a token.\n */\n error ERC721InsufficientApproval(address operator, uint256 tokenId);\n\n /**\n * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n * @param approver Address initiating an approval operation.\n */\n error ERC721InvalidApprover(address approver);\n\n /**\n * @dev Indicates a failure with the `operator` to be approved. Used in approvals.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n */\n error ERC721InvalidOperator(address operator);\n}\n\n/**\n * @dev Standard ERC-1155 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-1155 tokens.\n */\ninterface IERC1155Errors {\n /**\n * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n * @param balance Current balance for the interacting account.\n * @param needed Minimum amount required to perform a transfer.\n * @param tokenId Identifier number of a token.\n */\n error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);\n\n /**\n * @dev Indicates a failure with the token `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n */\n error ERC1155InvalidSender(address sender);\n\n /**\n * @dev Indicates a failure with the token `receiver`. Used in transfers.\n * @param receiver Address to which tokens are being transferred.\n */\n error ERC1155InvalidReceiver(address receiver);\n\n /**\n * @dev Indicates a failure with the `operator`’s approval. Used in transfers.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n * @param owner Address of the current owner of a token.\n */\n error ERC1155MissingApprovalForAll(address operator, address owner);\n\n /**\n * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n * @param approver Address initiating an approval operation.\n */\n error ERC1155InvalidApprover(address approver);\n\n /**\n * @dev Indicates a failure with the `operator` to be approved. Used in approvals.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n */\n error ERC1155InvalidOperator(address operator);\n\n /**\n * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.\n * Used in batch transfers.\n * @param idsLength Length of the array of token identifiers\n * @param valuesLength Length of the array of token amounts\n */\n error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);\n}\n\n// lib/openzeppelin-contracts/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 ERC-20 standard as defined in the ERC.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the value of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the value of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 value) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n * caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 value) external returns (bool);\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\n * allowance mechanism. `value` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n\n// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol)\n\n/**\n * @dev Interface for the optional metadata functions from the ERC-20 standard.\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n\n// lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/ERC20.sol)\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * The default value of {decimals} is 18. To change this, you should override\n * this function so it returns a different value.\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC-20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the ERC may not emit\n * these events, as it isn't required by the specification.\n */\nabstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors {\n mapping(address account =\u003e uint256) private _balances;\n\n mapping(address account =\u003e mapping(address spender =\u003e uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the default value returned by this function, unless\n * it's overridden.\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `value`.\n */\n function transfer(address to, uint256 value) public virtual returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, value);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 value) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, value);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the ERC. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `value`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `value`.\n */\n function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, value);\n _transfer(from, to, value);\n return true;\n }\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * NOTE: This function is not virtual, {_update} should be overridden instead.\n */\n function _transfer(address from, address to, uint256 value) internal {\n if (from == address(0)) {\n revert ERC20InvalidSender(address(0));\n }\n if (to == address(0)) {\n revert ERC20InvalidReceiver(address(0));\n }\n _update(from, to, value);\n }\n\n /**\n * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from`\n * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding\n * this function.\n *\n * Emits a {Transfer} event.\n */\n function _update(address from, address to, uint256 value) internal virtual {\n if (from == address(0)) {\n // Overflow check required: The rest of the code assumes that totalSupply never overflows\n _totalSupply += value;\n } else {\n uint256 fromBalance = _balances[from];\n if (fromBalance \u003c value) {\n revert ERC20InsufficientBalance(from, fromBalance, value);\n }\n unchecked {\n // Overflow not possible: value \u003c= fromBalance \u003c= totalSupply.\n _balances[from] = fromBalance - value;\n }\n }\n\n if (to == address(0)) {\n unchecked {\n // Overflow not possible: value \u003c= totalSupply or value \u003c= fromBalance \u003c= totalSupply.\n _totalSupply -= value;\n }\n } else {\n unchecked {\n // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.\n _balances[to] += value;\n }\n }\n\n emit Transfer(from, to, value);\n }\n\n /**\n * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).\n * Relies on the `_update` mechanism\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * NOTE: This function is not virtual, {_update} should be overridden instead.\n */\n function _mint(address account, uint256 value) internal {\n if (account == address(0)) {\n revert ERC20InvalidReceiver(address(0));\n }\n _update(address(0), account, value);\n }\n\n /**\n * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply.\n * Relies on the `_update` mechanism.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * NOTE: This function is not virtual, {_update} should be overridden instead\n */\n function _burn(address account, uint256 value) internal {\n if (account == address(0)) {\n revert ERC20InvalidSender(address(0));\n }\n _update(account, address(0), value);\n }\n\n /**\n * @dev Sets `value` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n *\n * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.\n */\n function _approve(address owner, address spender, uint256 value) internal {\n _approve(owner, spender, value, true);\n }\n\n /**\n * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event.\n *\n * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by\n * `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any\n * `Approval` event during `transferFrom` operations.\n *\n * Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to\n * true using the following override:\n * ```\n * function _approve(address owner, address spender, uint256 value, bool) internal virtual override {\n * super._approve(owner, spender, value, true);\n * }\n * ```\n *\n * Requirements are the same as {_approve}.\n */\n function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {\n if (owner == address(0)) {\n revert ERC20InvalidApprover(address(0));\n }\n if (spender == address(0)) {\n revert ERC20InvalidSpender(address(0));\n }\n _allowances[owner][spender] = value;\n if (emitEvent) {\n emit Approval(owner, spender, value);\n }\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `value`.\n *\n * Does not update the allowance value in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Does not emit an {Approval} event.\n */\n function _spendAllowance(address owner, address spender, uint256 value) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n if (currentAllowance \u003c value) {\n revert ERC20InsufficientAllowance(spender, currentAllowance, value);\n }\n unchecked {\n _approve(owner, spender, currentAllowance - value, false);\n }\n }\n }\n}\n\n// test/MockERC20.sol\n\ncontract MockERC20 is ERC20 {\n uint8 private _decimals;\n\n constructor(string memory name_, uint8 decimals_) ERC20(name_, name_) {\n _decimals = decimals_;\n }\n\n function decimals() public view override returns (uint8) {\n return _decimals;\n }\n\n function burn(address account, uint256 amount) external {\n _burn(account, amount);\n }\n\n function mint(address account, uint256 amount) external {\n _mint(account, amount);\n }\n}\n","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","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":"sender","type":"address"},{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ERC1155InsufficientBalance","type":"error"},{"inputs":[{"internalType":"address","name":"approver","type":"address"}],"name":"ERC1155InvalidApprover","type":"error"},{"inputs":[{"internalType":"uint256","name":"idsLength","type":"uint256"},{"internalType":"uint256","name":"valuesLength","type":"uint256"}],"name":"ERC1155InvalidArrayLength","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"ERC1155InvalidOperator","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC1155InvalidReceiver","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"ERC1155InvalidSender","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"address","name":"owner","type":"address"}],"name":"ERC1155MissingApprovalForAll","type":"error"}],"userDoc":{"kind":"user","methods":{},"version":1},"developerDoc":{"details":"Standard ERC-1155 Errors Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-1155 tokens.","errors":{"ERC1155InsufficientBalance(address,uint256,uint256,uint256)":[{"details":"Indicates an error related to the current `balance` of a `sender`. Used in transfers.","params":{"balance":"Current balance for the interacting account.","needed":"Minimum amount required to perform a transfer.","sender":"Address whose tokens are being transferred.","tokenId":"Identifier number of a token."}}],"ERC1155InvalidApprover(address)":[{"details":"Indicates a failure with the `approver` of a token to be approved. Used in approvals.","params":{"approver":"Address initiating an approval operation."}}],"ERC1155InvalidArrayLength(uint256,uint256)":[{"details":"Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation. Used in batch transfers.","params":{"idsLength":"Length of the array of token identifiers","valuesLength":"Length of the array of token amounts"}}],"ERC1155InvalidOperator(address)":[{"details":"Indicates a failure with the `operator` to be approved. Used in approvals.","params":{"operator":"Address that may be allowed to operate on tokens without being their owner."}}],"ERC1155InvalidReceiver(address)":[{"details":"Indicates a failure with the token `receiver`. Used in transfers.","params":{"receiver":"Address to which tokens are being transferred."}}],"ERC1155InvalidSender(address)":[{"details":"Indicates a failure with the token `sender`. Used in transfers.","params":{"sender":"Address whose tokens are being transferred."}}],"ERC1155MissingApprovalForAll(address,address)":[{"details":"Indicates a failure with the `operator`’s approval. Used in transfers.","params":{"operator":"Address that may be allowed to operate on tokens without being their owner.","owner":"Address of the current owner of a token."}}]},"kind":"dev","methods":{},"version":1},"metadata":"{\"compiler\":{\"version\":\"0.8.20+commit.a1b79de6\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"balance\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"needed\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"ERC1155InsufficientBalance\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"approver\",\"type\":\"address\"}],\"name\":\"ERC1155InvalidApprover\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"idsLength\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"valuesLength\",\"type\":\"uint256\"}],\"name\":\"ERC1155InvalidArrayLength\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"ERC1155InvalidOperator\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"}],\"name\":\"ERC1155InvalidReceiver\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"ERC1155InvalidSender\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"ERC1155MissingApprovalForAll\",\"type\":\"error\"}],\"devdoc\":{\"details\":\"Standard ERC-1155 Errors Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-1155 tokens.\",\"errors\":{\"ERC1155InsufficientBalance(address,uint256,uint256,uint256)\":[{\"details\":\"Indicates an error related to the current `balance` of a `sender`. Used in transfers.\",\"params\":{\"balance\":\"Current balance for the interacting account.\",\"needed\":\"Minimum amount required to perform a transfer.\",\"sender\":\"Address whose tokens are being transferred.\",\"tokenId\":\"Identifier number of a token.\"}}],\"ERC1155InvalidApprover(address)\":[{\"details\":\"Indicates a failure with the `approver` of a token to be approved. Used in approvals.\",\"params\":{\"approver\":\"Address initiating an approval operation.\"}}],\"ERC1155InvalidArrayLength(uint256,uint256)\":[{\"details\":\"Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation. Used in batch transfers.\",\"params\":{\"idsLength\":\"Length of the array of token identifiers\",\"valuesLength\":\"Length of the array of token amounts\"}}],\"ERC1155InvalidOperator(address)\":[{\"details\":\"Indicates a failure with the `operator` to be approved. Used in approvals.\",\"params\":{\"operator\":\"Address that may be allowed to operate on tokens without being their owner.\"}}],\"ERC1155InvalidReceiver(address)\":[{\"details\":\"Indicates a failure with the token `receiver`. Used in transfers.\",\"params\":{\"receiver\":\"Address to which tokens are being transferred.\"}}],\"ERC1155InvalidSender(address)\":[{\"details\":\"Indicates a failure with the token `sender`. Used in transfers.\",\"params\":{\"sender\":\"Address whose tokens are being transferred.\"}}],\"ERC1155MissingApprovalForAll(address,address)\":[{\"details\":\"Indicates a failure with the `operator`\\u2019s approval. Used in transfers.\",\"params\":{\"operator\":\"Address that may be allowed to operate on tokens without being their owner.\",\"owner\":\"Address of the current owner of a token.\"}}]},\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/MockERC20.sol\":\"IERC1155Errors\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/MockERC20.sol\":{\"keccak256\":\"0xf65c9d7a8c41c471bcbffaf66e7b9353696ec5f2946643acc4f44e0fea54071a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://4a127daf5ac1aec89a139d3e60e127b1bf2347057f27379b9cbea0a1709e9bd0\",\"dweb:/ipfs/QmNQ9B9Fo3Z95JCHRhPX4UdVdpHwgtX8sWcaq1UQzCmxBc\"]}},\"version\":1}"},"hashes":{}},"solidity/MockERC20.sol:IERC20":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17 ^0.8.20;\n\n// lib/openzeppelin-contracts/contracts/interfaces/draft-IERC6093.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol)\n\n/**\n * @dev Standard ERC-20 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-20 tokens.\n */\ninterface IERC20Errors {\n /**\n * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n * @param balance Current balance for the interacting account.\n * @param needed Minimum amount required to perform a transfer.\n */\n error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);\n\n /**\n * @dev Indicates a failure with the token `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n */\n error ERC20InvalidSender(address sender);\n\n /**\n * @dev Indicates a failure with the token `receiver`. Used in transfers.\n * @param receiver Address to which tokens are being transferred.\n */\n error ERC20InvalidReceiver(address receiver);\n\n /**\n * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.\n * @param spender Address that may be allowed to operate on tokens without being their owner.\n * @param allowance Amount of tokens a `spender` is allowed to operate with.\n * @param needed Minimum amount required to perform a transfer.\n */\n error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);\n\n /**\n * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n * @param approver Address initiating an approval operation.\n */\n error ERC20InvalidApprover(address approver);\n\n /**\n * @dev Indicates a failure with the `spender` to be approved. Used in approvals.\n * @param spender Address that may be allowed to operate on tokens without being their owner.\n */\n error ERC20InvalidSpender(address spender);\n}\n\n/**\n * @dev Standard ERC-721 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-721 tokens.\n */\ninterface IERC721Errors {\n /**\n * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in ERC-20.\n * Used in balance queries.\n * @param owner Address of the current owner of a token.\n */\n error ERC721InvalidOwner(address owner);\n\n /**\n * @dev Indicates a `tokenId` whose `owner` is the zero address.\n * @param tokenId Identifier number of a token.\n */\n error ERC721NonexistentToken(uint256 tokenId);\n\n /**\n * @dev Indicates an error related to the ownership over a particular token. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n * @param tokenId Identifier number of a token.\n * @param owner Address of the current owner of a token.\n */\n error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);\n\n /**\n * @dev Indicates a failure with the token `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n */\n error ERC721InvalidSender(address sender);\n\n /**\n * @dev Indicates a failure with the token `receiver`. Used in transfers.\n * @param receiver Address to which tokens are being transferred.\n */\n error ERC721InvalidReceiver(address receiver);\n\n /**\n * @dev Indicates a failure with the `operator`’s approval. Used in transfers.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n * @param tokenId Identifier number of a token.\n */\n error ERC721InsufficientApproval(address operator, uint256 tokenId);\n\n /**\n * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n * @param approver Address initiating an approval operation.\n */\n error ERC721InvalidApprover(address approver);\n\n /**\n * @dev Indicates a failure with the `operator` to be approved. Used in approvals.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n */\n error ERC721InvalidOperator(address operator);\n}\n\n/**\n * @dev Standard ERC-1155 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-1155 tokens.\n */\ninterface IERC1155Errors {\n /**\n * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n * @param balance Current balance for the interacting account.\n * @param needed Minimum amount required to perform a transfer.\n * @param tokenId Identifier number of a token.\n */\n error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);\n\n /**\n * @dev Indicates a failure with the token `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n */\n error ERC1155InvalidSender(address sender);\n\n /**\n * @dev Indicates a failure with the token `receiver`. Used in transfers.\n * @param receiver Address to which tokens are being transferred.\n */\n error ERC1155InvalidReceiver(address receiver);\n\n /**\n * @dev Indicates a failure with the `operator`’s approval. Used in transfers.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n * @param owner Address of the current owner of a token.\n */\n error ERC1155MissingApprovalForAll(address operator, address owner);\n\n /**\n * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n * @param approver Address initiating an approval operation.\n */\n error ERC1155InvalidApprover(address approver);\n\n /**\n * @dev Indicates a failure with the `operator` to be approved. Used in approvals.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n */\n error ERC1155InvalidOperator(address operator);\n\n /**\n * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.\n * Used in batch transfers.\n * @param idsLength Length of the array of token identifiers\n * @param valuesLength Length of the array of token amounts\n */\n error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);\n}\n\n// lib/openzeppelin-contracts/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 ERC-20 standard as defined in the ERC.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the value of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the value of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 value) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n * caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 value) external returns (bool);\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\n * allowance mechanism. `value` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n\n// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol)\n\n/**\n * @dev Interface for the optional metadata functions from the ERC-20 standard.\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n\n// lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/ERC20.sol)\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * The default value of {decimals} is 18. To change this, you should override\n * this function so it returns a different value.\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC-20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the ERC may not emit\n * these events, as it isn't required by the specification.\n */\nabstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors {\n mapping(address account =\u003e uint256) private _balances;\n\n mapping(address account =\u003e mapping(address spender =\u003e uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the default value returned by this function, unless\n * it's overridden.\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `value`.\n */\n function transfer(address to, uint256 value) public virtual returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, value);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 value) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, value);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the ERC. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `value`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `value`.\n */\n function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, value);\n _transfer(from, to, value);\n return true;\n }\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * NOTE: This function is not virtual, {_update} should be overridden instead.\n */\n function _transfer(address from, address to, uint256 value) internal {\n if (from == address(0)) {\n revert ERC20InvalidSender(address(0));\n }\n if (to == address(0)) {\n revert ERC20InvalidReceiver(address(0));\n }\n _update(from, to, value);\n }\n\n /**\n * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from`\n * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding\n * this function.\n *\n * Emits a {Transfer} event.\n */\n function _update(address from, address to, uint256 value) internal virtual {\n if (from == address(0)) {\n // Overflow check required: The rest of the code assumes that totalSupply never overflows\n _totalSupply += value;\n } else {\n uint256 fromBalance = _balances[from];\n if (fromBalance \u003c value) {\n revert ERC20InsufficientBalance(from, fromBalance, value);\n }\n unchecked {\n // Overflow not possible: value \u003c= fromBalance \u003c= totalSupply.\n _balances[from] = fromBalance - value;\n }\n }\n\n if (to == address(0)) {\n unchecked {\n // Overflow not possible: value \u003c= totalSupply or value \u003c= fromBalance \u003c= totalSupply.\n _totalSupply -= value;\n }\n } else {\n unchecked {\n // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.\n _balances[to] += value;\n }\n }\n\n emit Transfer(from, to, value);\n }\n\n /**\n * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).\n * Relies on the `_update` mechanism\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * NOTE: This function is not virtual, {_update} should be overridden instead.\n */\n function _mint(address account, uint256 value) internal {\n if (account == address(0)) {\n revert ERC20InvalidReceiver(address(0));\n }\n _update(address(0), account, value);\n }\n\n /**\n * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply.\n * Relies on the `_update` mechanism.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * NOTE: This function is not virtual, {_update} should be overridden instead\n */\n function _burn(address account, uint256 value) internal {\n if (account == address(0)) {\n revert ERC20InvalidSender(address(0));\n }\n _update(account, address(0), value);\n }\n\n /**\n * @dev Sets `value` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n *\n * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.\n */\n function _approve(address owner, address spender, uint256 value) internal {\n _approve(owner, spender, value, true);\n }\n\n /**\n * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event.\n *\n * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by\n * `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any\n * `Approval` event during `transferFrom` operations.\n *\n * Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to\n * true using the following override:\n * ```\n * function _approve(address owner, address spender, uint256 value, bool) internal virtual override {\n * super._approve(owner, spender, value, true);\n * }\n * ```\n *\n * Requirements are the same as {_approve}.\n */\n function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {\n if (owner == address(0)) {\n revert ERC20InvalidApprover(address(0));\n }\n if (spender == address(0)) {\n revert ERC20InvalidSpender(address(0));\n }\n _allowances[owner][spender] = value;\n if (emitEvent) {\n emit Approval(owner, spender, value);\n }\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `value`.\n *\n * Does not update the allowance value in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Does not emit an {Approval} event.\n */\n function _spendAllowance(address owner, address spender, uint256 value) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n if (currentAllowance \u003c value) {\n revert ERC20InsufficientAllowance(spender, currentAllowance, value);\n }\n unchecked {\n _approve(owner, spender, currentAllowance - value, false);\n }\n }\n }\n}\n\n// test/MockERC20.sol\n\ncontract MockERC20 is ERC20 {\n uint8 private _decimals;\n\n constructor(string memory name_, uint8 decimals_) ERC20(name_, name_) {\n _decimals = decimals_;\n }\n\n function decimals() public view override returns (uint8) {\n return _decimals;\n }\n\n function burn(address account, uint256 amount) external {\n _burn(account, amount);\n }\n\n function mint(address account, uint256 amount) external {\n _mint(account, amount);\n }\n}\n","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","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 ERC-20 standard as defined in the ERC.","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.20+commit.a1b79de6\"},\"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 ERC-20 standard as defined in the ERC.\",\"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/MockERC20.sol\":\"IERC20\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/MockERC20.sol\":{\"keccak256\":\"0xf65c9d7a8c41c471bcbffaf66e7b9353696ec5f2946643acc4f44e0fea54071a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://4a127daf5ac1aec89a139d3e60e127b1bf2347057f27379b9cbea0a1709e9bd0\",\"dweb:/ipfs/QmNQ9B9Fo3Z95JCHRhPX4UdVdpHwgtX8sWcaq1UQzCmxBc\"]}},\"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/MockERC20.sol:IERC20Errors":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17 ^0.8.20;\n\n// lib/openzeppelin-contracts/contracts/interfaces/draft-IERC6093.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol)\n\n/**\n * @dev Standard ERC-20 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-20 tokens.\n */\ninterface IERC20Errors {\n /**\n * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n * @param balance Current balance for the interacting account.\n * @param needed Minimum amount required to perform a transfer.\n */\n error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);\n\n /**\n * @dev Indicates a failure with the token `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n */\n error ERC20InvalidSender(address sender);\n\n /**\n * @dev Indicates a failure with the token `receiver`. Used in transfers.\n * @param receiver Address to which tokens are being transferred.\n */\n error ERC20InvalidReceiver(address receiver);\n\n /**\n * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.\n * @param spender Address that may be allowed to operate on tokens without being their owner.\n * @param allowance Amount of tokens a `spender` is allowed to operate with.\n * @param needed Minimum amount required to perform a transfer.\n */\n error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);\n\n /**\n * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n * @param approver Address initiating an approval operation.\n */\n error ERC20InvalidApprover(address approver);\n\n /**\n * @dev Indicates a failure with the `spender` to be approved. Used in approvals.\n * @param spender Address that may be allowed to operate on tokens without being their owner.\n */\n error ERC20InvalidSpender(address spender);\n}\n\n/**\n * @dev Standard ERC-721 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-721 tokens.\n */\ninterface IERC721Errors {\n /**\n * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in ERC-20.\n * Used in balance queries.\n * @param owner Address of the current owner of a token.\n */\n error ERC721InvalidOwner(address owner);\n\n /**\n * @dev Indicates a `tokenId` whose `owner` is the zero address.\n * @param tokenId Identifier number of a token.\n */\n error ERC721NonexistentToken(uint256 tokenId);\n\n /**\n * @dev Indicates an error related to the ownership over a particular token. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n * @param tokenId Identifier number of a token.\n * @param owner Address of the current owner of a token.\n */\n error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);\n\n /**\n * @dev Indicates a failure with the token `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n */\n error ERC721InvalidSender(address sender);\n\n /**\n * @dev Indicates a failure with the token `receiver`. Used in transfers.\n * @param receiver Address to which tokens are being transferred.\n */\n error ERC721InvalidReceiver(address receiver);\n\n /**\n * @dev Indicates a failure with the `operator`’s approval. Used in transfers.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n * @param tokenId Identifier number of a token.\n */\n error ERC721InsufficientApproval(address operator, uint256 tokenId);\n\n /**\n * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n * @param approver Address initiating an approval operation.\n */\n error ERC721InvalidApprover(address approver);\n\n /**\n * @dev Indicates a failure with the `operator` to be approved. Used in approvals.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n */\n error ERC721InvalidOperator(address operator);\n}\n\n/**\n * @dev Standard ERC-1155 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-1155 tokens.\n */\ninterface IERC1155Errors {\n /**\n * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n * @param balance Current balance for the interacting account.\n * @param needed Minimum amount required to perform a transfer.\n * @param tokenId Identifier number of a token.\n */\n error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);\n\n /**\n * @dev Indicates a failure with the token `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n */\n error ERC1155InvalidSender(address sender);\n\n /**\n * @dev Indicates a failure with the token `receiver`. Used in transfers.\n * @param receiver Address to which tokens are being transferred.\n */\n error ERC1155InvalidReceiver(address receiver);\n\n /**\n * @dev Indicates a failure with the `operator`’s approval. Used in transfers.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n * @param owner Address of the current owner of a token.\n */\n error ERC1155MissingApprovalForAll(address operator, address owner);\n\n /**\n * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n * @param approver Address initiating an approval operation.\n */\n error ERC1155InvalidApprover(address approver);\n\n /**\n * @dev Indicates a failure with the `operator` to be approved. Used in approvals.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n */\n error ERC1155InvalidOperator(address operator);\n\n /**\n * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.\n * Used in batch transfers.\n * @param idsLength Length of the array of token identifiers\n * @param valuesLength Length of the array of token amounts\n */\n error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);\n}\n\n// lib/openzeppelin-contracts/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 ERC-20 standard as defined in the ERC.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the value of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the value of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 value) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n * caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 value) external returns (bool);\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\n * allowance mechanism. `value` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n\n// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol)\n\n/**\n * @dev Interface for the optional metadata functions from the ERC-20 standard.\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n\n// lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/ERC20.sol)\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * The default value of {decimals} is 18. To change this, you should override\n * this function so it returns a different value.\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC-20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the ERC may not emit\n * these events, as it isn't required by the specification.\n */\nabstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors {\n mapping(address account =\u003e uint256) private _balances;\n\n mapping(address account =\u003e mapping(address spender =\u003e uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the default value returned by this function, unless\n * it's overridden.\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `value`.\n */\n function transfer(address to, uint256 value) public virtual returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, value);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 value) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, value);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the ERC. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `value`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `value`.\n */\n function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, value);\n _transfer(from, to, value);\n return true;\n }\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * NOTE: This function is not virtual, {_update} should be overridden instead.\n */\n function _transfer(address from, address to, uint256 value) internal {\n if (from == address(0)) {\n revert ERC20InvalidSender(address(0));\n }\n if (to == address(0)) {\n revert ERC20InvalidReceiver(address(0));\n }\n _update(from, to, value);\n }\n\n /**\n * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from`\n * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding\n * this function.\n *\n * Emits a {Transfer} event.\n */\n function _update(address from, address to, uint256 value) internal virtual {\n if (from == address(0)) {\n // Overflow check required: The rest of the code assumes that totalSupply never overflows\n _totalSupply += value;\n } else {\n uint256 fromBalance = _balances[from];\n if (fromBalance \u003c value) {\n revert ERC20InsufficientBalance(from, fromBalance, value);\n }\n unchecked {\n // Overflow not possible: value \u003c= fromBalance \u003c= totalSupply.\n _balances[from] = fromBalance - value;\n }\n }\n\n if (to == address(0)) {\n unchecked {\n // Overflow not possible: value \u003c= totalSupply or value \u003c= fromBalance \u003c= totalSupply.\n _totalSupply -= value;\n }\n } else {\n unchecked {\n // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.\n _balances[to] += value;\n }\n }\n\n emit Transfer(from, to, value);\n }\n\n /**\n * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).\n * Relies on the `_update` mechanism\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * NOTE: This function is not virtual, {_update} should be overridden instead.\n */\n function _mint(address account, uint256 value) internal {\n if (account == address(0)) {\n revert ERC20InvalidReceiver(address(0));\n }\n _update(address(0), account, value);\n }\n\n /**\n * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply.\n * Relies on the `_update` mechanism.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * NOTE: This function is not virtual, {_update} should be overridden instead\n */\n function _burn(address account, uint256 value) internal {\n if (account == address(0)) {\n revert ERC20InvalidSender(address(0));\n }\n _update(account, address(0), value);\n }\n\n /**\n * @dev Sets `value` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n *\n * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.\n */\n function _approve(address owner, address spender, uint256 value) internal {\n _approve(owner, spender, value, true);\n }\n\n /**\n * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event.\n *\n * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by\n * `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any\n * `Approval` event during `transferFrom` operations.\n *\n * Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to\n * true using the following override:\n * ```\n * function _approve(address owner, address spender, uint256 value, bool) internal virtual override {\n * super._approve(owner, spender, value, true);\n * }\n * ```\n *\n * Requirements are the same as {_approve}.\n */\n function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {\n if (owner == address(0)) {\n revert ERC20InvalidApprover(address(0));\n }\n if (spender == address(0)) {\n revert ERC20InvalidSpender(address(0));\n }\n _allowances[owner][spender] = value;\n if (emitEvent) {\n emit Approval(owner, spender, value);\n }\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `value`.\n *\n * Does not update the allowance value in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Does not emit an {Approval} event.\n */\n function _spendAllowance(address owner, address spender, uint256 value) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n if (currentAllowance \u003c value) {\n revert ERC20InsufficientAllowance(spender, currentAllowance, value);\n }\n unchecked {\n _approve(owner, spender, currentAllowance - value, false);\n }\n }\n }\n}\n\n// test/MockERC20.sol\n\ncontract MockERC20 is ERC20 {\n uint8 private _decimals;\n\n constructor(string memory name_, uint8 decimals_) ERC20(name_, name_) {\n _decimals = decimals_;\n }\n\n function decimals() public view override returns (uint8) {\n return _decimals;\n }\n\n function burn(address account, uint256 amount) external {\n _burn(account, amount);\n }\n\n function mint(address account, uint256 amount) external {\n _mint(account, amount);\n }\n}\n","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","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":"spender","type":"address"},{"internalType":"uint256","name":"allowance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"ERC20InsufficientAllowance","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"ERC20InsufficientBalance","type":"error"},{"inputs":[{"internalType":"address","name":"approver","type":"address"}],"name":"ERC20InvalidApprover","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC20InvalidReceiver","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"ERC20InvalidSender","type":"error"},{"inputs":[{"internalType":"address","name":"spender","type":"address"}],"name":"ERC20InvalidSpender","type":"error"}],"userDoc":{"kind":"user","methods":{},"version":1},"developerDoc":{"details":"Standard ERC-20 Errors Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-20 tokens.","errors":{"ERC20InsufficientAllowance(address,uint256,uint256)":[{"details":"Indicates a failure with the `spender`’s `allowance`. Used in transfers.","params":{"allowance":"Amount of tokens a `spender` is allowed to operate with.","needed":"Minimum amount required to perform a transfer.","spender":"Address that may be allowed to operate on tokens without being their owner."}}],"ERC20InsufficientBalance(address,uint256,uint256)":[{"details":"Indicates an error related to the current `balance` of a `sender`. Used in transfers.","params":{"balance":"Current balance for the interacting account.","needed":"Minimum amount required to perform a transfer.","sender":"Address whose tokens are being transferred."}}],"ERC20InvalidApprover(address)":[{"details":"Indicates a failure with the `approver` of a token to be approved. Used in approvals.","params":{"approver":"Address initiating an approval operation."}}],"ERC20InvalidReceiver(address)":[{"details":"Indicates a failure with the token `receiver`. Used in transfers.","params":{"receiver":"Address to which tokens are being transferred."}}],"ERC20InvalidSender(address)":[{"details":"Indicates a failure with the token `sender`. Used in transfers.","params":{"sender":"Address whose tokens are being transferred."}}],"ERC20InvalidSpender(address)":[{"details":"Indicates a failure with the `spender` to be approved. Used in approvals.","params":{"spender":"Address that may be allowed to operate on tokens without being their owner."}}]},"kind":"dev","methods":{},"version":1},"metadata":"{\"compiler\":{\"version\":\"0.8.20+commit.a1b79de6\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"allowance\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"needed\",\"type\":\"uint256\"}],\"name\":\"ERC20InsufficientAllowance\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"balance\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"needed\",\"type\":\"uint256\"}],\"name\":\"ERC20InsufficientBalance\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"approver\",\"type\":\"address\"}],\"name\":\"ERC20InvalidApprover\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"}],\"name\":\"ERC20InvalidReceiver\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"ERC20InvalidSender\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"}],\"name\":\"ERC20InvalidSpender\",\"type\":\"error\"}],\"devdoc\":{\"details\":\"Standard ERC-20 Errors Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-20 tokens.\",\"errors\":{\"ERC20InsufficientAllowance(address,uint256,uint256)\":[{\"details\":\"Indicates a failure with the `spender`\\u2019s `allowance`. Used in transfers.\",\"params\":{\"allowance\":\"Amount of tokens a `spender` is allowed to operate with.\",\"needed\":\"Minimum amount required to perform a transfer.\",\"spender\":\"Address that may be allowed to operate on tokens without being their owner.\"}}],\"ERC20InsufficientBalance(address,uint256,uint256)\":[{\"details\":\"Indicates an error related to the current `balance` of a `sender`. Used in transfers.\",\"params\":{\"balance\":\"Current balance for the interacting account.\",\"needed\":\"Minimum amount required to perform a transfer.\",\"sender\":\"Address whose tokens are being transferred.\"}}],\"ERC20InvalidApprover(address)\":[{\"details\":\"Indicates a failure with the `approver` of a token to be approved. Used in approvals.\",\"params\":{\"approver\":\"Address initiating an approval operation.\"}}],\"ERC20InvalidReceiver(address)\":[{\"details\":\"Indicates a failure with the token `receiver`. Used in transfers.\",\"params\":{\"receiver\":\"Address to which tokens are being transferred.\"}}],\"ERC20InvalidSender(address)\":[{\"details\":\"Indicates a failure with the token `sender`. Used in transfers.\",\"params\":{\"sender\":\"Address whose tokens are being transferred.\"}}],\"ERC20InvalidSpender(address)\":[{\"details\":\"Indicates a failure with the `spender` to be approved. Used in approvals.\",\"params\":{\"spender\":\"Address that may be allowed to operate on tokens without being their owner.\"}}]},\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/MockERC20.sol\":\"IERC20Errors\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/MockERC20.sol\":{\"keccak256\":\"0xf65c9d7a8c41c471bcbffaf66e7b9353696ec5f2946643acc4f44e0fea54071a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://4a127daf5ac1aec89a139d3e60e127b1bf2347057f27379b9cbea0a1709e9bd0\",\"dweb:/ipfs/QmNQ9B9Fo3Z95JCHRhPX4UdVdpHwgtX8sWcaq1UQzCmxBc\"]}},\"version\":1}"},"hashes":{}},"solidity/MockERC20.sol:IERC20Metadata":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17 ^0.8.20;\n\n// lib/openzeppelin-contracts/contracts/interfaces/draft-IERC6093.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol)\n\n/**\n * @dev Standard ERC-20 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-20 tokens.\n */\ninterface IERC20Errors {\n /**\n * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n * @param balance Current balance for the interacting account.\n * @param needed Minimum amount required to perform a transfer.\n */\n error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);\n\n /**\n * @dev Indicates a failure with the token `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n */\n error ERC20InvalidSender(address sender);\n\n /**\n * @dev Indicates a failure with the token `receiver`. Used in transfers.\n * @param receiver Address to which tokens are being transferred.\n */\n error ERC20InvalidReceiver(address receiver);\n\n /**\n * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.\n * @param spender Address that may be allowed to operate on tokens without being their owner.\n * @param allowance Amount of tokens a `spender` is allowed to operate with.\n * @param needed Minimum amount required to perform a transfer.\n */\n error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);\n\n /**\n * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n * @param approver Address initiating an approval operation.\n */\n error ERC20InvalidApprover(address approver);\n\n /**\n * @dev Indicates a failure with the `spender` to be approved. Used in approvals.\n * @param spender Address that may be allowed to operate on tokens without being their owner.\n */\n error ERC20InvalidSpender(address spender);\n}\n\n/**\n * @dev Standard ERC-721 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-721 tokens.\n */\ninterface IERC721Errors {\n /**\n * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in ERC-20.\n * Used in balance queries.\n * @param owner Address of the current owner of a token.\n */\n error ERC721InvalidOwner(address owner);\n\n /**\n * @dev Indicates a `tokenId` whose `owner` is the zero address.\n * @param tokenId Identifier number of a token.\n */\n error ERC721NonexistentToken(uint256 tokenId);\n\n /**\n * @dev Indicates an error related to the ownership over a particular token. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n * @param tokenId Identifier number of a token.\n * @param owner Address of the current owner of a token.\n */\n error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);\n\n /**\n * @dev Indicates a failure with the token `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n */\n error ERC721InvalidSender(address sender);\n\n /**\n * @dev Indicates a failure with the token `receiver`. Used in transfers.\n * @param receiver Address to which tokens are being transferred.\n */\n error ERC721InvalidReceiver(address receiver);\n\n /**\n * @dev Indicates a failure with the `operator`’s approval. Used in transfers.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n * @param tokenId Identifier number of a token.\n */\n error ERC721InsufficientApproval(address operator, uint256 tokenId);\n\n /**\n * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n * @param approver Address initiating an approval operation.\n */\n error ERC721InvalidApprover(address approver);\n\n /**\n * @dev Indicates a failure with the `operator` to be approved. Used in approvals.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n */\n error ERC721InvalidOperator(address operator);\n}\n\n/**\n * @dev Standard ERC-1155 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-1155 tokens.\n */\ninterface IERC1155Errors {\n /**\n * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n * @param balance Current balance for the interacting account.\n * @param needed Minimum amount required to perform a transfer.\n * @param tokenId Identifier number of a token.\n */\n error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);\n\n /**\n * @dev Indicates a failure with the token `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n */\n error ERC1155InvalidSender(address sender);\n\n /**\n * @dev Indicates a failure with the token `receiver`. Used in transfers.\n * @param receiver Address to which tokens are being transferred.\n */\n error ERC1155InvalidReceiver(address receiver);\n\n /**\n * @dev Indicates a failure with the `operator`’s approval. Used in transfers.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n * @param owner Address of the current owner of a token.\n */\n error ERC1155MissingApprovalForAll(address operator, address owner);\n\n /**\n * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n * @param approver Address initiating an approval operation.\n */\n error ERC1155InvalidApprover(address approver);\n\n /**\n * @dev Indicates a failure with the `operator` to be approved. Used in approvals.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n */\n error ERC1155InvalidOperator(address operator);\n\n /**\n * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.\n * Used in batch transfers.\n * @param idsLength Length of the array of token identifiers\n * @param valuesLength Length of the array of token amounts\n */\n error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);\n}\n\n// lib/openzeppelin-contracts/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 ERC-20 standard as defined in the ERC.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the value of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the value of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 value) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n * caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 value) external returns (bool);\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\n * allowance mechanism. `value` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n\n// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol)\n\n/**\n * @dev Interface for the optional metadata functions from the ERC-20 standard.\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n\n// lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/ERC20.sol)\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * The default value of {decimals} is 18. To change this, you should override\n * this function so it returns a different value.\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC-20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the ERC may not emit\n * these events, as it isn't required by the specification.\n */\nabstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors {\n mapping(address account =\u003e uint256) private _balances;\n\n mapping(address account =\u003e mapping(address spender =\u003e uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the default value returned by this function, unless\n * it's overridden.\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `value`.\n */\n function transfer(address to, uint256 value) public virtual returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, value);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 value) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, value);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the ERC. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `value`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `value`.\n */\n function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, value);\n _transfer(from, to, value);\n return true;\n }\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * NOTE: This function is not virtual, {_update} should be overridden instead.\n */\n function _transfer(address from, address to, uint256 value) internal {\n if (from == address(0)) {\n revert ERC20InvalidSender(address(0));\n }\n if (to == address(0)) {\n revert ERC20InvalidReceiver(address(0));\n }\n _update(from, to, value);\n }\n\n /**\n * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from`\n * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding\n * this function.\n *\n * Emits a {Transfer} event.\n */\n function _update(address from, address to, uint256 value) internal virtual {\n if (from == address(0)) {\n // Overflow check required: The rest of the code assumes that totalSupply never overflows\n _totalSupply += value;\n } else {\n uint256 fromBalance = _balances[from];\n if (fromBalance \u003c value) {\n revert ERC20InsufficientBalance(from, fromBalance, value);\n }\n unchecked {\n // Overflow not possible: value \u003c= fromBalance \u003c= totalSupply.\n _balances[from] = fromBalance - value;\n }\n }\n\n if (to == address(0)) {\n unchecked {\n // Overflow not possible: value \u003c= totalSupply or value \u003c= fromBalance \u003c= totalSupply.\n _totalSupply -= value;\n }\n } else {\n unchecked {\n // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.\n _balances[to] += value;\n }\n }\n\n emit Transfer(from, to, value);\n }\n\n /**\n * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).\n * Relies on the `_update` mechanism\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * NOTE: This function is not virtual, {_update} should be overridden instead.\n */\n function _mint(address account, uint256 value) internal {\n if (account == address(0)) {\n revert ERC20InvalidReceiver(address(0));\n }\n _update(address(0), account, value);\n }\n\n /**\n * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply.\n * Relies on the `_update` mechanism.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * NOTE: This function is not virtual, {_update} should be overridden instead\n */\n function _burn(address account, uint256 value) internal {\n if (account == address(0)) {\n revert ERC20InvalidSender(address(0));\n }\n _update(account, address(0), value);\n }\n\n /**\n * @dev Sets `value` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n *\n * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.\n */\n function _approve(address owner, address spender, uint256 value) internal {\n _approve(owner, spender, value, true);\n }\n\n /**\n * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event.\n *\n * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by\n * `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any\n * `Approval` event during `transferFrom` operations.\n *\n * Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to\n * true using the following override:\n * ```\n * function _approve(address owner, address spender, uint256 value, bool) internal virtual override {\n * super._approve(owner, spender, value, true);\n * }\n * ```\n *\n * Requirements are the same as {_approve}.\n */\n function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {\n if (owner == address(0)) {\n revert ERC20InvalidApprover(address(0));\n }\n if (spender == address(0)) {\n revert ERC20InvalidSpender(address(0));\n }\n _allowances[owner][spender] = value;\n if (emitEvent) {\n emit Approval(owner, spender, value);\n }\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `value`.\n *\n * Does not update the allowance value in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Does not emit an {Approval} event.\n */\n function _spendAllowance(address owner, address spender, uint256 value) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n if (currentAllowance \u003c value) {\n revert ERC20InsufficientAllowance(spender, currentAllowance, value);\n }\n unchecked {\n _approve(owner, spender, currentAllowance - value, false);\n }\n }\n }\n}\n\n// test/MockERC20.sol\n\ncontract MockERC20 is ERC20 {\n uint8 private _decimals;\n\n constructor(string memory name_, uint8 decimals_) ERC20(name_, name_) {\n _decimals = decimals_;\n }\n\n function decimals() public view override returns (uint8) {\n return _decimals;\n }\n\n function burn(address account, uint256 amount) external {\n _burn(account, amount);\n }\n\n function mint(address account, uint256 amount) external {\n _mint(account, amount);\n }\n}\n","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","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":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"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 for the optional metadata functions from the ERC-20 standard.","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`."},"decimals()":{"details":"Returns the decimals places of the token."},"name()":{"details":"Returns the name of the token."},"symbol()":{"details":"Returns the symbol of the token."},"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.20+commit.a1b79de6\"},\"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\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"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 for the optional metadata functions from the ERC-20 standard.\",\"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`.\"},\"decimals()\":{\"details\":\"Returns the decimals places of the token.\"},\"name()\":{\"details\":\"Returns the name of the token.\"},\"symbol()\":{\"details\":\"Returns the symbol of the token.\"},\"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/MockERC20.sol\":\"IERC20Metadata\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/MockERC20.sol\":{\"keccak256\":\"0xf65c9d7a8c41c471bcbffaf66e7b9353696ec5f2946643acc4f44e0fea54071a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://4a127daf5ac1aec89a139d3e60e127b1bf2347057f27379b9cbea0a1709e9bd0\",\"dweb:/ipfs/QmNQ9B9Fo3Z95JCHRhPX4UdVdpHwgtX8sWcaq1UQzCmxBc\"]}},\"version\":1}"},"hashes":{"allowance(address,address)":"dd62ed3e","approve(address,uint256)":"095ea7b3","balanceOf(address)":"70a08231","decimals()":"313ce567","name()":"06fdde03","symbol()":"95d89b41","totalSupply()":"18160ddd","transfer(address,uint256)":"a9059cbb","transferFrom(address,address,uint256)":"23b872dd"}},"solidity/MockERC20.sol:IERC721Errors":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17 ^0.8.20;\n\n// lib/openzeppelin-contracts/contracts/interfaces/draft-IERC6093.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol)\n\n/**\n * @dev Standard ERC-20 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-20 tokens.\n */\ninterface IERC20Errors {\n /**\n * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n * @param balance Current balance for the interacting account.\n * @param needed Minimum amount required to perform a transfer.\n */\n error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);\n\n /**\n * @dev Indicates a failure with the token `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n */\n error ERC20InvalidSender(address sender);\n\n /**\n * @dev Indicates a failure with the token `receiver`. Used in transfers.\n * @param receiver Address to which tokens are being transferred.\n */\n error ERC20InvalidReceiver(address receiver);\n\n /**\n * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.\n * @param spender Address that may be allowed to operate on tokens without being their owner.\n * @param allowance Amount of tokens a `spender` is allowed to operate with.\n * @param needed Minimum amount required to perform a transfer.\n */\n error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);\n\n /**\n * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n * @param approver Address initiating an approval operation.\n */\n error ERC20InvalidApprover(address approver);\n\n /**\n * @dev Indicates a failure with the `spender` to be approved. Used in approvals.\n * @param spender Address that may be allowed to operate on tokens without being their owner.\n */\n error ERC20InvalidSpender(address spender);\n}\n\n/**\n * @dev Standard ERC-721 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-721 tokens.\n */\ninterface IERC721Errors {\n /**\n * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in ERC-20.\n * Used in balance queries.\n * @param owner Address of the current owner of a token.\n */\n error ERC721InvalidOwner(address owner);\n\n /**\n * @dev Indicates a `tokenId` whose `owner` is the zero address.\n * @param tokenId Identifier number of a token.\n */\n error ERC721NonexistentToken(uint256 tokenId);\n\n /**\n * @dev Indicates an error related to the ownership over a particular token. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n * @param tokenId Identifier number of a token.\n * @param owner Address of the current owner of a token.\n */\n error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);\n\n /**\n * @dev Indicates a failure with the token `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n */\n error ERC721InvalidSender(address sender);\n\n /**\n * @dev Indicates a failure with the token `receiver`. Used in transfers.\n * @param receiver Address to which tokens are being transferred.\n */\n error ERC721InvalidReceiver(address receiver);\n\n /**\n * @dev Indicates a failure with the `operator`’s approval. Used in transfers.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n * @param tokenId Identifier number of a token.\n */\n error ERC721InsufficientApproval(address operator, uint256 tokenId);\n\n /**\n * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n * @param approver Address initiating an approval operation.\n */\n error ERC721InvalidApprover(address approver);\n\n /**\n * @dev Indicates a failure with the `operator` to be approved. Used in approvals.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n */\n error ERC721InvalidOperator(address operator);\n}\n\n/**\n * @dev Standard ERC-1155 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-1155 tokens.\n */\ninterface IERC1155Errors {\n /**\n * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n * @param balance Current balance for the interacting account.\n * @param needed Minimum amount required to perform a transfer.\n * @param tokenId Identifier number of a token.\n */\n error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);\n\n /**\n * @dev Indicates a failure with the token `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n */\n error ERC1155InvalidSender(address sender);\n\n /**\n * @dev Indicates a failure with the token `receiver`. Used in transfers.\n * @param receiver Address to which tokens are being transferred.\n */\n error ERC1155InvalidReceiver(address receiver);\n\n /**\n * @dev Indicates a failure with the `operator`’s approval. Used in transfers.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n * @param owner Address of the current owner of a token.\n */\n error ERC1155MissingApprovalForAll(address operator, address owner);\n\n /**\n * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n * @param approver Address initiating an approval operation.\n */\n error ERC1155InvalidApprover(address approver);\n\n /**\n * @dev Indicates a failure with the `operator` to be approved. Used in approvals.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n */\n error ERC1155InvalidOperator(address operator);\n\n /**\n * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.\n * Used in batch transfers.\n * @param idsLength Length of the array of token identifiers\n * @param valuesLength Length of the array of token amounts\n */\n error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);\n}\n\n// lib/openzeppelin-contracts/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 ERC-20 standard as defined in the ERC.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the value of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the value of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 value) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n * caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 value) external returns (bool);\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\n * allowance mechanism. `value` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n\n// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol)\n\n/**\n * @dev Interface for the optional metadata functions from the ERC-20 standard.\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n\n// lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/ERC20.sol)\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * The default value of {decimals} is 18. To change this, you should override\n * this function so it returns a different value.\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC-20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the ERC may not emit\n * these events, as it isn't required by the specification.\n */\nabstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors {\n mapping(address account =\u003e uint256) private _balances;\n\n mapping(address account =\u003e mapping(address spender =\u003e uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the default value returned by this function, unless\n * it's overridden.\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `value`.\n */\n function transfer(address to, uint256 value) public virtual returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, value);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 value) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, value);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the ERC. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `value`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `value`.\n */\n function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, value);\n _transfer(from, to, value);\n return true;\n }\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * NOTE: This function is not virtual, {_update} should be overridden instead.\n */\n function _transfer(address from, address to, uint256 value) internal {\n if (from == address(0)) {\n revert ERC20InvalidSender(address(0));\n }\n if (to == address(0)) {\n revert ERC20InvalidReceiver(address(0));\n }\n _update(from, to, value);\n }\n\n /**\n * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from`\n * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding\n * this function.\n *\n * Emits a {Transfer} event.\n */\n function _update(address from, address to, uint256 value) internal virtual {\n if (from == address(0)) {\n // Overflow check required: The rest of the code assumes that totalSupply never overflows\n _totalSupply += value;\n } else {\n uint256 fromBalance = _balances[from];\n if (fromBalance \u003c value) {\n revert ERC20InsufficientBalance(from, fromBalance, value);\n }\n unchecked {\n // Overflow not possible: value \u003c= fromBalance \u003c= totalSupply.\n _balances[from] = fromBalance - value;\n }\n }\n\n if (to == address(0)) {\n unchecked {\n // Overflow not possible: value \u003c= totalSupply or value \u003c= fromBalance \u003c= totalSupply.\n _totalSupply -= value;\n }\n } else {\n unchecked {\n // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.\n _balances[to] += value;\n }\n }\n\n emit Transfer(from, to, value);\n }\n\n /**\n * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).\n * Relies on the `_update` mechanism\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * NOTE: This function is not virtual, {_update} should be overridden instead.\n */\n function _mint(address account, uint256 value) internal {\n if (account == address(0)) {\n revert ERC20InvalidReceiver(address(0));\n }\n _update(address(0), account, value);\n }\n\n /**\n * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply.\n * Relies on the `_update` mechanism.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * NOTE: This function is not virtual, {_update} should be overridden instead\n */\n function _burn(address account, uint256 value) internal {\n if (account == address(0)) {\n revert ERC20InvalidSender(address(0));\n }\n _update(account, address(0), value);\n }\n\n /**\n * @dev Sets `value` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n *\n * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.\n */\n function _approve(address owner, address spender, uint256 value) internal {\n _approve(owner, spender, value, true);\n }\n\n /**\n * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event.\n *\n * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by\n * `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any\n * `Approval` event during `transferFrom` operations.\n *\n * Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to\n * true using the following override:\n * ```\n * function _approve(address owner, address spender, uint256 value, bool) internal virtual override {\n * super._approve(owner, spender, value, true);\n * }\n * ```\n *\n * Requirements are the same as {_approve}.\n */\n function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {\n if (owner == address(0)) {\n revert ERC20InvalidApprover(address(0));\n }\n if (spender == address(0)) {\n revert ERC20InvalidSpender(address(0));\n }\n _allowances[owner][spender] = value;\n if (emitEvent) {\n emit Approval(owner, spender, value);\n }\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `value`.\n *\n * Does not update the allowance value in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Does not emit an {Approval} event.\n */\n function _spendAllowance(address owner, address spender, uint256 value) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n if (currentAllowance \u003c value) {\n revert ERC20InsufficientAllowance(spender, currentAllowance, value);\n }\n unchecked {\n _approve(owner, spender, currentAllowance - value, false);\n }\n }\n }\n}\n\n// test/MockERC20.sol\n\ncontract MockERC20 is ERC20 {\n uint8 private _decimals;\n\n constructor(string memory name_, uint8 decimals_) ERC20(name_, name_) {\n _decimals = decimals_;\n }\n\n function decimals() public view override returns (uint8) {\n return _decimals;\n }\n\n function burn(address account, uint256 amount) external {\n _burn(account, amount);\n }\n\n function mint(address account, uint256 amount) external {\n _mint(account, amount);\n }\n}\n","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","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":"sender","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"owner","type":"address"}],"name":"ERC721IncorrectOwner","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ERC721InsufficientApproval","type":"error"},{"inputs":[{"internalType":"address","name":"approver","type":"address"}],"name":"ERC721InvalidApprover","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"ERC721InvalidOperator","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"ERC721InvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC721InvalidReceiver","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"ERC721InvalidSender","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ERC721NonexistentToken","type":"error"}],"userDoc":{"kind":"user","methods":{},"version":1},"developerDoc":{"details":"Standard ERC-721 Errors Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-721 tokens.","errors":{"ERC721IncorrectOwner(address,uint256,address)":[{"details":"Indicates an error related to the ownership over a particular token. Used in transfers.","params":{"owner":"Address of the current owner of a token.","sender":"Address whose tokens are being transferred.","tokenId":"Identifier number of a token."}}],"ERC721InsufficientApproval(address,uint256)":[{"details":"Indicates a failure with the `operator`’s approval. Used in transfers.","params":{"operator":"Address that may be allowed to operate on tokens without being their owner.","tokenId":"Identifier number of a token."}}],"ERC721InvalidApprover(address)":[{"details":"Indicates a failure with the `approver` of a token to be approved. Used in approvals.","params":{"approver":"Address initiating an approval operation."}}],"ERC721InvalidOperator(address)":[{"details":"Indicates a failure with the `operator` to be approved. Used in approvals.","params":{"operator":"Address that may be allowed to operate on tokens without being their owner."}}],"ERC721InvalidOwner(address)":[{"details":"Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in ERC-20. Used in balance queries.","params":{"owner":"Address of the current owner of a token."}}],"ERC721InvalidReceiver(address)":[{"details":"Indicates a failure with the token `receiver`. Used in transfers.","params":{"receiver":"Address to which tokens are being transferred."}}],"ERC721InvalidSender(address)":[{"details":"Indicates a failure with the token `sender`. Used in transfers.","params":{"sender":"Address whose tokens are being transferred."}}],"ERC721NonexistentToken(uint256)":[{"details":"Indicates a `tokenId` whose `owner` is the zero address.","params":{"tokenId":"Identifier number of a token."}}]},"kind":"dev","methods":{},"version":1},"metadata":"{\"compiler\":{\"version\":\"0.8.20+commit.a1b79de6\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"ERC721IncorrectOwner\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"ERC721InsufficientApproval\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"approver\",\"type\":\"address\"}],\"name\":\"ERC721InvalidApprover\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"ERC721InvalidOperator\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"ERC721InvalidOwner\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"}],\"name\":\"ERC721InvalidReceiver\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"ERC721InvalidSender\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"ERC721NonexistentToken\",\"type\":\"error\"}],\"devdoc\":{\"details\":\"Standard ERC-721 Errors Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-721 tokens.\",\"errors\":{\"ERC721IncorrectOwner(address,uint256,address)\":[{\"details\":\"Indicates an error related to the ownership over a particular token. Used in transfers.\",\"params\":{\"owner\":\"Address of the current owner of a token.\",\"sender\":\"Address whose tokens are being transferred.\",\"tokenId\":\"Identifier number of a token.\"}}],\"ERC721InsufficientApproval(address,uint256)\":[{\"details\":\"Indicates a failure with the `operator`\\u2019s approval. Used in transfers.\",\"params\":{\"operator\":\"Address that may be allowed to operate on tokens without being their owner.\",\"tokenId\":\"Identifier number of a token.\"}}],\"ERC721InvalidApprover(address)\":[{\"details\":\"Indicates a failure with the `approver` of a token to be approved. Used in approvals.\",\"params\":{\"approver\":\"Address initiating an approval operation.\"}}],\"ERC721InvalidOperator(address)\":[{\"details\":\"Indicates a failure with the `operator` to be approved. Used in approvals.\",\"params\":{\"operator\":\"Address that may be allowed to operate on tokens without being their owner.\"}}],\"ERC721InvalidOwner(address)\":[{\"details\":\"Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in ERC-20. Used in balance queries.\",\"params\":{\"owner\":\"Address of the current owner of a token.\"}}],\"ERC721InvalidReceiver(address)\":[{\"details\":\"Indicates a failure with the token `receiver`. Used in transfers.\",\"params\":{\"receiver\":\"Address to which tokens are being transferred.\"}}],\"ERC721InvalidSender(address)\":[{\"details\":\"Indicates a failure with the token `sender`. Used in transfers.\",\"params\":{\"sender\":\"Address whose tokens are being transferred.\"}}],\"ERC721NonexistentToken(uint256)\":[{\"details\":\"Indicates a `tokenId` whose `owner` is the zero address.\",\"params\":{\"tokenId\":\"Identifier number of a token.\"}}]},\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/MockERC20.sol\":\"IERC721Errors\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/MockERC20.sol\":{\"keccak256\":\"0xf65c9d7a8c41c471bcbffaf66e7b9353696ec5f2946643acc4f44e0fea54071a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://4a127daf5ac1aec89a139d3e60e127b1bf2347057f27379b9cbea0a1709e9bd0\",\"dweb:/ipfs/QmNQ9B9Fo3Z95JCHRhPX4UdVdpHwgtX8sWcaq1UQzCmxBc\"]}},\"version\":1}"},"hashes":{}},"solidity/MockERC20.sol:MockERC20":{"code":"0x60806040523480156200001157600080fd5b5060405162000d4f38038062000d4f8339810160408190526200003491620000a0565b8180600362000044828262000217565b50600462000053828262000217565b50506005805460ff191660ff939093169290921790915550620002e39050565b634e487b7160e01b600052604160045260246000fd5b805160ff811681146200009b57600080fd5b919050565b60008060408385031215620000b457600080fd5b82516001600160401b0380821115620000cc57600080fd5b818501915085601f830112620000e157600080fd5b815181811115620000f657620000f662000073565b604051601f8201601f19908116603f0116810190838211818310171562000121576200012162000073565b816040528281526020935088848487010111156200013e57600080fd5b600091505b8282101562000162578482018401518183018501529083019062000143565b60008484830101528096505050506200017d81860162000089565b925050509250929050565b600181811c908216806200019d57607f821691505b602082108103620001be57634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200021257600081815260208120601f850160051c81016020861015620001ed5750805b601f850160051c820191505b818110156200020e57828155600101620001f9565b5050505b505050565b81516001600160401b0381111562000233576200023362000073565b6200024b8162000244845462000188565b84620001c4565b602080601f8311600181146200028357600084156200026a5750858301515b600019600386901b1c1916600185901b1785556200020e565b600085815260208120601f198616915b82811015620002b45788860151825594840194600190910190840162000293565b5085821015620002d35787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b610a5c80620002f36000396000f3fe608060405234801561001057600080fd5b50600436106100c95760003560e01c806340c10f19116100815780639dc29fac1161005b5780639dc29fac1461019c578063a9059cbb146101af578063dd62ed3e146101c257600080fd5b806340c10f191461014957806370a082311461015e57806395d89b411461019457600080fd5b806318160ddd116100b257806318160ddd1461010f57806323b872dd14610121578063313ce5671461013457600080fd5b806306fdde03146100ce578063095ea7b3146100ec575b600080fd5b6100d6610208565b6040516100e39190610849565b60405180910390f35b6100ff6100fa3660046108de565b61029a565b60405190151581526020016100e3565b6002545b6040519081526020016100e3565b6100ff61012f366004610908565b6102b4565b60055460405160ff90911681526020016100e3565b61015c6101573660046108de565b6102d8565b005b61011361016c366004610944565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090205490565b6100d66102e6565b61015c6101aa3660046108de565b6102f5565b6100ff6101bd3660046108de565b6102ff565b6101136101d0366004610966565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260016020908152604080832093909416825291909152205490565b60606003805461021790610999565b80601f016020809104026020016040519081016040528092919081815260200182805461024390610999565b80156102905780601f1061026557610100808354040283529160200191610290565b820191906000526020600020905b81548152906001019060200180831161027357829003601f168201915b5050505050905090565b6000336102a881858561030d565b60019150505b92915050565b6000336102c285828561031f565b6102cd8585856103f3565b506001949350505050565b6102e2828261049e565b5050565b60606004805461021790610999565b6102e282826104fa565b6000336102a88185856103f3565b61031a8383836001610556565b505050565b73ffffffffffffffffffffffffffffffffffffffff8381166000908152600160209081526040808320938616835292905220547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146103ed57818110156103de576040517ffb8f41b200000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8416600482015260248101829052604481018390526064015b60405180910390fd5b6103ed84848484036000610556565b50505050565b73ffffffffffffffffffffffffffffffffffffffff8316610443576040517f96c6fd1e000000000000000000000000000000000000000000000000000000008152600060048201526024016103d5565b73ffffffffffffffffffffffffffffffffffffffff8216610493576040517fec442f05000000000000000000000000000000000000000000000000000000008152600060048201526024016103d5565b61031a83838361069e565b73ffffffffffffffffffffffffffffffffffffffff82166104ee576040517fec442f05000000000000000000000000000000000000000000000000000000008152600060048201526024016103d5565b6102e26000838361069e565b73ffffffffffffffffffffffffffffffffffffffff821661054a576040517f96c6fd1e000000000000000000000000000000000000000000000000000000008152600060048201526024016103d5565b6102e28260008361069e565b73ffffffffffffffffffffffffffffffffffffffff84166105a6576040517fe602df05000000000000000000000000000000000000000000000000000000008152600060048201526024016103d5565b73ffffffffffffffffffffffffffffffffffffffff83166105f6576040517f94280d62000000000000000000000000000000000000000000000000000000008152600060048201526024016103d5565b73ffffffffffffffffffffffffffffffffffffffff808516600090815260016020908152604080832093871683529290522082905580156103ed578273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258460405161069091815260200190565b60405180910390a350505050565b73ffffffffffffffffffffffffffffffffffffffff83166106d65780600260008282546106cb91906109ec565b909155506107889050565b73ffffffffffffffffffffffffffffffffffffffff83166000908152602081905260409020548181101561075c576040517fe450d38c00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8516600482015260248101829052604481018390526064016103d5565b73ffffffffffffffffffffffffffffffffffffffff841660009081526020819052604090209082900390555b73ffffffffffffffffffffffffffffffffffffffff82166107b1576002805482900390556107dd565b73ffffffffffffffffffffffffffffffffffffffff821660009081526020819052604090208054820190555b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161083c91815260200190565b60405180910390a3505050565b600060208083528351808285015260005b818110156108765785810183015185820160400152820161085a565b5060006040828601015260407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8301168501019250505092915050565b803573ffffffffffffffffffffffffffffffffffffffff811681146108d957600080fd5b919050565b600080604083850312156108f157600080fd5b6108fa836108b5565b946020939093013593505050565b60008060006060848603121561091d57600080fd5b610926846108b5565b9250610934602085016108b5565b9150604084013590509250925092565b60006020828403121561095657600080fd5b61095f826108b5565b9392505050565b6000806040838503121561097957600080fd5b610982836108b5565b9150610990602084016108b5565b90509250929050565b600181811c908216806109ad57607f821691505b6020821081036109e6577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b808201808211156102ae577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fdfea264697066735822122026f64d6f95f0703c9301963e6c1938a90571f9265dae22ab806cad3a0261fad664736f6c63430008140033","runtime-code":"0x608060405234801561001057600080fd5b50600436106100c95760003560e01c806340c10f19116100815780639dc29fac1161005b5780639dc29fac1461019c578063a9059cbb146101af578063dd62ed3e146101c257600080fd5b806340c10f191461014957806370a082311461015e57806395d89b411461019457600080fd5b806318160ddd116100b257806318160ddd1461010f57806323b872dd14610121578063313ce5671461013457600080fd5b806306fdde03146100ce578063095ea7b3146100ec575b600080fd5b6100d6610208565b6040516100e39190610849565b60405180910390f35b6100ff6100fa3660046108de565b61029a565b60405190151581526020016100e3565b6002545b6040519081526020016100e3565b6100ff61012f366004610908565b6102b4565b60055460405160ff90911681526020016100e3565b61015c6101573660046108de565b6102d8565b005b61011361016c366004610944565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090205490565b6100d66102e6565b61015c6101aa3660046108de565b6102f5565b6100ff6101bd3660046108de565b6102ff565b6101136101d0366004610966565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260016020908152604080832093909416825291909152205490565b60606003805461021790610999565b80601f016020809104026020016040519081016040528092919081815260200182805461024390610999565b80156102905780601f1061026557610100808354040283529160200191610290565b820191906000526020600020905b81548152906001019060200180831161027357829003601f168201915b5050505050905090565b6000336102a881858561030d565b60019150505b92915050565b6000336102c285828561031f565b6102cd8585856103f3565b506001949350505050565b6102e2828261049e565b5050565b60606004805461021790610999565b6102e282826104fa565b6000336102a88185856103f3565b61031a8383836001610556565b505050565b73ffffffffffffffffffffffffffffffffffffffff8381166000908152600160209081526040808320938616835292905220547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146103ed57818110156103de576040517ffb8f41b200000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8416600482015260248101829052604481018390526064015b60405180910390fd5b6103ed84848484036000610556565b50505050565b73ffffffffffffffffffffffffffffffffffffffff8316610443576040517f96c6fd1e000000000000000000000000000000000000000000000000000000008152600060048201526024016103d5565b73ffffffffffffffffffffffffffffffffffffffff8216610493576040517fec442f05000000000000000000000000000000000000000000000000000000008152600060048201526024016103d5565b61031a83838361069e565b73ffffffffffffffffffffffffffffffffffffffff82166104ee576040517fec442f05000000000000000000000000000000000000000000000000000000008152600060048201526024016103d5565b6102e26000838361069e565b73ffffffffffffffffffffffffffffffffffffffff821661054a576040517f96c6fd1e000000000000000000000000000000000000000000000000000000008152600060048201526024016103d5565b6102e28260008361069e565b73ffffffffffffffffffffffffffffffffffffffff84166105a6576040517fe602df05000000000000000000000000000000000000000000000000000000008152600060048201526024016103d5565b73ffffffffffffffffffffffffffffffffffffffff83166105f6576040517f94280d62000000000000000000000000000000000000000000000000000000008152600060048201526024016103d5565b73ffffffffffffffffffffffffffffffffffffffff808516600090815260016020908152604080832093871683529290522082905580156103ed578273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258460405161069091815260200190565b60405180910390a350505050565b73ffffffffffffffffffffffffffffffffffffffff83166106d65780600260008282546106cb91906109ec565b909155506107889050565b73ffffffffffffffffffffffffffffffffffffffff83166000908152602081905260409020548181101561075c576040517fe450d38c00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8516600482015260248101829052604481018390526064016103d5565b73ffffffffffffffffffffffffffffffffffffffff841660009081526020819052604090209082900390555b73ffffffffffffffffffffffffffffffffffffffff82166107b1576002805482900390556107dd565b73ffffffffffffffffffffffffffffffffffffffff821660009081526020819052604090208054820190555b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161083c91815260200190565b60405180910390a3505050565b600060208083528351808285015260005b818110156108765785810183015185820160400152820161085a565b5060006040828601015260407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8301168501019250505092915050565b803573ffffffffffffffffffffffffffffffffffffffff811681146108d957600080fd5b919050565b600080604083850312156108f157600080fd5b6108fa836108b5565b946020939093013593505050565b60008060006060848603121561091d57600080fd5b610926846108b5565b9250610934602085016108b5565b9150604084013590509250925092565b60006020828403121561095657600080fd5b61095f826108b5565b9392505050565b6000806040838503121561097957600080fd5b610982836108b5565b9150610990602084016108b5565b90509250929050565b600181811c908216806109ad57607f821691505b6020821081036109e6577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b808201808211156102ae577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fdfea264697066735822122026f64d6f95f0703c9301963e6c1938a90571f9265dae22ab806cad3a0261fad664736f6c63430008140033","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17 ^0.8.20;\n\n// lib/openzeppelin-contracts/contracts/interfaces/draft-IERC6093.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol)\n\n/**\n * @dev Standard ERC-20 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-20 tokens.\n */\ninterface IERC20Errors {\n /**\n * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n * @param balance Current balance for the interacting account.\n * @param needed Minimum amount required to perform a transfer.\n */\n error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);\n\n /**\n * @dev Indicates a failure with the token `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n */\n error ERC20InvalidSender(address sender);\n\n /**\n * @dev Indicates a failure with the token `receiver`. Used in transfers.\n * @param receiver Address to which tokens are being transferred.\n */\n error ERC20InvalidReceiver(address receiver);\n\n /**\n * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.\n * @param spender Address that may be allowed to operate on tokens without being their owner.\n * @param allowance Amount of tokens a `spender` is allowed to operate with.\n * @param needed Minimum amount required to perform a transfer.\n */\n error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);\n\n /**\n * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n * @param approver Address initiating an approval operation.\n */\n error ERC20InvalidApprover(address approver);\n\n /**\n * @dev Indicates a failure with the `spender` to be approved. Used in approvals.\n * @param spender Address that may be allowed to operate on tokens without being their owner.\n */\n error ERC20InvalidSpender(address spender);\n}\n\n/**\n * @dev Standard ERC-721 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-721 tokens.\n */\ninterface IERC721Errors {\n /**\n * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in ERC-20.\n * Used in balance queries.\n * @param owner Address of the current owner of a token.\n */\n error ERC721InvalidOwner(address owner);\n\n /**\n * @dev Indicates a `tokenId` whose `owner` is the zero address.\n * @param tokenId Identifier number of a token.\n */\n error ERC721NonexistentToken(uint256 tokenId);\n\n /**\n * @dev Indicates an error related to the ownership over a particular token. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n * @param tokenId Identifier number of a token.\n * @param owner Address of the current owner of a token.\n */\n error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);\n\n /**\n * @dev Indicates a failure with the token `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n */\n error ERC721InvalidSender(address sender);\n\n /**\n * @dev Indicates a failure with the token `receiver`. Used in transfers.\n * @param receiver Address to which tokens are being transferred.\n */\n error ERC721InvalidReceiver(address receiver);\n\n /**\n * @dev Indicates a failure with the `operator`’s approval. Used in transfers.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n * @param tokenId Identifier number of a token.\n */\n error ERC721InsufficientApproval(address operator, uint256 tokenId);\n\n /**\n * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n * @param approver Address initiating an approval operation.\n */\n error ERC721InvalidApprover(address approver);\n\n /**\n * @dev Indicates a failure with the `operator` to be approved. Used in approvals.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n */\n error ERC721InvalidOperator(address operator);\n}\n\n/**\n * @dev Standard ERC-1155 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-1155 tokens.\n */\ninterface IERC1155Errors {\n /**\n * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n * @param balance Current balance for the interacting account.\n * @param needed Minimum amount required to perform a transfer.\n * @param tokenId Identifier number of a token.\n */\n error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);\n\n /**\n * @dev Indicates a failure with the token `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n */\n error ERC1155InvalidSender(address sender);\n\n /**\n * @dev Indicates a failure with the token `receiver`. Used in transfers.\n * @param receiver Address to which tokens are being transferred.\n */\n error ERC1155InvalidReceiver(address receiver);\n\n /**\n * @dev Indicates a failure with the `operator`’s approval. Used in transfers.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n * @param owner Address of the current owner of a token.\n */\n error ERC1155MissingApprovalForAll(address operator, address owner);\n\n /**\n * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n * @param approver Address initiating an approval operation.\n */\n error ERC1155InvalidApprover(address approver);\n\n /**\n * @dev Indicates a failure with the `operator` to be approved. Used in approvals.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n */\n error ERC1155InvalidOperator(address operator);\n\n /**\n * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.\n * Used in batch transfers.\n * @param idsLength Length of the array of token identifiers\n * @param valuesLength Length of the array of token amounts\n */\n error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);\n}\n\n// lib/openzeppelin-contracts/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 ERC-20 standard as defined in the ERC.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the value of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the value of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 value) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n * caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 value) external returns (bool);\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\n * allowance mechanism. `value` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n\n// lib/openzeppelin-contracts/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// lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol)\n\n/**\n * @dev Interface for the optional metadata functions from the ERC-20 standard.\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n\n// lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/ERC20.sol)\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * The default value of {decimals} is 18. To change this, you should override\n * this function so it returns a different value.\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC-20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the ERC may not emit\n * these events, as it isn't required by the specification.\n */\nabstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors {\n mapping(address account =\u003e uint256) private _balances;\n\n mapping(address account =\u003e mapping(address spender =\u003e uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the default value returned by this function, unless\n * it's overridden.\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `value`.\n */\n function transfer(address to, uint256 value) public virtual returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, value);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 value) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, value);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the ERC. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `value`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `value`.\n */\n function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, value);\n _transfer(from, to, value);\n return true;\n }\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * NOTE: This function is not virtual, {_update} should be overridden instead.\n */\n function _transfer(address from, address to, uint256 value) internal {\n if (from == address(0)) {\n revert ERC20InvalidSender(address(0));\n }\n if (to == address(0)) {\n revert ERC20InvalidReceiver(address(0));\n }\n _update(from, to, value);\n }\n\n /**\n * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from`\n * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding\n * this function.\n *\n * Emits a {Transfer} event.\n */\n function _update(address from, address to, uint256 value) internal virtual {\n if (from == address(0)) {\n // Overflow check required: The rest of the code assumes that totalSupply never overflows\n _totalSupply += value;\n } else {\n uint256 fromBalance = _balances[from];\n if (fromBalance \u003c value) {\n revert ERC20InsufficientBalance(from, fromBalance, value);\n }\n unchecked {\n // Overflow not possible: value \u003c= fromBalance \u003c= totalSupply.\n _balances[from] = fromBalance - value;\n }\n }\n\n if (to == address(0)) {\n unchecked {\n // Overflow not possible: value \u003c= totalSupply or value \u003c= fromBalance \u003c= totalSupply.\n _totalSupply -= value;\n }\n } else {\n unchecked {\n // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.\n _balances[to] += value;\n }\n }\n\n emit Transfer(from, to, value);\n }\n\n /**\n * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).\n * Relies on the `_update` mechanism\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * NOTE: This function is not virtual, {_update} should be overridden instead.\n */\n function _mint(address account, uint256 value) internal {\n if (account == address(0)) {\n revert ERC20InvalidReceiver(address(0));\n }\n _update(address(0), account, value);\n }\n\n /**\n * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply.\n * Relies on the `_update` mechanism.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * NOTE: This function is not virtual, {_update} should be overridden instead\n */\n function _burn(address account, uint256 value) internal {\n if (account == address(0)) {\n revert ERC20InvalidSender(address(0));\n }\n _update(account, address(0), value);\n }\n\n /**\n * @dev Sets `value` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n *\n * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.\n */\n function _approve(address owner, address spender, uint256 value) internal {\n _approve(owner, spender, value, true);\n }\n\n /**\n * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event.\n *\n * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by\n * `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any\n * `Approval` event during `transferFrom` operations.\n *\n * Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to\n * true using the following override:\n * ```\n * function _approve(address owner, address spender, uint256 value, bool) internal virtual override {\n * super._approve(owner, spender, value, true);\n * }\n * ```\n *\n * Requirements are the same as {_approve}.\n */\n function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {\n if (owner == address(0)) {\n revert ERC20InvalidApprover(address(0));\n }\n if (spender == address(0)) {\n revert ERC20InvalidSpender(address(0));\n }\n _allowances[owner][spender] = value;\n if (emitEvent) {\n emit Approval(owner, spender, value);\n }\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `value`.\n *\n * Does not update the allowance value in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Does not emit an {Approval} event.\n */\n function _spendAllowance(address owner, address spender, uint256 value) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n if (currentAllowance \u003c value) {\n revert ERC20InsufficientAllowance(spender, currentAllowance, value);\n }\n unchecked {\n _approve(owner, spender, currentAllowance - value, false);\n }\n }\n }\n}\n\n// test/MockERC20.sol\n\ncontract MockERC20 is ERC20 {\n uint8 private _decimals;\n\n constructor(string memory name_, uint8 decimals_) ERC20(name_, name_) {\n _decimals = decimals_;\n }\n\n function decimals() public view override returns (uint8) {\n return _decimals;\n }\n\n function burn(address account, uint256 amount) external {\n _burn(account, amount);\n }\n\n function mint(address account, uint256 amount) external {\n _mint(account, amount);\n }\n}\n","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","compilerOptions":"--combined-json bin,bin-runtime,srcmap,srcmap-runtime,abi,userdoc,devdoc,metadata,hashes --optimize --optimize-runs 10000 --allow-paths ., ./, ../ --evm-version=istanbul","srcMap":"21998:472:0:-:0;;;22062:108;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;22118:5;;12793;:13;22118:5;12793;:13;:::i;:::-;-1:-1:-1;12816:7:0;:17;12826:7;12816;:17;:::i;:::-;-1:-1:-1;;22142:9:0::1;:21:::0;;-1:-1:-1;;22142:21:0::1;;::::0;;;::::1;::::0;;;::::1;::::0;;;-1:-1:-1;21998:472:0;;-1:-1:-1;21998:472:0;14:127:1;75:10;70:3;66:20;63:1;56:31;106:4;103:1;96:15;130:4;127:1;120:15;146:160;223:13;;276:4;265:16;;255:27;;245:55;;296:1;293;286:12;245:55;146:160;;;:::o;311:1125::-;398:6;406;459:2;447:9;438:7;434:23;430:32;427:52;;;475:1;472;465:12;427:52;502:16;;-1:-1:-1;;;;;567:14:1;;;564:34;;;594:1;591;584:12;564:34;632:6;621:9;617:22;607:32;;677:7;670:4;666:2;662:13;658:27;648:55;;699:1;696;689:12;648:55;728:2;722:9;750:2;746;743:10;740:36;;;756:18;;:::i;:::-;831:2;825:9;799:2;885:13;;-1:-1:-1;;881:22:1;;;905:2;877:31;873:40;861:53;;;929:18;;;949:22;;;926:46;923:72;;;975:18;;:::i;:::-;1015:10;1011:2;1004:22;1050:2;1042:6;1035:18;1072:4;1062:14;;1113:7;1108:2;1103;1099;1095:11;1091:20;1088:33;1085:53;;;1134:1;1131;1124:12;1085:53;1156:1;1147:10;;1166:129;1180:2;1177:1;1174:9;1166:129;;;1268:10;;;1264:19;;1258:26;1237:14;;;1233:23;;1226:59;1191:10;;;;1166:129;;;1337:1;1332:2;1327;1319:6;1315:15;1311:24;1304:35;1358:6;1348:16;;;;;1383:47;1426:2;1415:9;1411:18;1383:47;:::i;:::-;1373:57;;;;311:1125;;;;;:::o;1441:380::-;1520:1;1516:12;;;;1563;;;1584:61;;1638:4;1630:6;1626:17;1616:27;;1584:61;1691:2;1683:6;1680:14;1660:18;1657:38;1654:161;;1737:10;1732:3;1728:20;1725:1;1718:31;1772:4;1769:1;1762:15;1800:4;1797:1;1790:15;1654:161;;1441:380;;;:::o;1952:545::-;2054:2;2049:3;2046:11;2043:448;;;2090:1;2115:5;2111:2;2104:17;2160:4;2156:2;2146:19;2230:2;2218:10;2214:19;2211:1;2207:27;2201:4;2197:38;2266:4;2254:10;2251:20;2248:47;;;-1:-1:-1;2289:4:1;2248:47;2344:2;2339:3;2335:12;2332:1;2328:20;2322:4;2318:31;2308:41;;2399:82;2417:2;2410:5;2407:13;2399:82;;;2462:17;;;2443:1;2432:13;2399:82;;;2403:3;;;2043:448;1952:545;;;:::o;2673:1352::-;2793:10;;-1:-1:-1;;;;;2815:30:1;;2812:56;;;2848:18;;:::i;:::-;2877:97;2967:6;2927:38;2959:4;2953:11;2927:38;:::i;:::-;2921:4;2877:97;:::i;:::-;3029:4;;3093:2;3082:14;;3110:1;3105:663;;;;3812:1;3829:6;3826:89;;;-1:-1:-1;3881:19:1;;;3875:26;3826:89;-1:-1:-1;;2630:1:1;2626:11;;;2622:24;2618:29;2608:40;2654:1;2650:11;;;2605:57;3928:81;;3075:944;;3105:663;1899:1;1892:14;;;1936:4;1923:18;;-1:-1:-1;;3141:20:1;;;3259:236;3273:7;3270:1;3267:14;3259:236;;;3362:19;;;3356:26;3341:42;;3454:27;;;;3422:1;3410:14;;;;3289:19;;3259:236;;;3263:3;3523:6;3514:7;3511:19;3508:201;;;3584:19;;;3578:26;-1:-1:-1;;3667:1:1;3663:14;;;3679:3;3659:24;3655:37;3651:42;3636:58;3621:74;;3508:201;-1:-1:-1;;;;;3755:1:1;3739:14;;;3735:22;3722:36;;-1:-1:-1;2673:1352:1:o;:::-;21998:472:0;;;;;;","srcMapRuntime":"21998:472:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;12905:89;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;15124:186;;;;;;:::i;:::-;;:::i;:::-;;;1251:14:1;;1244:22;1226:41;;1214:2;1199:18;15124:186:0;1086:187:1;13975:97:0;14053:12;;13975:97;;;1424:25:1;;;1412:2;1397:18;13975:97:0;1278:177:1;15870:244:0;;;;;;:::i;:::-;;:::i;22176:90::-;22250:9;;22176:90;;22250:9;;;;1935:36:1;;1923:2;1908:18;22176:90:0;1793:184:1;22373:95:0;;;;;;:::i;:::-;;:::i;:::-;;14130:116;;;;;;:::i;:::-;14221:18;;14195:7;14221:18;;;;;;;;;;;;14130:116;13107:93;;;:::i;22272:95::-;;;;;;:::i;:::-;;:::i;14441:178::-;;;;;;:::i;:::-;;:::i;14677:140::-;;;;;;:::i;:::-;14783:18;;;;14757:7;14783:18;;;:11;:18;;;;;;;;:27;;;;;;;;;;;;;14677:140;12905:89;12950:13;12982:5;12975:12;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;12905:89;:::o;15124:186::-;15197:4;10142:10;15251:31;10142:10;15267:7;15276:5;15251:8;:31::i;:::-;15299:4;15292:11;;;15124:186;;;;;:::o;15870:244::-;15957:4;10142:10;16013:37;16029:4;10142:10;16044:5;16013:15;:37::i;:::-;16060:26;16070:4;16076:2;16080:5;16060:9;:26::i;:::-;-1:-1:-1;16103:4:0;;15870:244;-1:-1:-1;;;;15870:244:0:o;22373:95::-;22439:22;22445:7;22454:6;22439:5;:22::i;:::-;22373:95;;:::o;13107:93::-;13154:13;13186:7;13179:14;;;;;:::i;22272:95::-;22338:22;22344:7;22353:6;22338:5;:22::i;14441:178::-;14510:4;10142:10;14564:27;10142:10;14581:2;14585:5;14564:9;:27::i;19820:128::-;19904:37;19913:5;19920:7;19929:5;19936:4;19904:8;:37::i;:::-;19820:128;;;:::o;21494:477::-;14783:18;;;;21593:24;14783:18;;;:11;:18;;;;;;;;:27;;;;;;;;;;21679:17;21659:37;;21655:310;;21735:5;21716:16;:24;21712:130;;;21767:60;;;;;3112:42:1;3100:55;;21767:60:0;;;3082:74:1;3172:18;;;3165:34;;;3215:18;;;3208:34;;;3055:18;;21767:60:0;;;;;;;;21712:130;21883:57;21892:5;21899:7;21927:5;21908:16;:24;21934:5;21883:8;:57::i;:::-;21583:388;21494:477;;;:::o;16487:300::-;16570:18;;;16566:86;;16611:30;;;;;16638:1;16611:30;;;3399:74:1;3372:18;;16611:30:0;3253:226:1;16566:86:0;16665:16;;;16661:86;;16704:32;;;;;16733:1;16704:32;;;3399:74:1;3372:18;;16704:32:0;3253:226:1;16661:86:0;16756:24;16764:4;16770:2;16774:5;16756:7;:24::i;18552:208::-;18622:21;;;18618:91;;18666:32;;;;;18695:1;18666:32;;;3399:74:1;3372:18;;18666:32:0;3253:226:1;18618:91:0;18718:35;18734:1;18738:7;18747:5;18718:7;:35::i;19078:206::-;19148:21;;;19144:89;;19192:30;;;;;19219:1;19192:30;;;3399:74:1;3372:18;;19192:30:0;3253:226:1;19144:89:0;19242:35;19250:7;19267:1;19271:5;19242:7;:35::i;20780:432::-;20892:19;;;20888:89;;20934:32;;;;;20963:1;20934:32;;;3399:74:1;3372:18;;20934:32:0;3253:226:1;20888:89:0;20990:21;;;20986:90;;21034:31;;;;;21062:1;21034:31;;;3399:74:1;3372:18;;21034:31:0;3253:226:1;20986:90:0;21085:18;;;;;;;;:11;:18;;;;;;;;:27;;;;;;;;;:35;;;21130:76;;;;21180:7;21164:31;;21173:5;21164:31;;;21189:5;21164:31;;;;1424:25:1;;1412:2;1397:18;;1278:177;21164:31:0;;;;;;;;20780:432;;;;:::o;17102:1107::-;17191:18;;;17187:540;;17343:5;17327:12;;:21;;;;;;;:::i;:::-;;;;-1:-1:-1;17187:540:0;;-1:-1:-1;17187:540:0;;17401:15;;;17379:19;17401:15;;;;;;;;;;;17434:19;;;17430:115;;;17480:50;;;;;3112:42:1;3100:55;;17480:50:0;;;3082:74:1;3172:18;;;3165:34;;;3215:18;;;3208:34;;;3055:18;;17480:50:0;2880:368:1;17430:115:0;17665:15;;;:9;:15;;;;;;;;;;17683:19;;;;17665:37;;17187:540;17741:16;;;17737:425;;17904:12;:21;;;;;;;17737:425;;;18115:13;;;:9;:13;;;;;;;;;;:22;;;;;;17737:425;18192:2;18177:25;;18186:4;18177:25;;;18196:5;18177:25;;;;1424::1;;1412:2;1397:18;;1278:177;18177:25:0;;;;;;;;17102:1107;;;:::o;14:607:1:-;126:4;155:2;184;173:9;166:21;216:6;210:13;259:6;254:2;243:9;239:18;232:34;284:1;294:140;308:6;305:1;302:13;294:140;;;403:14;;;399:23;;393:30;369:17;;;388:2;365:26;358:66;323:10;;294:140;;;298:3;483:1;478:2;469:6;458:9;454:22;450:31;443:42;612:2;542:66;537:2;529:6;525:15;521:88;510:9;506:104;502:113;494:121;;;;14:607;;;;:::o;626:196::-;694:20;;754:42;743:54;;733:65;;723:93;;812:1;809;802:12;723:93;626:196;;;:::o;827:254::-;895:6;903;956:2;944:9;935:7;931:23;927:32;924:52;;;972:1;969;962:12;924:52;995:29;1014:9;995:29;:::i;:::-;985:39;1071:2;1056:18;;;;1043:32;;-1:-1:-1;;;827:254:1:o;1460:328::-;1537:6;1545;1553;1606:2;1594:9;1585:7;1581:23;1577:32;1574:52;;;1622:1;1619;1612:12;1574:52;1645:29;1664:9;1645:29;:::i;:::-;1635:39;;1693:38;1727:2;1716:9;1712:18;1693:38;:::i;:::-;1683:48;;1778:2;1767:9;1763:18;1750:32;1740:42;;1460:328;;;;;:::o;1982:186::-;2041:6;2094:2;2082:9;2073:7;2069:23;2065:32;2062:52;;;2110:1;2107;2100:12;2062:52;2133:29;2152:9;2133:29;:::i;:::-;2123:39;1982:186;-1:-1:-1;;;1982:186:1:o;2173:260::-;2241:6;2249;2302:2;2290:9;2281:7;2277:23;2273:32;2270:52;;;2318:1;2315;2308:12;2270:52;2341:29;2360:9;2341:29;:::i;:::-;2331:39;;2389:38;2423:2;2412:9;2408:18;2389:38;:::i;:::-;2379:48;;2173:260;;;;;:::o;2438:437::-;2517:1;2513:12;;;;2560;;;2581:61;;2635:4;2627:6;2623:17;2613:27;;2581:61;2688:2;2680:6;2677:14;2657:18;2654:38;2651:218;;2725:77;2722:1;2715:88;2826:4;2823:1;2816:15;2854:4;2851:1;2844:15;2651:218;;2438:437;;;:::o;3484:279::-;3549:9;;;3570:10;;;3567:190;;;3613:77;3610:1;3603:88;3714:4;3711:1;3704:15;3742:4;3739:1;3732:15","abiDefinition":[{"inputs":[{"internalType":"string","name":"name_","type":"string"},{"internalType":"uint8","name":"decimals_","type":"uint8"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"allowance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"ERC20InsufficientAllowance","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"ERC20InsufficientBalance","type":"error"},{"inputs":[{"internalType":"address","name":"approver","type":"address"}],"name":"ERC20InvalidApprover","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC20InvalidReceiver","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"ERC20InvalidSender","type":"error"},{"inputs":[{"internalType":"address","name":"spender","type":"address"}],"name":"ERC20InvalidSpender","type":"error"},{"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":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"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":{"errors":{"ERC20InsufficientAllowance(address,uint256,uint256)":[{"details":"Indicates a failure with the `spender`’s `allowance`. Used in transfers.","params":{"allowance":"Amount of tokens a `spender` is allowed to operate with.","needed":"Minimum amount required to perform a transfer.","spender":"Address that may be allowed to operate on tokens without being their owner."}}],"ERC20InsufficientBalance(address,uint256,uint256)":[{"details":"Indicates an error related to the current `balance` of a `sender`. Used in transfers.","params":{"balance":"Current balance for the interacting account.","needed":"Minimum amount required to perform a transfer.","sender":"Address whose tokens are being transferred."}}],"ERC20InvalidApprover(address)":[{"details":"Indicates a failure with the `approver` of a token to be approved. Used in approvals.","params":{"approver":"Address initiating an approval operation."}}],"ERC20InvalidReceiver(address)":[{"details":"Indicates a failure with the token `receiver`. Used in transfers.","params":{"receiver":"Address to which tokens are being transferred."}}],"ERC20InvalidSender(address)":[{"details":"Indicates a failure with the token `sender`. Used in transfers.","params":{"sender":"Address whose tokens are being transferred."}}],"ERC20InvalidSpender(address)":[{"details":"Indicates a failure with the `spender` to be approved. Used in approvals.","params":{"spender":"Address that may be allowed to operate on tokens without being their owner."}}]},"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":"See {IERC20-allowance}."},"approve(address,uint256)":{"details":"See {IERC20-approve}. NOTE: If `value` is the maximum `uint256`, the allowance is not updated on `transferFrom`. This is semantically equivalent to an infinite approval. Requirements: - `spender` cannot be the zero address."},"balanceOf(address)":{"details":"See {IERC20-balanceOf}."},"decimals()":{"details":"Returns the number of decimals used to get its user representation. For example, if `decimals` equals `2`, a balance of `505` tokens should be displayed to a user as `5.05` (`505 / 10 ** 2`). Tokens usually opt for a value of 18, imitating the relationship between Ether and Wei. This is the default value returned by this function, unless it's overridden. NOTE: This information is only used for _display_ purposes: it in no way affects any of the arithmetic of the contract, including {IERC20-balanceOf} and {IERC20-transfer}."},"name()":{"details":"Returns the name of the token."},"symbol()":{"details":"Returns the symbol of the token, usually a shorter version of the name."},"totalSupply()":{"details":"See {IERC20-totalSupply}."},"transfer(address,uint256)":{"details":"See {IERC20-transfer}. Requirements: - `to` cannot be the zero address. - the caller must have a balance of at least `value`."},"transferFrom(address,address,uint256)":{"details":"See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the ERC. See the note at the beginning of {ERC20}. NOTE: Does not update the allowance if the current allowance is the maximum `uint256`. Requirements: - `from` and `to` cannot be the zero address. - `from` must have a balance of at least `value`. - the caller must have allowance for ``from``'s tokens of at least `value`."}},"version":1},"metadata":"{\"compiler\":{\"version\":\"0.8.20+commit.a1b79de6\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name_\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"decimals_\",\"type\":\"uint8\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"allowance\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"needed\",\"type\":\"uint256\"}],\"name\":\"ERC20InsufficientAllowance\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"balance\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"needed\",\"type\":\"uint256\"}],\"name\":\"ERC20InsufficientBalance\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"approver\",\"type\":\"address\"}],\"name\":\"ERC20InvalidApprover\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"}],\"name\":\"ERC20InvalidReceiver\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"ERC20InvalidSender\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"}],\"name\":\"ERC20InvalidSpender\",\"type\":\"error\"},{\"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\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"burn\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"mint\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"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\":{\"errors\":{\"ERC20InsufficientAllowance(address,uint256,uint256)\":[{\"details\":\"Indicates a failure with the `spender`\\u2019s `allowance`. Used in transfers.\",\"params\":{\"allowance\":\"Amount of tokens a `spender` is allowed to operate with.\",\"needed\":\"Minimum amount required to perform a transfer.\",\"spender\":\"Address that may be allowed to operate on tokens without being their owner.\"}}],\"ERC20InsufficientBalance(address,uint256,uint256)\":[{\"details\":\"Indicates an error related to the current `balance` of a `sender`. Used in transfers.\",\"params\":{\"balance\":\"Current balance for the interacting account.\",\"needed\":\"Minimum amount required to perform a transfer.\",\"sender\":\"Address whose tokens are being transferred.\"}}],\"ERC20InvalidApprover(address)\":[{\"details\":\"Indicates a failure with the `approver` of a token to be approved. Used in approvals.\",\"params\":{\"approver\":\"Address initiating an approval operation.\"}}],\"ERC20InvalidReceiver(address)\":[{\"details\":\"Indicates a failure with the token `receiver`. Used in transfers.\",\"params\":{\"receiver\":\"Address to which tokens are being transferred.\"}}],\"ERC20InvalidSender(address)\":[{\"details\":\"Indicates a failure with the token `sender`. Used in transfers.\",\"params\":{\"sender\":\"Address whose tokens are being transferred.\"}}],\"ERC20InvalidSpender(address)\":[{\"details\":\"Indicates a failure with the `spender` to be approved. Used in approvals.\",\"params\":{\"spender\":\"Address that may be allowed to operate on tokens without being their owner.\"}}]},\"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\":\"See {IERC20-allowance}.\"},\"approve(address,uint256)\":{\"details\":\"See {IERC20-approve}. NOTE: If `value` is the maximum `uint256`, the allowance is not updated on `transferFrom`. This is semantically equivalent to an infinite approval. Requirements: - `spender` cannot be the zero address.\"},\"balanceOf(address)\":{\"details\":\"See {IERC20-balanceOf}.\"},\"decimals()\":{\"details\":\"Returns the number of decimals used to get its user representation. For example, if `decimals` equals `2`, a balance of `505` tokens should be displayed to a user as `5.05` (`505 / 10 ** 2`). Tokens usually opt for a value of 18, imitating the relationship between Ether and Wei. This is the default value returned by this function, unless it's overridden. NOTE: This information is only used for _display_ purposes: it in no way affects any of the arithmetic of the contract, including {IERC20-balanceOf} and {IERC20-transfer}.\"},\"name()\":{\"details\":\"Returns the name of the token.\"},\"symbol()\":{\"details\":\"Returns the symbol of the token, usually a shorter version of the name.\"},\"totalSupply()\":{\"details\":\"See {IERC20-totalSupply}.\"},\"transfer(address,uint256)\":{\"details\":\"See {IERC20-transfer}. Requirements: - `to` cannot be the zero address. - the caller must have a balance of at least `value`.\"},\"transferFrom(address,address,uint256)\":{\"details\":\"See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the ERC. See the note at the beginning of {ERC20}. NOTE: Does not update the allowance if the current allowance is the maximum `uint256`. Requirements: - `from` and `to` cannot be the zero address. - `from` must have a balance of at least `value`. - the caller must have allowance for ``from``'s tokens of at least `value`.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/MockERC20.sol\":\"MockERC20\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/MockERC20.sol\":{\"keccak256\":\"0xf65c9d7a8c41c471bcbffaf66e7b9353696ec5f2946643acc4f44e0fea54071a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://4a127daf5ac1aec89a139d3e60e127b1bf2347057f27379b9cbea0a1709e9bd0\",\"dweb:/ipfs/QmNQ9B9Fo3Z95JCHRhPX4UdVdpHwgtX8sWcaq1UQzCmxBc\"]}},\"version\":1}"},"hashes":{"allowance(address,address)":"dd62ed3e","approve(address,uint256)":"095ea7b3","balanceOf(address)":"70a08231","burn(address,uint256)":"9dc29fac","decimals()":"313ce567","mint(address,uint256)":"40c10f19","name()":"06fdde03","symbol()":"95d89b41","totalSupply()":"18160ddd","transfer(address,uint256)":"a9059cbb","transferFrom(address,address,uint256)":"23b872dd"}}} \ No newline at end of file +{"solidity/MockERC20.sol:Context":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17 ^0.8.20;\n\n// node_modules/@openzeppelin/contracts/interfaces/draft-IERC6093.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol)\n\n/**\n * @dev Standard ERC20 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens.\n */\ninterface IERC20Errors {\n /**\n * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n * @param balance Current balance for the interacting account.\n * @param needed Minimum amount required to perform a transfer.\n */\n error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);\n\n /**\n * @dev Indicates a failure with the token `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n */\n error ERC20InvalidSender(address sender);\n\n /**\n * @dev Indicates a failure with the token `receiver`. Used in transfers.\n * @param receiver Address to which tokens are being transferred.\n */\n error ERC20InvalidReceiver(address receiver);\n\n /**\n * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.\n * @param spender Address that may be allowed to operate on tokens without being their owner.\n * @param allowance Amount of tokens a `spender` is allowed to operate with.\n * @param needed Minimum amount required to perform a transfer.\n */\n error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);\n\n /**\n * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n * @param approver Address initiating an approval operation.\n */\n error ERC20InvalidApprover(address approver);\n\n /**\n * @dev Indicates a failure with the `spender` to be approved. Used in approvals.\n * @param spender Address that may be allowed to operate on tokens without being their owner.\n */\n error ERC20InvalidSpender(address spender);\n}\n\n/**\n * @dev Standard ERC721 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens.\n */\ninterface IERC721Errors {\n /**\n * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20.\n * Used in balance queries.\n * @param owner Address of the current owner of a token.\n */\n error ERC721InvalidOwner(address owner);\n\n /**\n * @dev Indicates a `tokenId` whose `owner` is the zero address.\n * @param tokenId Identifier number of a token.\n */\n error ERC721NonexistentToken(uint256 tokenId);\n\n /**\n * @dev Indicates an error related to the ownership over a particular token. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n * @param tokenId Identifier number of a token.\n * @param owner Address of the current owner of a token.\n */\n error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);\n\n /**\n * @dev Indicates a failure with the token `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n */\n error ERC721InvalidSender(address sender);\n\n /**\n * @dev Indicates a failure with the token `receiver`. Used in transfers.\n * @param receiver Address to which tokens are being transferred.\n */\n error ERC721InvalidReceiver(address receiver);\n\n /**\n * @dev Indicates a failure with the `operator`’s approval. Used in transfers.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n * @param tokenId Identifier number of a token.\n */\n error ERC721InsufficientApproval(address operator, uint256 tokenId);\n\n /**\n * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n * @param approver Address initiating an approval operation.\n */\n error ERC721InvalidApprover(address approver);\n\n /**\n * @dev Indicates a failure with the `operator` to be approved. Used in approvals.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n */\n error ERC721InvalidOperator(address operator);\n}\n\n/**\n * @dev Standard ERC1155 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens.\n */\ninterface IERC1155Errors {\n /**\n * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n * @param balance Current balance for the interacting account.\n * @param needed Minimum amount required to perform a transfer.\n * @param tokenId Identifier number of a token.\n */\n error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);\n\n /**\n * @dev Indicates a failure with the token `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n */\n error ERC1155InvalidSender(address sender);\n\n /**\n * @dev Indicates a failure with the token `receiver`. Used in transfers.\n * @param receiver Address to which tokens are being transferred.\n */\n error ERC1155InvalidReceiver(address receiver);\n\n /**\n * @dev Indicates a failure with the `operator`’s approval. Used in transfers.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n * @param owner Address of the current owner of a token.\n */\n error ERC1155MissingApprovalForAll(address operator, address owner);\n\n /**\n * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n * @param approver Address initiating an approval operation.\n */\n error ERC1155InvalidApprover(address approver);\n\n /**\n * @dev Indicates a failure with the `operator` to be approved. Used in approvals.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n */\n error ERC1155InvalidOperator(address operator);\n\n /**\n * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.\n * Used in batch transfers.\n * @param idsLength Length of the array of token identifiers\n * @param valuesLength Length of the array of token amounts\n */\n error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);\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/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/token/ERC20/extensions/IERC20Metadata.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol)\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n\n// node_modules/@openzeppelin/contracts/token/ERC20/ERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/ERC20.sol)\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * The default value of {decimals} is 18. To change this, you should override\n * this function so it returns a different value.\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n */\nabstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors {\n mapping(address account =\u003e uint256) private _balances;\n\n mapping(address account =\u003e mapping(address spender =\u003e uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the default value returned by this function, unless\n * it's overridden.\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `value`.\n */\n function transfer(address to, uint256 value) public virtual returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, value);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 value) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, value);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `value`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `value`.\n */\n function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, value);\n _transfer(from, to, value);\n return true;\n }\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * NOTE: This function is not virtual, {_update} should be overridden instead.\n */\n function _transfer(address from, address to, uint256 value) internal {\n if (from == address(0)) {\n revert ERC20InvalidSender(address(0));\n }\n if (to == address(0)) {\n revert ERC20InvalidReceiver(address(0));\n }\n _update(from, to, value);\n }\n\n /**\n * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from`\n * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding\n * this function.\n *\n * Emits a {Transfer} event.\n */\n function _update(address from, address to, uint256 value) internal virtual {\n if (from == address(0)) {\n // Overflow check required: The rest of the code assumes that totalSupply never overflows\n _totalSupply += value;\n } else {\n uint256 fromBalance = _balances[from];\n if (fromBalance \u003c value) {\n revert ERC20InsufficientBalance(from, fromBalance, value);\n }\n unchecked {\n // Overflow not possible: value \u003c= fromBalance \u003c= totalSupply.\n _balances[from] = fromBalance - value;\n }\n }\n\n if (to == address(0)) {\n unchecked {\n // Overflow not possible: value \u003c= totalSupply or value \u003c= fromBalance \u003c= totalSupply.\n _totalSupply -= value;\n }\n } else {\n unchecked {\n // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.\n _balances[to] += value;\n }\n }\n\n emit Transfer(from, to, value);\n }\n\n /**\n * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).\n * Relies on the `_update` mechanism\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * NOTE: This function is not virtual, {_update} should be overridden instead.\n */\n function _mint(address account, uint256 value) internal {\n if (account == address(0)) {\n revert ERC20InvalidReceiver(address(0));\n }\n _update(address(0), account, value);\n }\n\n /**\n * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply.\n * Relies on the `_update` mechanism.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * NOTE: This function is not virtual, {_update} should be overridden instead\n */\n function _burn(address account, uint256 value) internal {\n if (account == address(0)) {\n revert ERC20InvalidSender(address(0));\n }\n _update(account, address(0), value);\n }\n\n /**\n * @dev Sets `value` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n *\n * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.\n */\n function _approve(address owner, address spender, uint256 value) internal {\n _approve(owner, spender, value, true);\n }\n\n /**\n * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event.\n *\n * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by\n * `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any\n * `Approval` event during `transferFrom` operations.\n *\n * Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to\n * true using the following override:\n * ```\n * function _approve(address owner, address spender, uint256 value, bool) internal virtual override {\n * super._approve(owner, spender, value, true);\n * }\n * ```\n *\n * Requirements are the same as {_approve}.\n */\n function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {\n if (owner == address(0)) {\n revert ERC20InvalidApprover(address(0));\n }\n if (spender == address(0)) {\n revert ERC20InvalidSpender(address(0));\n }\n _allowances[owner][spender] = value;\n if (emitEvent) {\n emit Approval(owner, spender, value);\n }\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `value`.\n *\n * Does not update the allowance value in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Does not emit an {Approval} event.\n */\n function _spendAllowance(address owner, address spender, uint256 value) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n if (currentAllowance \u003c value) {\n revert ERC20InsufficientAllowance(spender, currentAllowance, value);\n }\n unchecked {\n _approve(owner, spender, currentAllowance - value, false);\n }\n }\n }\n}\n\n// test/MockERC20.sol\n\ncontract MockERC20 is ERC20 {\n uint8 private _decimals;\n\n constructor(string memory name_, uint8 decimals_) ERC20(name_, name_) {\n _decimals = decimals_;\n }\n\n function decimals() public view override returns (uint8) {\n return _decimals;\n }\n\n function burn(address account, uint256 amount) external {\n _burn(account, amount);\n }\n\n function mint(address account, uint256 amount) external {\n _mint(account, amount);\n }\n}\n","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","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.20+commit.a1b79de6\"},\"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/MockERC20.sol\":\"Context\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/MockERC20.sol\":{\"keccak256\":\"0xd602e791370b799101e4231c18317acecb9b397f92b6786483957405214ae011\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://71377faac66fbd6553967b93c94de35db8f6d710e578d0d4c021064a7a316d4c\",\"dweb:/ipfs/QmNMzNoV8SFKmwsswdmEnhsHKxEaxv9G8sL9eKuA6hEaPr\"]}},\"version\":1}"},"hashes":{}},"solidity/MockERC20.sol:ERC20":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17 ^0.8.20;\n\n// node_modules/@openzeppelin/contracts/interfaces/draft-IERC6093.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol)\n\n/**\n * @dev Standard ERC20 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens.\n */\ninterface IERC20Errors {\n /**\n * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n * @param balance Current balance for the interacting account.\n * @param needed Minimum amount required to perform a transfer.\n */\n error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);\n\n /**\n * @dev Indicates a failure with the token `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n */\n error ERC20InvalidSender(address sender);\n\n /**\n * @dev Indicates a failure with the token `receiver`. Used in transfers.\n * @param receiver Address to which tokens are being transferred.\n */\n error ERC20InvalidReceiver(address receiver);\n\n /**\n * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.\n * @param spender Address that may be allowed to operate on tokens without being their owner.\n * @param allowance Amount of tokens a `spender` is allowed to operate with.\n * @param needed Minimum amount required to perform a transfer.\n */\n error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);\n\n /**\n * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n * @param approver Address initiating an approval operation.\n */\n error ERC20InvalidApprover(address approver);\n\n /**\n * @dev Indicates a failure with the `spender` to be approved. Used in approvals.\n * @param spender Address that may be allowed to operate on tokens without being their owner.\n */\n error ERC20InvalidSpender(address spender);\n}\n\n/**\n * @dev Standard ERC721 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens.\n */\ninterface IERC721Errors {\n /**\n * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20.\n * Used in balance queries.\n * @param owner Address of the current owner of a token.\n */\n error ERC721InvalidOwner(address owner);\n\n /**\n * @dev Indicates a `tokenId` whose `owner` is the zero address.\n * @param tokenId Identifier number of a token.\n */\n error ERC721NonexistentToken(uint256 tokenId);\n\n /**\n * @dev Indicates an error related to the ownership over a particular token. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n * @param tokenId Identifier number of a token.\n * @param owner Address of the current owner of a token.\n */\n error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);\n\n /**\n * @dev Indicates a failure with the token `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n */\n error ERC721InvalidSender(address sender);\n\n /**\n * @dev Indicates a failure with the token `receiver`. Used in transfers.\n * @param receiver Address to which tokens are being transferred.\n */\n error ERC721InvalidReceiver(address receiver);\n\n /**\n * @dev Indicates a failure with the `operator`’s approval. Used in transfers.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n * @param tokenId Identifier number of a token.\n */\n error ERC721InsufficientApproval(address operator, uint256 tokenId);\n\n /**\n * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n * @param approver Address initiating an approval operation.\n */\n error ERC721InvalidApprover(address approver);\n\n /**\n * @dev Indicates a failure with the `operator` to be approved. Used in approvals.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n */\n error ERC721InvalidOperator(address operator);\n}\n\n/**\n * @dev Standard ERC1155 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens.\n */\ninterface IERC1155Errors {\n /**\n * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n * @param balance Current balance for the interacting account.\n * @param needed Minimum amount required to perform a transfer.\n * @param tokenId Identifier number of a token.\n */\n error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);\n\n /**\n * @dev Indicates a failure with the token `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n */\n error ERC1155InvalidSender(address sender);\n\n /**\n * @dev Indicates a failure with the token `receiver`. Used in transfers.\n * @param receiver Address to which tokens are being transferred.\n */\n error ERC1155InvalidReceiver(address receiver);\n\n /**\n * @dev Indicates a failure with the `operator`’s approval. Used in transfers.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n * @param owner Address of the current owner of a token.\n */\n error ERC1155MissingApprovalForAll(address operator, address owner);\n\n /**\n * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n * @param approver Address initiating an approval operation.\n */\n error ERC1155InvalidApprover(address approver);\n\n /**\n * @dev Indicates a failure with the `operator` to be approved. Used in approvals.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n */\n error ERC1155InvalidOperator(address operator);\n\n /**\n * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.\n * Used in batch transfers.\n * @param idsLength Length of the array of token identifiers\n * @param valuesLength Length of the array of token amounts\n */\n error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);\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/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/token/ERC20/extensions/IERC20Metadata.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol)\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n\n// node_modules/@openzeppelin/contracts/token/ERC20/ERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/ERC20.sol)\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * The default value of {decimals} is 18. To change this, you should override\n * this function so it returns a different value.\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n */\nabstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors {\n mapping(address account =\u003e uint256) private _balances;\n\n mapping(address account =\u003e mapping(address spender =\u003e uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the default value returned by this function, unless\n * it's overridden.\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `value`.\n */\n function transfer(address to, uint256 value) public virtual returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, value);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 value) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, value);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `value`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `value`.\n */\n function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, value);\n _transfer(from, to, value);\n return true;\n }\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * NOTE: This function is not virtual, {_update} should be overridden instead.\n */\n function _transfer(address from, address to, uint256 value) internal {\n if (from == address(0)) {\n revert ERC20InvalidSender(address(0));\n }\n if (to == address(0)) {\n revert ERC20InvalidReceiver(address(0));\n }\n _update(from, to, value);\n }\n\n /**\n * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from`\n * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding\n * this function.\n *\n * Emits a {Transfer} event.\n */\n function _update(address from, address to, uint256 value) internal virtual {\n if (from == address(0)) {\n // Overflow check required: The rest of the code assumes that totalSupply never overflows\n _totalSupply += value;\n } else {\n uint256 fromBalance = _balances[from];\n if (fromBalance \u003c value) {\n revert ERC20InsufficientBalance(from, fromBalance, value);\n }\n unchecked {\n // Overflow not possible: value \u003c= fromBalance \u003c= totalSupply.\n _balances[from] = fromBalance - value;\n }\n }\n\n if (to == address(0)) {\n unchecked {\n // Overflow not possible: value \u003c= totalSupply or value \u003c= fromBalance \u003c= totalSupply.\n _totalSupply -= value;\n }\n } else {\n unchecked {\n // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.\n _balances[to] += value;\n }\n }\n\n emit Transfer(from, to, value);\n }\n\n /**\n * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).\n * Relies on the `_update` mechanism\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * NOTE: This function is not virtual, {_update} should be overridden instead.\n */\n function _mint(address account, uint256 value) internal {\n if (account == address(0)) {\n revert ERC20InvalidReceiver(address(0));\n }\n _update(address(0), account, value);\n }\n\n /**\n * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply.\n * Relies on the `_update` mechanism.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * NOTE: This function is not virtual, {_update} should be overridden instead\n */\n function _burn(address account, uint256 value) internal {\n if (account == address(0)) {\n revert ERC20InvalidSender(address(0));\n }\n _update(account, address(0), value);\n }\n\n /**\n * @dev Sets `value` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n *\n * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.\n */\n function _approve(address owner, address spender, uint256 value) internal {\n _approve(owner, spender, value, true);\n }\n\n /**\n * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event.\n *\n * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by\n * `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any\n * `Approval` event during `transferFrom` operations.\n *\n * Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to\n * true using the following override:\n * ```\n * function _approve(address owner, address spender, uint256 value, bool) internal virtual override {\n * super._approve(owner, spender, value, true);\n * }\n * ```\n *\n * Requirements are the same as {_approve}.\n */\n function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {\n if (owner == address(0)) {\n revert ERC20InvalidApprover(address(0));\n }\n if (spender == address(0)) {\n revert ERC20InvalidSpender(address(0));\n }\n _allowances[owner][spender] = value;\n if (emitEvent) {\n emit Approval(owner, spender, value);\n }\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `value`.\n *\n * Does not update the allowance value in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Does not emit an {Approval} event.\n */\n function _spendAllowance(address owner, address spender, uint256 value) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n if (currentAllowance \u003c value) {\n revert ERC20InsufficientAllowance(spender, currentAllowance, value);\n }\n unchecked {\n _approve(owner, spender, currentAllowance - value, false);\n }\n }\n }\n}\n\n// test/MockERC20.sol\n\ncontract MockERC20 is ERC20 {\n uint8 private _decimals;\n\n constructor(string memory name_, uint8 decimals_) ERC20(name_, name_) {\n _decimals = decimals_;\n }\n\n function decimals() public view override returns (uint8) {\n return _decimals;\n }\n\n function burn(address account, uint256 amount) external {\n _burn(account, amount);\n }\n\n function mint(address account, uint256 amount) external {\n _mint(account, amount);\n }\n}\n","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","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":"spender","type":"address"},{"internalType":"uint256","name":"allowance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"ERC20InsufficientAllowance","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"ERC20InsufficientBalance","type":"error"},{"inputs":[{"internalType":"address","name":"approver","type":"address"}],"name":"ERC20InvalidApprover","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC20InvalidReceiver","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"ERC20InvalidSender","type":"error"},{"inputs":[{"internalType":"address","name":"spender","type":"address"}],"name":"ERC20InvalidSpender","type":"error"},{"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":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"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":"Implementation of the {IERC20} interface. This implementation is agnostic to the way tokens are created. This means that a supply mechanism has to be added in a derived contract using {_mint}. TIP: For a detailed writeup see our guide https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How to implement supply mechanisms]. The default value of {decimals} is 18. To change this, you should override this function so it returns a different value. We have followed general OpenZeppelin Contracts guidelines: functions revert instead returning `false` on failure. This behavior is nonetheless conventional and does not conflict with the expectations of ERC20 applications. Additionally, an {Approval} event is emitted on calls to {transferFrom}. This allows applications to reconstruct the allowance for all accounts just by listening to said events. Other implementations of the EIP may not emit these events, as it isn't required by the specification.","errors":{"ERC20InsufficientAllowance(address,uint256,uint256)":[{"details":"Indicates a failure with the `spender`’s `allowance`. Used in transfers.","params":{"allowance":"Amount of tokens a `spender` is allowed to operate with.","needed":"Minimum amount required to perform a transfer.","spender":"Address that may be allowed to operate on tokens without being their owner."}}],"ERC20InsufficientBalance(address,uint256,uint256)":[{"details":"Indicates an error related to the current `balance` of a `sender`. Used in transfers.","params":{"balance":"Current balance for the interacting account.","needed":"Minimum amount required to perform a transfer.","sender":"Address whose tokens are being transferred."}}],"ERC20InvalidApprover(address)":[{"details":"Indicates a failure with the `approver` of a token to be approved. Used in approvals.","params":{"approver":"Address initiating an approval operation."}}],"ERC20InvalidReceiver(address)":[{"details":"Indicates a failure with the token `receiver`. Used in transfers.","params":{"receiver":"Address to which tokens are being transferred."}}],"ERC20InvalidSender(address)":[{"details":"Indicates a failure with the token `sender`. Used in transfers.","params":{"sender":"Address whose tokens are being transferred."}}],"ERC20InvalidSpender(address)":[{"details":"Indicates a failure with the `spender` to be approved. Used in approvals.","params":{"spender":"Address that may be allowed to operate on tokens without being their owner."}}]},"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":"See {IERC20-allowance}."},"approve(address,uint256)":{"details":"See {IERC20-approve}. NOTE: If `value` is the maximum `uint256`, the allowance is not updated on `transferFrom`. This is semantically equivalent to an infinite approval. Requirements: - `spender` cannot be the zero address."},"balanceOf(address)":{"details":"See {IERC20-balanceOf}."},"constructor":{"details":"Sets the values for {name} and {symbol}. All two of these values are immutable: they can only be set once during construction."},"decimals()":{"details":"Returns the number of decimals used to get its user representation. For example, if `decimals` equals `2`, a balance of `505` tokens should be displayed to a user as `5.05` (`505 / 10 ** 2`). Tokens usually opt for a value of 18, imitating the relationship between Ether and Wei. This is the default value returned by this function, unless it's overridden. NOTE: This information is only used for _display_ purposes: it in no way affects any of the arithmetic of the contract, including {IERC20-balanceOf} and {IERC20-transfer}."},"name()":{"details":"Returns the name of the token."},"symbol()":{"details":"Returns the symbol of the token, usually a shorter version of the name."},"totalSupply()":{"details":"See {IERC20-totalSupply}."},"transfer(address,uint256)":{"details":"See {IERC20-transfer}. Requirements: - `to` cannot be the zero address. - the caller must have a balance of at least `value`."},"transferFrom(address,address,uint256)":{"details":"See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}. NOTE: Does not update the allowance if the current allowance is the maximum `uint256`. Requirements: - `from` and `to` cannot be the zero address. - `from` must have a balance of at least `value`. - the caller must have allowance for ``from``'s tokens of at least `value`."}},"version":1},"metadata":"{\"compiler\":{\"version\":\"0.8.20+commit.a1b79de6\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"allowance\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"needed\",\"type\":\"uint256\"}],\"name\":\"ERC20InsufficientAllowance\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"balance\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"needed\",\"type\":\"uint256\"}],\"name\":\"ERC20InsufficientBalance\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"approver\",\"type\":\"address\"}],\"name\":\"ERC20InvalidApprover\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"}],\"name\":\"ERC20InvalidReceiver\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"ERC20InvalidSender\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"}],\"name\":\"ERC20InvalidSpender\",\"type\":\"error\"},{\"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\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"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\":\"Implementation of the {IERC20} interface. This implementation is agnostic to the way tokens are created. This means that a supply mechanism has to be added in a derived contract using {_mint}. TIP: For a detailed writeup see our guide https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How to implement supply mechanisms]. The default value of {decimals} is 18. To change this, you should override this function so it returns a different value. We have followed general OpenZeppelin Contracts guidelines: functions revert instead returning `false` on failure. This behavior is nonetheless conventional and does not conflict with the expectations of ERC20 applications. Additionally, an {Approval} event is emitted on calls to {transferFrom}. This allows applications to reconstruct the allowance for all accounts just by listening to said events. Other implementations of the EIP may not emit these events, as it isn't required by the specification.\",\"errors\":{\"ERC20InsufficientAllowance(address,uint256,uint256)\":[{\"details\":\"Indicates a failure with the `spender`\\u2019s `allowance`. Used in transfers.\",\"params\":{\"allowance\":\"Amount of tokens a `spender` is allowed to operate with.\",\"needed\":\"Minimum amount required to perform a transfer.\",\"spender\":\"Address that may be allowed to operate on tokens without being their owner.\"}}],\"ERC20InsufficientBalance(address,uint256,uint256)\":[{\"details\":\"Indicates an error related to the current `balance` of a `sender`. Used in transfers.\",\"params\":{\"balance\":\"Current balance for the interacting account.\",\"needed\":\"Minimum amount required to perform a transfer.\",\"sender\":\"Address whose tokens are being transferred.\"}}],\"ERC20InvalidApprover(address)\":[{\"details\":\"Indicates a failure with the `approver` of a token to be approved. Used in approvals.\",\"params\":{\"approver\":\"Address initiating an approval operation.\"}}],\"ERC20InvalidReceiver(address)\":[{\"details\":\"Indicates a failure with the token `receiver`. Used in transfers.\",\"params\":{\"receiver\":\"Address to which tokens are being transferred.\"}}],\"ERC20InvalidSender(address)\":[{\"details\":\"Indicates a failure with the token `sender`. Used in transfers.\",\"params\":{\"sender\":\"Address whose tokens are being transferred.\"}}],\"ERC20InvalidSpender(address)\":[{\"details\":\"Indicates a failure with the `spender` to be approved. Used in approvals.\",\"params\":{\"spender\":\"Address that may be allowed to operate on tokens without being their owner.\"}}]},\"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\":\"See {IERC20-allowance}.\"},\"approve(address,uint256)\":{\"details\":\"See {IERC20-approve}. NOTE: If `value` is the maximum `uint256`, the allowance is not updated on `transferFrom`. This is semantically equivalent to an infinite approval. Requirements: - `spender` cannot be the zero address.\"},\"balanceOf(address)\":{\"details\":\"See {IERC20-balanceOf}.\"},\"constructor\":{\"details\":\"Sets the values for {name} and {symbol}. All two of these values are immutable: they can only be set once during construction.\"},\"decimals()\":{\"details\":\"Returns the number of decimals used to get its user representation. For example, if `decimals` equals `2`, a balance of `505` tokens should be displayed to a user as `5.05` (`505 / 10 ** 2`). Tokens usually opt for a value of 18, imitating the relationship between Ether and Wei. This is the default value returned by this function, unless it's overridden. NOTE: This information is only used for _display_ purposes: it in no way affects any of the arithmetic of the contract, including {IERC20-balanceOf} and {IERC20-transfer}.\"},\"name()\":{\"details\":\"Returns the name of the token.\"},\"symbol()\":{\"details\":\"Returns the symbol of the token, usually a shorter version of the name.\"},\"totalSupply()\":{\"details\":\"See {IERC20-totalSupply}.\"},\"transfer(address,uint256)\":{\"details\":\"See {IERC20-transfer}. Requirements: - `to` cannot be the zero address. - the caller must have a balance of at least `value`.\"},\"transferFrom(address,address,uint256)\":{\"details\":\"See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}. NOTE: Does not update the allowance if the current allowance is the maximum `uint256`. Requirements: - `from` and `to` cannot be the zero address. - `from` must have a balance of at least `value`. - the caller must have allowance for ``from``'s tokens of at least `value`.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/MockERC20.sol\":\"ERC20\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/MockERC20.sol\":{\"keccak256\":\"0xd602e791370b799101e4231c18317acecb9b397f92b6786483957405214ae011\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://71377faac66fbd6553967b93c94de35db8f6d710e578d0d4c021064a7a316d4c\",\"dweb:/ipfs/QmNMzNoV8SFKmwsswdmEnhsHKxEaxv9G8sL9eKuA6hEaPr\"]}},\"version\":1}"},"hashes":{"allowance(address,address)":"dd62ed3e","approve(address,uint256)":"095ea7b3","balanceOf(address)":"70a08231","decimals()":"313ce567","name()":"06fdde03","symbol()":"95d89b41","totalSupply()":"18160ddd","transfer(address,uint256)":"a9059cbb","transferFrom(address,address,uint256)":"23b872dd"}},"solidity/MockERC20.sol:IERC1155Errors":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17 ^0.8.20;\n\n// node_modules/@openzeppelin/contracts/interfaces/draft-IERC6093.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol)\n\n/**\n * @dev Standard ERC20 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens.\n */\ninterface IERC20Errors {\n /**\n * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n * @param balance Current balance for the interacting account.\n * @param needed Minimum amount required to perform a transfer.\n */\n error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);\n\n /**\n * @dev Indicates a failure with the token `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n */\n error ERC20InvalidSender(address sender);\n\n /**\n * @dev Indicates a failure with the token `receiver`. Used in transfers.\n * @param receiver Address to which tokens are being transferred.\n */\n error ERC20InvalidReceiver(address receiver);\n\n /**\n * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.\n * @param spender Address that may be allowed to operate on tokens without being their owner.\n * @param allowance Amount of tokens a `spender` is allowed to operate with.\n * @param needed Minimum amount required to perform a transfer.\n */\n error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);\n\n /**\n * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n * @param approver Address initiating an approval operation.\n */\n error ERC20InvalidApprover(address approver);\n\n /**\n * @dev Indicates a failure with the `spender` to be approved. Used in approvals.\n * @param spender Address that may be allowed to operate on tokens without being their owner.\n */\n error ERC20InvalidSpender(address spender);\n}\n\n/**\n * @dev Standard ERC721 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens.\n */\ninterface IERC721Errors {\n /**\n * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20.\n * Used in balance queries.\n * @param owner Address of the current owner of a token.\n */\n error ERC721InvalidOwner(address owner);\n\n /**\n * @dev Indicates a `tokenId` whose `owner` is the zero address.\n * @param tokenId Identifier number of a token.\n */\n error ERC721NonexistentToken(uint256 tokenId);\n\n /**\n * @dev Indicates an error related to the ownership over a particular token. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n * @param tokenId Identifier number of a token.\n * @param owner Address of the current owner of a token.\n */\n error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);\n\n /**\n * @dev Indicates a failure with the token `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n */\n error ERC721InvalidSender(address sender);\n\n /**\n * @dev Indicates a failure with the token `receiver`. Used in transfers.\n * @param receiver Address to which tokens are being transferred.\n */\n error ERC721InvalidReceiver(address receiver);\n\n /**\n * @dev Indicates a failure with the `operator`’s approval. Used in transfers.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n * @param tokenId Identifier number of a token.\n */\n error ERC721InsufficientApproval(address operator, uint256 tokenId);\n\n /**\n * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n * @param approver Address initiating an approval operation.\n */\n error ERC721InvalidApprover(address approver);\n\n /**\n * @dev Indicates a failure with the `operator` to be approved. Used in approvals.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n */\n error ERC721InvalidOperator(address operator);\n}\n\n/**\n * @dev Standard ERC1155 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens.\n */\ninterface IERC1155Errors {\n /**\n * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n * @param balance Current balance for the interacting account.\n * @param needed Minimum amount required to perform a transfer.\n * @param tokenId Identifier number of a token.\n */\n error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);\n\n /**\n * @dev Indicates a failure with the token `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n */\n error ERC1155InvalidSender(address sender);\n\n /**\n * @dev Indicates a failure with the token `receiver`. Used in transfers.\n * @param receiver Address to which tokens are being transferred.\n */\n error ERC1155InvalidReceiver(address receiver);\n\n /**\n * @dev Indicates a failure with the `operator`’s approval. Used in transfers.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n * @param owner Address of the current owner of a token.\n */\n error ERC1155MissingApprovalForAll(address operator, address owner);\n\n /**\n * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n * @param approver Address initiating an approval operation.\n */\n error ERC1155InvalidApprover(address approver);\n\n /**\n * @dev Indicates a failure with the `operator` to be approved. Used in approvals.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n */\n error ERC1155InvalidOperator(address operator);\n\n /**\n * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.\n * Used in batch transfers.\n * @param idsLength Length of the array of token identifiers\n * @param valuesLength Length of the array of token amounts\n */\n error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);\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/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/token/ERC20/extensions/IERC20Metadata.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol)\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n\n// node_modules/@openzeppelin/contracts/token/ERC20/ERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/ERC20.sol)\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * The default value of {decimals} is 18. To change this, you should override\n * this function so it returns a different value.\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n */\nabstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors {\n mapping(address account =\u003e uint256) private _balances;\n\n mapping(address account =\u003e mapping(address spender =\u003e uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the default value returned by this function, unless\n * it's overridden.\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `value`.\n */\n function transfer(address to, uint256 value) public virtual returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, value);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 value) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, value);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `value`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `value`.\n */\n function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, value);\n _transfer(from, to, value);\n return true;\n }\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * NOTE: This function is not virtual, {_update} should be overridden instead.\n */\n function _transfer(address from, address to, uint256 value) internal {\n if (from == address(0)) {\n revert ERC20InvalidSender(address(0));\n }\n if (to == address(0)) {\n revert ERC20InvalidReceiver(address(0));\n }\n _update(from, to, value);\n }\n\n /**\n * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from`\n * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding\n * this function.\n *\n * Emits a {Transfer} event.\n */\n function _update(address from, address to, uint256 value) internal virtual {\n if (from == address(0)) {\n // Overflow check required: The rest of the code assumes that totalSupply never overflows\n _totalSupply += value;\n } else {\n uint256 fromBalance = _balances[from];\n if (fromBalance \u003c value) {\n revert ERC20InsufficientBalance(from, fromBalance, value);\n }\n unchecked {\n // Overflow not possible: value \u003c= fromBalance \u003c= totalSupply.\n _balances[from] = fromBalance - value;\n }\n }\n\n if (to == address(0)) {\n unchecked {\n // Overflow not possible: value \u003c= totalSupply or value \u003c= fromBalance \u003c= totalSupply.\n _totalSupply -= value;\n }\n } else {\n unchecked {\n // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.\n _balances[to] += value;\n }\n }\n\n emit Transfer(from, to, value);\n }\n\n /**\n * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).\n * Relies on the `_update` mechanism\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * NOTE: This function is not virtual, {_update} should be overridden instead.\n */\n function _mint(address account, uint256 value) internal {\n if (account == address(0)) {\n revert ERC20InvalidReceiver(address(0));\n }\n _update(address(0), account, value);\n }\n\n /**\n * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply.\n * Relies on the `_update` mechanism.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * NOTE: This function is not virtual, {_update} should be overridden instead\n */\n function _burn(address account, uint256 value) internal {\n if (account == address(0)) {\n revert ERC20InvalidSender(address(0));\n }\n _update(account, address(0), value);\n }\n\n /**\n * @dev Sets `value` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n *\n * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.\n */\n function _approve(address owner, address spender, uint256 value) internal {\n _approve(owner, spender, value, true);\n }\n\n /**\n * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event.\n *\n * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by\n * `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any\n * `Approval` event during `transferFrom` operations.\n *\n * Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to\n * true using the following override:\n * ```\n * function _approve(address owner, address spender, uint256 value, bool) internal virtual override {\n * super._approve(owner, spender, value, true);\n * }\n * ```\n *\n * Requirements are the same as {_approve}.\n */\n function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {\n if (owner == address(0)) {\n revert ERC20InvalidApprover(address(0));\n }\n if (spender == address(0)) {\n revert ERC20InvalidSpender(address(0));\n }\n _allowances[owner][spender] = value;\n if (emitEvent) {\n emit Approval(owner, spender, value);\n }\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `value`.\n *\n * Does not update the allowance value in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Does not emit an {Approval} event.\n */\n function _spendAllowance(address owner, address spender, uint256 value) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n if (currentAllowance \u003c value) {\n revert ERC20InsufficientAllowance(spender, currentAllowance, value);\n }\n unchecked {\n _approve(owner, spender, currentAllowance - value, false);\n }\n }\n }\n}\n\n// test/MockERC20.sol\n\ncontract MockERC20 is ERC20 {\n uint8 private _decimals;\n\n constructor(string memory name_, uint8 decimals_) ERC20(name_, name_) {\n _decimals = decimals_;\n }\n\n function decimals() public view override returns (uint8) {\n return _decimals;\n }\n\n function burn(address account, uint256 amount) external {\n _burn(account, amount);\n }\n\n function mint(address account, uint256 amount) external {\n _mint(account, amount);\n }\n}\n","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","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":"sender","type":"address"},{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ERC1155InsufficientBalance","type":"error"},{"inputs":[{"internalType":"address","name":"approver","type":"address"}],"name":"ERC1155InvalidApprover","type":"error"},{"inputs":[{"internalType":"uint256","name":"idsLength","type":"uint256"},{"internalType":"uint256","name":"valuesLength","type":"uint256"}],"name":"ERC1155InvalidArrayLength","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"ERC1155InvalidOperator","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC1155InvalidReceiver","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"ERC1155InvalidSender","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"address","name":"owner","type":"address"}],"name":"ERC1155MissingApprovalForAll","type":"error"}],"userDoc":{"kind":"user","methods":{},"version":1},"developerDoc":{"details":"Standard ERC1155 Errors Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens.","errors":{"ERC1155InsufficientBalance(address,uint256,uint256,uint256)":[{"details":"Indicates an error related to the current `balance` of a `sender`. Used in transfers.","params":{"balance":"Current balance for the interacting account.","needed":"Minimum amount required to perform a transfer.","sender":"Address whose tokens are being transferred.","tokenId":"Identifier number of a token."}}],"ERC1155InvalidApprover(address)":[{"details":"Indicates a failure with the `approver` of a token to be approved. Used in approvals.","params":{"approver":"Address initiating an approval operation."}}],"ERC1155InvalidArrayLength(uint256,uint256)":[{"details":"Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation. Used in batch transfers.","params":{"idsLength":"Length of the array of token identifiers","valuesLength":"Length of the array of token amounts"}}],"ERC1155InvalidOperator(address)":[{"details":"Indicates a failure with the `operator` to be approved. Used in approvals.","params":{"operator":"Address that may be allowed to operate on tokens without being their owner."}}],"ERC1155InvalidReceiver(address)":[{"details":"Indicates a failure with the token `receiver`. Used in transfers.","params":{"receiver":"Address to which tokens are being transferred."}}],"ERC1155InvalidSender(address)":[{"details":"Indicates a failure with the token `sender`. Used in transfers.","params":{"sender":"Address whose tokens are being transferred."}}],"ERC1155MissingApprovalForAll(address,address)":[{"details":"Indicates a failure with the `operator`’s approval. Used in transfers.","params":{"operator":"Address that may be allowed to operate on tokens without being their owner.","owner":"Address of the current owner of a token."}}]},"kind":"dev","methods":{},"version":1},"metadata":"{\"compiler\":{\"version\":\"0.8.20+commit.a1b79de6\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"balance\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"needed\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"ERC1155InsufficientBalance\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"approver\",\"type\":\"address\"}],\"name\":\"ERC1155InvalidApprover\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"idsLength\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"valuesLength\",\"type\":\"uint256\"}],\"name\":\"ERC1155InvalidArrayLength\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"ERC1155InvalidOperator\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"}],\"name\":\"ERC1155InvalidReceiver\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"ERC1155InvalidSender\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"ERC1155MissingApprovalForAll\",\"type\":\"error\"}],\"devdoc\":{\"details\":\"Standard ERC1155 Errors Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens.\",\"errors\":{\"ERC1155InsufficientBalance(address,uint256,uint256,uint256)\":[{\"details\":\"Indicates an error related to the current `balance` of a `sender`. Used in transfers.\",\"params\":{\"balance\":\"Current balance for the interacting account.\",\"needed\":\"Minimum amount required to perform a transfer.\",\"sender\":\"Address whose tokens are being transferred.\",\"tokenId\":\"Identifier number of a token.\"}}],\"ERC1155InvalidApprover(address)\":[{\"details\":\"Indicates a failure with the `approver` of a token to be approved. Used in approvals.\",\"params\":{\"approver\":\"Address initiating an approval operation.\"}}],\"ERC1155InvalidArrayLength(uint256,uint256)\":[{\"details\":\"Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation. Used in batch transfers.\",\"params\":{\"idsLength\":\"Length of the array of token identifiers\",\"valuesLength\":\"Length of the array of token amounts\"}}],\"ERC1155InvalidOperator(address)\":[{\"details\":\"Indicates a failure with the `operator` to be approved. Used in approvals.\",\"params\":{\"operator\":\"Address that may be allowed to operate on tokens without being their owner.\"}}],\"ERC1155InvalidReceiver(address)\":[{\"details\":\"Indicates a failure with the token `receiver`. Used in transfers.\",\"params\":{\"receiver\":\"Address to which tokens are being transferred.\"}}],\"ERC1155InvalidSender(address)\":[{\"details\":\"Indicates a failure with the token `sender`. Used in transfers.\",\"params\":{\"sender\":\"Address whose tokens are being transferred.\"}}],\"ERC1155MissingApprovalForAll(address,address)\":[{\"details\":\"Indicates a failure with the `operator`\\u2019s approval. Used in transfers.\",\"params\":{\"operator\":\"Address that may be allowed to operate on tokens without being their owner.\",\"owner\":\"Address of the current owner of a token.\"}}]},\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/MockERC20.sol\":\"IERC1155Errors\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/MockERC20.sol\":{\"keccak256\":\"0xd602e791370b799101e4231c18317acecb9b397f92b6786483957405214ae011\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://71377faac66fbd6553967b93c94de35db8f6d710e578d0d4c021064a7a316d4c\",\"dweb:/ipfs/QmNMzNoV8SFKmwsswdmEnhsHKxEaxv9G8sL9eKuA6hEaPr\"]}},\"version\":1}"},"hashes":{}},"solidity/MockERC20.sol:IERC20":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17 ^0.8.20;\n\n// node_modules/@openzeppelin/contracts/interfaces/draft-IERC6093.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol)\n\n/**\n * @dev Standard ERC20 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens.\n */\ninterface IERC20Errors {\n /**\n * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n * @param balance Current balance for the interacting account.\n * @param needed Minimum amount required to perform a transfer.\n */\n error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);\n\n /**\n * @dev Indicates a failure with the token `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n */\n error ERC20InvalidSender(address sender);\n\n /**\n * @dev Indicates a failure with the token `receiver`. Used in transfers.\n * @param receiver Address to which tokens are being transferred.\n */\n error ERC20InvalidReceiver(address receiver);\n\n /**\n * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.\n * @param spender Address that may be allowed to operate on tokens without being their owner.\n * @param allowance Amount of tokens a `spender` is allowed to operate with.\n * @param needed Minimum amount required to perform a transfer.\n */\n error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);\n\n /**\n * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n * @param approver Address initiating an approval operation.\n */\n error ERC20InvalidApprover(address approver);\n\n /**\n * @dev Indicates a failure with the `spender` to be approved. Used in approvals.\n * @param spender Address that may be allowed to operate on tokens without being their owner.\n */\n error ERC20InvalidSpender(address spender);\n}\n\n/**\n * @dev Standard ERC721 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens.\n */\ninterface IERC721Errors {\n /**\n * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20.\n * Used in balance queries.\n * @param owner Address of the current owner of a token.\n */\n error ERC721InvalidOwner(address owner);\n\n /**\n * @dev Indicates a `tokenId` whose `owner` is the zero address.\n * @param tokenId Identifier number of a token.\n */\n error ERC721NonexistentToken(uint256 tokenId);\n\n /**\n * @dev Indicates an error related to the ownership over a particular token. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n * @param tokenId Identifier number of a token.\n * @param owner Address of the current owner of a token.\n */\n error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);\n\n /**\n * @dev Indicates a failure with the token `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n */\n error ERC721InvalidSender(address sender);\n\n /**\n * @dev Indicates a failure with the token `receiver`. Used in transfers.\n * @param receiver Address to which tokens are being transferred.\n */\n error ERC721InvalidReceiver(address receiver);\n\n /**\n * @dev Indicates a failure with the `operator`’s approval. Used in transfers.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n * @param tokenId Identifier number of a token.\n */\n error ERC721InsufficientApproval(address operator, uint256 tokenId);\n\n /**\n * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n * @param approver Address initiating an approval operation.\n */\n error ERC721InvalidApprover(address approver);\n\n /**\n * @dev Indicates a failure with the `operator` to be approved. Used in approvals.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n */\n error ERC721InvalidOperator(address operator);\n}\n\n/**\n * @dev Standard ERC1155 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens.\n */\ninterface IERC1155Errors {\n /**\n * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n * @param balance Current balance for the interacting account.\n * @param needed Minimum amount required to perform a transfer.\n * @param tokenId Identifier number of a token.\n */\n error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);\n\n /**\n * @dev Indicates a failure with the token `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n */\n error ERC1155InvalidSender(address sender);\n\n /**\n * @dev Indicates a failure with the token `receiver`. Used in transfers.\n * @param receiver Address to which tokens are being transferred.\n */\n error ERC1155InvalidReceiver(address receiver);\n\n /**\n * @dev Indicates a failure with the `operator`’s approval. Used in transfers.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n * @param owner Address of the current owner of a token.\n */\n error ERC1155MissingApprovalForAll(address operator, address owner);\n\n /**\n * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n * @param approver Address initiating an approval operation.\n */\n error ERC1155InvalidApprover(address approver);\n\n /**\n * @dev Indicates a failure with the `operator` to be approved. Used in approvals.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n */\n error ERC1155InvalidOperator(address operator);\n\n /**\n * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.\n * Used in batch transfers.\n * @param idsLength Length of the array of token identifiers\n * @param valuesLength Length of the array of token amounts\n */\n error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);\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/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/token/ERC20/extensions/IERC20Metadata.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol)\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n\n// node_modules/@openzeppelin/contracts/token/ERC20/ERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/ERC20.sol)\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * The default value of {decimals} is 18. To change this, you should override\n * this function so it returns a different value.\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n */\nabstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors {\n mapping(address account =\u003e uint256) private _balances;\n\n mapping(address account =\u003e mapping(address spender =\u003e uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the default value returned by this function, unless\n * it's overridden.\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `value`.\n */\n function transfer(address to, uint256 value) public virtual returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, value);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 value) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, value);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `value`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `value`.\n */\n function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, value);\n _transfer(from, to, value);\n return true;\n }\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * NOTE: This function is not virtual, {_update} should be overridden instead.\n */\n function _transfer(address from, address to, uint256 value) internal {\n if (from == address(0)) {\n revert ERC20InvalidSender(address(0));\n }\n if (to == address(0)) {\n revert ERC20InvalidReceiver(address(0));\n }\n _update(from, to, value);\n }\n\n /**\n * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from`\n * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding\n * this function.\n *\n * Emits a {Transfer} event.\n */\n function _update(address from, address to, uint256 value) internal virtual {\n if (from == address(0)) {\n // Overflow check required: The rest of the code assumes that totalSupply never overflows\n _totalSupply += value;\n } else {\n uint256 fromBalance = _balances[from];\n if (fromBalance \u003c value) {\n revert ERC20InsufficientBalance(from, fromBalance, value);\n }\n unchecked {\n // Overflow not possible: value \u003c= fromBalance \u003c= totalSupply.\n _balances[from] = fromBalance - value;\n }\n }\n\n if (to == address(0)) {\n unchecked {\n // Overflow not possible: value \u003c= totalSupply or value \u003c= fromBalance \u003c= totalSupply.\n _totalSupply -= value;\n }\n } else {\n unchecked {\n // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.\n _balances[to] += value;\n }\n }\n\n emit Transfer(from, to, value);\n }\n\n /**\n * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).\n * Relies on the `_update` mechanism\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * NOTE: This function is not virtual, {_update} should be overridden instead.\n */\n function _mint(address account, uint256 value) internal {\n if (account == address(0)) {\n revert ERC20InvalidReceiver(address(0));\n }\n _update(address(0), account, value);\n }\n\n /**\n * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply.\n * Relies on the `_update` mechanism.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * NOTE: This function is not virtual, {_update} should be overridden instead\n */\n function _burn(address account, uint256 value) internal {\n if (account == address(0)) {\n revert ERC20InvalidSender(address(0));\n }\n _update(account, address(0), value);\n }\n\n /**\n * @dev Sets `value` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n *\n * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.\n */\n function _approve(address owner, address spender, uint256 value) internal {\n _approve(owner, spender, value, true);\n }\n\n /**\n * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event.\n *\n * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by\n * `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any\n * `Approval` event during `transferFrom` operations.\n *\n * Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to\n * true using the following override:\n * ```\n * function _approve(address owner, address spender, uint256 value, bool) internal virtual override {\n * super._approve(owner, spender, value, true);\n * }\n * ```\n *\n * Requirements are the same as {_approve}.\n */\n function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {\n if (owner == address(0)) {\n revert ERC20InvalidApprover(address(0));\n }\n if (spender == address(0)) {\n revert ERC20InvalidSpender(address(0));\n }\n _allowances[owner][spender] = value;\n if (emitEvent) {\n emit Approval(owner, spender, value);\n }\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `value`.\n *\n * Does not update the allowance value in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Does not emit an {Approval} event.\n */\n function _spendAllowance(address owner, address spender, uint256 value) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n if (currentAllowance \u003c value) {\n revert ERC20InsufficientAllowance(spender, currentAllowance, value);\n }\n unchecked {\n _approve(owner, spender, currentAllowance - value, false);\n }\n }\n }\n}\n\n// test/MockERC20.sol\n\ncontract MockERC20 is ERC20 {\n uint8 private _decimals;\n\n constructor(string memory name_, uint8 decimals_) ERC20(name_, name_) {\n _decimals = decimals_;\n }\n\n function decimals() public view override returns (uint8) {\n return _decimals;\n }\n\n function burn(address account, uint256 amount) external {\n _burn(account, amount);\n }\n\n function mint(address account, uint256 amount) external {\n _mint(account, amount);\n }\n}\n","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","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.20+commit.a1b79de6\"},\"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/MockERC20.sol\":\"IERC20\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/MockERC20.sol\":{\"keccak256\":\"0xd602e791370b799101e4231c18317acecb9b397f92b6786483957405214ae011\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://71377faac66fbd6553967b93c94de35db8f6d710e578d0d4c021064a7a316d4c\",\"dweb:/ipfs/QmNMzNoV8SFKmwsswdmEnhsHKxEaxv9G8sL9eKuA6hEaPr\"]}},\"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/MockERC20.sol:IERC20Errors":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17 ^0.8.20;\n\n// node_modules/@openzeppelin/contracts/interfaces/draft-IERC6093.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol)\n\n/**\n * @dev Standard ERC20 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens.\n */\ninterface IERC20Errors {\n /**\n * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n * @param balance Current balance for the interacting account.\n * @param needed Minimum amount required to perform a transfer.\n */\n error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);\n\n /**\n * @dev Indicates a failure with the token `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n */\n error ERC20InvalidSender(address sender);\n\n /**\n * @dev Indicates a failure with the token `receiver`. Used in transfers.\n * @param receiver Address to which tokens are being transferred.\n */\n error ERC20InvalidReceiver(address receiver);\n\n /**\n * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.\n * @param spender Address that may be allowed to operate on tokens without being their owner.\n * @param allowance Amount of tokens a `spender` is allowed to operate with.\n * @param needed Minimum amount required to perform a transfer.\n */\n error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);\n\n /**\n * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n * @param approver Address initiating an approval operation.\n */\n error ERC20InvalidApprover(address approver);\n\n /**\n * @dev Indicates a failure with the `spender` to be approved. Used in approvals.\n * @param spender Address that may be allowed to operate on tokens without being their owner.\n */\n error ERC20InvalidSpender(address spender);\n}\n\n/**\n * @dev Standard ERC721 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens.\n */\ninterface IERC721Errors {\n /**\n * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20.\n * Used in balance queries.\n * @param owner Address of the current owner of a token.\n */\n error ERC721InvalidOwner(address owner);\n\n /**\n * @dev Indicates a `tokenId` whose `owner` is the zero address.\n * @param tokenId Identifier number of a token.\n */\n error ERC721NonexistentToken(uint256 tokenId);\n\n /**\n * @dev Indicates an error related to the ownership over a particular token. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n * @param tokenId Identifier number of a token.\n * @param owner Address of the current owner of a token.\n */\n error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);\n\n /**\n * @dev Indicates a failure with the token `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n */\n error ERC721InvalidSender(address sender);\n\n /**\n * @dev Indicates a failure with the token `receiver`. Used in transfers.\n * @param receiver Address to which tokens are being transferred.\n */\n error ERC721InvalidReceiver(address receiver);\n\n /**\n * @dev Indicates a failure with the `operator`’s approval. Used in transfers.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n * @param tokenId Identifier number of a token.\n */\n error ERC721InsufficientApproval(address operator, uint256 tokenId);\n\n /**\n * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n * @param approver Address initiating an approval operation.\n */\n error ERC721InvalidApprover(address approver);\n\n /**\n * @dev Indicates a failure with the `operator` to be approved. Used in approvals.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n */\n error ERC721InvalidOperator(address operator);\n}\n\n/**\n * @dev Standard ERC1155 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens.\n */\ninterface IERC1155Errors {\n /**\n * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n * @param balance Current balance for the interacting account.\n * @param needed Minimum amount required to perform a transfer.\n * @param tokenId Identifier number of a token.\n */\n error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);\n\n /**\n * @dev Indicates a failure with the token `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n */\n error ERC1155InvalidSender(address sender);\n\n /**\n * @dev Indicates a failure with the token `receiver`. Used in transfers.\n * @param receiver Address to which tokens are being transferred.\n */\n error ERC1155InvalidReceiver(address receiver);\n\n /**\n * @dev Indicates a failure with the `operator`’s approval. Used in transfers.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n * @param owner Address of the current owner of a token.\n */\n error ERC1155MissingApprovalForAll(address operator, address owner);\n\n /**\n * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n * @param approver Address initiating an approval operation.\n */\n error ERC1155InvalidApprover(address approver);\n\n /**\n * @dev Indicates a failure with the `operator` to be approved. Used in approvals.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n */\n error ERC1155InvalidOperator(address operator);\n\n /**\n * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.\n * Used in batch transfers.\n * @param idsLength Length of the array of token identifiers\n * @param valuesLength Length of the array of token amounts\n */\n error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);\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/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/token/ERC20/extensions/IERC20Metadata.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol)\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n\n// node_modules/@openzeppelin/contracts/token/ERC20/ERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/ERC20.sol)\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * The default value of {decimals} is 18. To change this, you should override\n * this function so it returns a different value.\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n */\nabstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors {\n mapping(address account =\u003e uint256) private _balances;\n\n mapping(address account =\u003e mapping(address spender =\u003e uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the default value returned by this function, unless\n * it's overridden.\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `value`.\n */\n function transfer(address to, uint256 value) public virtual returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, value);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 value) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, value);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `value`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `value`.\n */\n function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, value);\n _transfer(from, to, value);\n return true;\n }\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * NOTE: This function is not virtual, {_update} should be overridden instead.\n */\n function _transfer(address from, address to, uint256 value) internal {\n if (from == address(0)) {\n revert ERC20InvalidSender(address(0));\n }\n if (to == address(0)) {\n revert ERC20InvalidReceiver(address(0));\n }\n _update(from, to, value);\n }\n\n /**\n * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from`\n * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding\n * this function.\n *\n * Emits a {Transfer} event.\n */\n function _update(address from, address to, uint256 value) internal virtual {\n if (from == address(0)) {\n // Overflow check required: The rest of the code assumes that totalSupply never overflows\n _totalSupply += value;\n } else {\n uint256 fromBalance = _balances[from];\n if (fromBalance \u003c value) {\n revert ERC20InsufficientBalance(from, fromBalance, value);\n }\n unchecked {\n // Overflow not possible: value \u003c= fromBalance \u003c= totalSupply.\n _balances[from] = fromBalance - value;\n }\n }\n\n if (to == address(0)) {\n unchecked {\n // Overflow not possible: value \u003c= totalSupply or value \u003c= fromBalance \u003c= totalSupply.\n _totalSupply -= value;\n }\n } else {\n unchecked {\n // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.\n _balances[to] += value;\n }\n }\n\n emit Transfer(from, to, value);\n }\n\n /**\n * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).\n * Relies on the `_update` mechanism\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * NOTE: This function is not virtual, {_update} should be overridden instead.\n */\n function _mint(address account, uint256 value) internal {\n if (account == address(0)) {\n revert ERC20InvalidReceiver(address(0));\n }\n _update(address(0), account, value);\n }\n\n /**\n * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply.\n * Relies on the `_update` mechanism.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * NOTE: This function is not virtual, {_update} should be overridden instead\n */\n function _burn(address account, uint256 value) internal {\n if (account == address(0)) {\n revert ERC20InvalidSender(address(0));\n }\n _update(account, address(0), value);\n }\n\n /**\n * @dev Sets `value` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n *\n * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.\n */\n function _approve(address owner, address spender, uint256 value) internal {\n _approve(owner, spender, value, true);\n }\n\n /**\n * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event.\n *\n * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by\n * `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any\n * `Approval` event during `transferFrom` operations.\n *\n * Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to\n * true using the following override:\n * ```\n * function _approve(address owner, address spender, uint256 value, bool) internal virtual override {\n * super._approve(owner, spender, value, true);\n * }\n * ```\n *\n * Requirements are the same as {_approve}.\n */\n function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {\n if (owner == address(0)) {\n revert ERC20InvalidApprover(address(0));\n }\n if (spender == address(0)) {\n revert ERC20InvalidSpender(address(0));\n }\n _allowances[owner][spender] = value;\n if (emitEvent) {\n emit Approval(owner, spender, value);\n }\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `value`.\n *\n * Does not update the allowance value in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Does not emit an {Approval} event.\n */\n function _spendAllowance(address owner, address spender, uint256 value) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n if (currentAllowance \u003c value) {\n revert ERC20InsufficientAllowance(spender, currentAllowance, value);\n }\n unchecked {\n _approve(owner, spender, currentAllowance - value, false);\n }\n }\n }\n}\n\n// test/MockERC20.sol\n\ncontract MockERC20 is ERC20 {\n uint8 private _decimals;\n\n constructor(string memory name_, uint8 decimals_) ERC20(name_, name_) {\n _decimals = decimals_;\n }\n\n function decimals() public view override returns (uint8) {\n return _decimals;\n }\n\n function burn(address account, uint256 amount) external {\n _burn(account, amount);\n }\n\n function mint(address account, uint256 amount) external {\n _mint(account, amount);\n }\n}\n","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","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":"spender","type":"address"},{"internalType":"uint256","name":"allowance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"ERC20InsufficientAllowance","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"ERC20InsufficientBalance","type":"error"},{"inputs":[{"internalType":"address","name":"approver","type":"address"}],"name":"ERC20InvalidApprover","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC20InvalidReceiver","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"ERC20InvalidSender","type":"error"},{"inputs":[{"internalType":"address","name":"spender","type":"address"}],"name":"ERC20InvalidSpender","type":"error"}],"userDoc":{"kind":"user","methods":{},"version":1},"developerDoc":{"details":"Standard ERC20 Errors Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens.","errors":{"ERC20InsufficientAllowance(address,uint256,uint256)":[{"details":"Indicates a failure with the `spender`’s `allowance`. Used in transfers.","params":{"allowance":"Amount of tokens a `spender` is allowed to operate with.","needed":"Minimum amount required to perform a transfer.","spender":"Address that may be allowed to operate on tokens without being their owner."}}],"ERC20InsufficientBalance(address,uint256,uint256)":[{"details":"Indicates an error related to the current `balance` of a `sender`. Used in transfers.","params":{"balance":"Current balance for the interacting account.","needed":"Minimum amount required to perform a transfer.","sender":"Address whose tokens are being transferred."}}],"ERC20InvalidApprover(address)":[{"details":"Indicates a failure with the `approver` of a token to be approved. Used in approvals.","params":{"approver":"Address initiating an approval operation."}}],"ERC20InvalidReceiver(address)":[{"details":"Indicates a failure with the token `receiver`. Used in transfers.","params":{"receiver":"Address to which tokens are being transferred."}}],"ERC20InvalidSender(address)":[{"details":"Indicates a failure with the token `sender`. Used in transfers.","params":{"sender":"Address whose tokens are being transferred."}}],"ERC20InvalidSpender(address)":[{"details":"Indicates a failure with the `spender` to be approved. Used in approvals.","params":{"spender":"Address that may be allowed to operate on tokens without being their owner."}}]},"kind":"dev","methods":{},"version":1},"metadata":"{\"compiler\":{\"version\":\"0.8.20+commit.a1b79de6\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"allowance\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"needed\",\"type\":\"uint256\"}],\"name\":\"ERC20InsufficientAllowance\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"balance\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"needed\",\"type\":\"uint256\"}],\"name\":\"ERC20InsufficientBalance\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"approver\",\"type\":\"address\"}],\"name\":\"ERC20InvalidApprover\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"}],\"name\":\"ERC20InvalidReceiver\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"ERC20InvalidSender\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"}],\"name\":\"ERC20InvalidSpender\",\"type\":\"error\"}],\"devdoc\":{\"details\":\"Standard ERC20 Errors Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens.\",\"errors\":{\"ERC20InsufficientAllowance(address,uint256,uint256)\":[{\"details\":\"Indicates a failure with the `spender`\\u2019s `allowance`. Used in transfers.\",\"params\":{\"allowance\":\"Amount of tokens a `spender` is allowed to operate with.\",\"needed\":\"Minimum amount required to perform a transfer.\",\"spender\":\"Address that may be allowed to operate on tokens without being their owner.\"}}],\"ERC20InsufficientBalance(address,uint256,uint256)\":[{\"details\":\"Indicates an error related to the current `balance` of a `sender`. Used in transfers.\",\"params\":{\"balance\":\"Current balance for the interacting account.\",\"needed\":\"Minimum amount required to perform a transfer.\",\"sender\":\"Address whose tokens are being transferred.\"}}],\"ERC20InvalidApprover(address)\":[{\"details\":\"Indicates a failure with the `approver` of a token to be approved. Used in approvals.\",\"params\":{\"approver\":\"Address initiating an approval operation.\"}}],\"ERC20InvalidReceiver(address)\":[{\"details\":\"Indicates a failure with the token `receiver`. Used in transfers.\",\"params\":{\"receiver\":\"Address to which tokens are being transferred.\"}}],\"ERC20InvalidSender(address)\":[{\"details\":\"Indicates a failure with the token `sender`. Used in transfers.\",\"params\":{\"sender\":\"Address whose tokens are being transferred.\"}}],\"ERC20InvalidSpender(address)\":[{\"details\":\"Indicates a failure with the `spender` to be approved. Used in approvals.\",\"params\":{\"spender\":\"Address that may be allowed to operate on tokens without being their owner.\"}}]},\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/MockERC20.sol\":\"IERC20Errors\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/MockERC20.sol\":{\"keccak256\":\"0xd602e791370b799101e4231c18317acecb9b397f92b6786483957405214ae011\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://71377faac66fbd6553967b93c94de35db8f6d710e578d0d4c021064a7a316d4c\",\"dweb:/ipfs/QmNMzNoV8SFKmwsswdmEnhsHKxEaxv9G8sL9eKuA6hEaPr\"]}},\"version\":1}"},"hashes":{}},"solidity/MockERC20.sol:IERC20Metadata":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17 ^0.8.20;\n\n// node_modules/@openzeppelin/contracts/interfaces/draft-IERC6093.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol)\n\n/**\n * @dev Standard ERC20 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens.\n */\ninterface IERC20Errors {\n /**\n * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n * @param balance Current balance for the interacting account.\n * @param needed Minimum amount required to perform a transfer.\n */\n error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);\n\n /**\n * @dev Indicates a failure with the token `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n */\n error ERC20InvalidSender(address sender);\n\n /**\n * @dev Indicates a failure with the token `receiver`. Used in transfers.\n * @param receiver Address to which tokens are being transferred.\n */\n error ERC20InvalidReceiver(address receiver);\n\n /**\n * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.\n * @param spender Address that may be allowed to operate on tokens without being their owner.\n * @param allowance Amount of tokens a `spender` is allowed to operate with.\n * @param needed Minimum amount required to perform a transfer.\n */\n error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);\n\n /**\n * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n * @param approver Address initiating an approval operation.\n */\n error ERC20InvalidApprover(address approver);\n\n /**\n * @dev Indicates a failure with the `spender` to be approved. Used in approvals.\n * @param spender Address that may be allowed to operate on tokens without being their owner.\n */\n error ERC20InvalidSpender(address spender);\n}\n\n/**\n * @dev Standard ERC721 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens.\n */\ninterface IERC721Errors {\n /**\n * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20.\n * Used in balance queries.\n * @param owner Address of the current owner of a token.\n */\n error ERC721InvalidOwner(address owner);\n\n /**\n * @dev Indicates a `tokenId` whose `owner` is the zero address.\n * @param tokenId Identifier number of a token.\n */\n error ERC721NonexistentToken(uint256 tokenId);\n\n /**\n * @dev Indicates an error related to the ownership over a particular token. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n * @param tokenId Identifier number of a token.\n * @param owner Address of the current owner of a token.\n */\n error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);\n\n /**\n * @dev Indicates a failure with the token `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n */\n error ERC721InvalidSender(address sender);\n\n /**\n * @dev Indicates a failure with the token `receiver`. Used in transfers.\n * @param receiver Address to which tokens are being transferred.\n */\n error ERC721InvalidReceiver(address receiver);\n\n /**\n * @dev Indicates a failure with the `operator`’s approval. Used in transfers.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n * @param tokenId Identifier number of a token.\n */\n error ERC721InsufficientApproval(address operator, uint256 tokenId);\n\n /**\n * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n * @param approver Address initiating an approval operation.\n */\n error ERC721InvalidApprover(address approver);\n\n /**\n * @dev Indicates a failure with the `operator` to be approved. Used in approvals.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n */\n error ERC721InvalidOperator(address operator);\n}\n\n/**\n * @dev Standard ERC1155 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens.\n */\ninterface IERC1155Errors {\n /**\n * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n * @param balance Current balance for the interacting account.\n * @param needed Minimum amount required to perform a transfer.\n * @param tokenId Identifier number of a token.\n */\n error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);\n\n /**\n * @dev Indicates a failure with the token `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n */\n error ERC1155InvalidSender(address sender);\n\n /**\n * @dev Indicates a failure with the token `receiver`. Used in transfers.\n * @param receiver Address to which tokens are being transferred.\n */\n error ERC1155InvalidReceiver(address receiver);\n\n /**\n * @dev Indicates a failure with the `operator`’s approval. Used in transfers.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n * @param owner Address of the current owner of a token.\n */\n error ERC1155MissingApprovalForAll(address operator, address owner);\n\n /**\n * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n * @param approver Address initiating an approval operation.\n */\n error ERC1155InvalidApprover(address approver);\n\n /**\n * @dev Indicates a failure with the `operator` to be approved. Used in approvals.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n */\n error ERC1155InvalidOperator(address operator);\n\n /**\n * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.\n * Used in batch transfers.\n * @param idsLength Length of the array of token identifiers\n * @param valuesLength Length of the array of token amounts\n */\n error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);\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/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/token/ERC20/extensions/IERC20Metadata.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol)\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n\n// node_modules/@openzeppelin/contracts/token/ERC20/ERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/ERC20.sol)\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * The default value of {decimals} is 18. To change this, you should override\n * this function so it returns a different value.\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n */\nabstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors {\n mapping(address account =\u003e uint256) private _balances;\n\n mapping(address account =\u003e mapping(address spender =\u003e uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the default value returned by this function, unless\n * it's overridden.\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `value`.\n */\n function transfer(address to, uint256 value) public virtual returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, value);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 value) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, value);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `value`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `value`.\n */\n function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, value);\n _transfer(from, to, value);\n return true;\n }\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * NOTE: This function is not virtual, {_update} should be overridden instead.\n */\n function _transfer(address from, address to, uint256 value) internal {\n if (from == address(0)) {\n revert ERC20InvalidSender(address(0));\n }\n if (to == address(0)) {\n revert ERC20InvalidReceiver(address(0));\n }\n _update(from, to, value);\n }\n\n /**\n * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from`\n * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding\n * this function.\n *\n * Emits a {Transfer} event.\n */\n function _update(address from, address to, uint256 value) internal virtual {\n if (from == address(0)) {\n // Overflow check required: The rest of the code assumes that totalSupply never overflows\n _totalSupply += value;\n } else {\n uint256 fromBalance = _balances[from];\n if (fromBalance \u003c value) {\n revert ERC20InsufficientBalance(from, fromBalance, value);\n }\n unchecked {\n // Overflow not possible: value \u003c= fromBalance \u003c= totalSupply.\n _balances[from] = fromBalance - value;\n }\n }\n\n if (to == address(0)) {\n unchecked {\n // Overflow not possible: value \u003c= totalSupply or value \u003c= fromBalance \u003c= totalSupply.\n _totalSupply -= value;\n }\n } else {\n unchecked {\n // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.\n _balances[to] += value;\n }\n }\n\n emit Transfer(from, to, value);\n }\n\n /**\n * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).\n * Relies on the `_update` mechanism\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * NOTE: This function is not virtual, {_update} should be overridden instead.\n */\n function _mint(address account, uint256 value) internal {\n if (account == address(0)) {\n revert ERC20InvalidReceiver(address(0));\n }\n _update(address(0), account, value);\n }\n\n /**\n * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply.\n * Relies on the `_update` mechanism.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * NOTE: This function is not virtual, {_update} should be overridden instead\n */\n function _burn(address account, uint256 value) internal {\n if (account == address(0)) {\n revert ERC20InvalidSender(address(0));\n }\n _update(account, address(0), value);\n }\n\n /**\n * @dev Sets `value` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n *\n * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.\n */\n function _approve(address owner, address spender, uint256 value) internal {\n _approve(owner, spender, value, true);\n }\n\n /**\n * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event.\n *\n * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by\n * `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any\n * `Approval` event during `transferFrom` operations.\n *\n * Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to\n * true using the following override:\n * ```\n * function _approve(address owner, address spender, uint256 value, bool) internal virtual override {\n * super._approve(owner, spender, value, true);\n * }\n * ```\n *\n * Requirements are the same as {_approve}.\n */\n function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {\n if (owner == address(0)) {\n revert ERC20InvalidApprover(address(0));\n }\n if (spender == address(0)) {\n revert ERC20InvalidSpender(address(0));\n }\n _allowances[owner][spender] = value;\n if (emitEvent) {\n emit Approval(owner, spender, value);\n }\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `value`.\n *\n * Does not update the allowance value in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Does not emit an {Approval} event.\n */\n function _spendAllowance(address owner, address spender, uint256 value) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n if (currentAllowance \u003c value) {\n revert ERC20InsufficientAllowance(spender, currentAllowance, value);\n }\n unchecked {\n _approve(owner, spender, currentAllowance - value, false);\n }\n }\n }\n}\n\n// test/MockERC20.sol\n\ncontract MockERC20 is ERC20 {\n uint8 private _decimals;\n\n constructor(string memory name_, uint8 decimals_) ERC20(name_, name_) {\n _decimals = decimals_;\n }\n\n function decimals() public view override returns (uint8) {\n return _decimals;\n }\n\n function burn(address account, uint256 amount) external {\n _burn(account, amount);\n }\n\n function mint(address account, uint256 amount) external {\n _mint(account, amount);\n }\n}\n","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","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":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"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 for the optional metadata functions from the ERC20 standard.","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`."},"decimals()":{"details":"Returns the decimals places of the token."},"name()":{"details":"Returns the name of the token."},"symbol()":{"details":"Returns the symbol of the token."},"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.20+commit.a1b79de6\"},\"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\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"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 for the optional metadata functions from the ERC20 standard.\",\"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`.\"},\"decimals()\":{\"details\":\"Returns the decimals places of the token.\"},\"name()\":{\"details\":\"Returns the name of the token.\"},\"symbol()\":{\"details\":\"Returns the symbol of the token.\"},\"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/MockERC20.sol\":\"IERC20Metadata\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/MockERC20.sol\":{\"keccak256\":\"0xd602e791370b799101e4231c18317acecb9b397f92b6786483957405214ae011\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://71377faac66fbd6553967b93c94de35db8f6d710e578d0d4c021064a7a316d4c\",\"dweb:/ipfs/QmNMzNoV8SFKmwsswdmEnhsHKxEaxv9G8sL9eKuA6hEaPr\"]}},\"version\":1}"},"hashes":{"allowance(address,address)":"dd62ed3e","approve(address,uint256)":"095ea7b3","balanceOf(address)":"70a08231","decimals()":"313ce567","name()":"06fdde03","symbol()":"95d89b41","totalSupply()":"18160ddd","transfer(address,uint256)":"a9059cbb","transferFrom(address,address,uint256)":"23b872dd"}},"solidity/MockERC20.sol:IERC721Errors":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17 ^0.8.20;\n\n// node_modules/@openzeppelin/contracts/interfaces/draft-IERC6093.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol)\n\n/**\n * @dev Standard ERC20 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens.\n */\ninterface IERC20Errors {\n /**\n * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n * @param balance Current balance for the interacting account.\n * @param needed Minimum amount required to perform a transfer.\n */\n error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);\n\n /**\n * @dev Indicates a failure with the token `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n */\n error ERC20InvalidSender(address sender);\n\n /**\n * @dev Indicates a failure with the token `receiver`. Used in transfers.\n * @param receiver Address to which tokens are being transferred.\n */\n error ERC20InvalidReceiver(address receiver);\n\n /**\n * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.\n * @param spender Address that may be allowed to operate on tokens without being their owner.\n * @param allowance Amount of tokens a `spender` is allowed to operate with.\n * @param needed Minimum amount required to perform a transfer.\n */\n error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);\n\n /**\n * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n * @param approver Address initiating an approval operation.\n */\n error ERC20InvalidApprover(address approver);\n\n /**\n * @dev Indicates a failure with the `spender` to be approved. Used in approvals.\n * @param spender Address that may be allowed to operate on tokens without being their owner.\n */\n error ERC20InvalidSpender(address spender);\n}\n\n/**\n * @dev Standard ERC721 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens.\n */\ninterface IERC721Errors {\n /**\n * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20.\n * Used in balance queries.\n * @param owner Address of the current owner of a token.\n */\n error ERC721InvalidOwner(address owner);\n\n /**\n * @dev Indicates a `tokenId` whose `owner` is the zero address.\n * @param tokenId Identifier number of a token.\n */\n error ERC721NonexistentToken(uint256 tokenId);\n\n /**\n * @dev Indicates an error related to the ownership over a particular token. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n * @param tokenId Identifier number of a token.\n * @param owner Address of the current owner of a token.\n */\n error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);\n\n /**\n * @dev Indicates a failure with the token `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n */\n error ERC721InvalidSender(address sender);\n\n /**\n * @dev Indicates a failure with the token `receiver`. Used in transfers.\n * @param receiver Address to which tokens are being transferred.\n */\n error ERC721InvalidReceiver(address receiver);\n\n /**\n * @dev Indicates a failure with the `operator`’s approval. Used in transfers.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n * @param tokenId Identifier number of a token.\n */\n error ERC721InsufficientApproval(address operator, uint256 tokenId);\n\n /**\n * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n * @param approver Address initiating an approval operation.\n */\n error ERC721InvalidApprover(address approver);\n\n /**\n * @dev Indicates a failure with the `operator` to be approved. Used in approvals.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n */\n error ERC721InvalidOperator(address operator);\n}\n\n/**\n * @dev Standard ERC1155 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens.\n */\ninterface IERC1155Errors {\n /**\n * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n * @param balance Current balance for the interacting account.\n * @param needed Minimum amount required to perform a transfer.\n * @param tokenId Identifier number of a token.\n */\n error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);\n\n /**\n * @dev Indicates a failure with the token `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n */\n error ERC1155InvalidSender(address sender);\n\n /**\n * @dev Indicates a failure with the token `receiver`. Used in transfers.\n * @param receiver Address to which tokens are being transferred.\n */\n error ERC1155InvalidReceiver(address receiver);\n\n /**\n * @dev Indicates a failure with the `operator`’s approval. Used in transfers.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n * @param owner Address of the current owner of a token.\n */\n error ERC1155MissingApprovalForAll(address operator, address owner);\n\n /**\n * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n * @param approver Address initiating an approval operation.\n */\n error ERC1155InvalidApprover(address approver);\n\n /**\n * @dev Indicates a failure with the `operator` to be approved. Used in approvals.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n */\n error ERC1155InvalidOperator(address operator);\n\n /**\n * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.\n * Used in batch transfers.\n * @param idsLength Length of the array of token identifiers\n * @param valuesLength Length of the array of token amounts\n */\n error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);\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/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/token/ERC20/extensions/IERC20Metadata.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol)\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n\n// node_modules/@openzeppelin/contracts/token/ERC20/ERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/ERC20.sol)\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * The default value of {decimals} is 18. To change this, you should override\n * this function so it returns a different value.\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n */\nabstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors {\n mapping(address account =\u003e uint256) private _balances;\n\n mapping(address account =\u003e mapping(address spender =\u003e uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the default value returned by this function, unless\n * it's overridden.\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `value`.\n */\n function transfer(address to, uint256 value) public virtual returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, value);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 value) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, value);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `value`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `value`.\n */\n function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, value);\n _transfer(from, to, value);\n return true;\n }\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * NOTE: This function is not virtual, {_update} should be overridden instead.\n */\n function _transfer(address from, address to, uint256 value) internal {\n if (from == address(0)) {\n revert ERC20InvalidSender(address(0));\n }\n if (to == address(0)) {\n revert ERC20InvalidReceiver(address(0));\n }\n _update(from, to, value);\n }\n\n /**\n * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from`\n * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding\n * this function.\n *\n * Emits a {Transfer} event.\n */\n function _update(address from, address to, uint256 value) internal virtual {\n if (from == address(0)) {\n // Overflow check required: The rest of the code assumes that totalSupply never overflows\n _totalSupply += value;\n } else {\n uint256 fromBalance = _balances[from];\n if (fromBalance \u003c value) {\n revert ERC20InsufficientBalance(from, fromBalance, value);\n }\n unchecked {\n // Overflow not possible: value \u003c= fromBalance \u003c= totalSupply.\n _balances[from] = fromBalance - value;\n }\n }\n\n if (to == address(0)) {\n unchecked {\n // Overflow not possible: value \u003c= totalSupply or value \u003c= fromBalance \u003c= totalSupply.\n _totalSupply -= value;\n }\n } else {\n unchecked {\n // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.\n _balances[to] += value;\n }\n }\n\n emit Transfer(from, to, value);\n }\n\n /**\n * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).\n * Relies on the `_update` mechanism\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * NOTE: This function is not virtual, {_update} should be overridden instead.\n */\n function _mint(address account, uint256 value) internal {\n if (account == address(0)) {\n revert ERC20InvalidReceiver(address(0));\n }\n _update(address(0), account, value);\n }\n\n /**\n * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply.\n * Relies on the `_update` mechanism.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * NOTE: This function is not virtual, {_update} should be overridden instead\n */\n function _burn(address account, uint256 value) internal {\n if (account == address(0)) {\n revert ERC20InvalidSender(address(0));\n }\n _update(account, address(0), value);\n }\n\n /**\n * @dev Sets `value` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n *\n * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.\n */\n function _approve(address owner, address spender, uint256 value) internal {\n _approve(owner, spender, value, true);\n }\n\n /**\n * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event.\n *\n * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by\n * `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any\n * `Approval` event during `transferFrom` operations.\n *\n * Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to\n * true using the following override:\n * ```\n * function _approve(address owner, address spender, uint256 value, bool) internal virtual override {\n * super._approve(owner, spender, value, true);\n * }\n * ```\n *\n * Requirements are the same as {_approve}.\n */\n function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {\n if (owner == address(0)) {\n revert ERC20InvalidApprover(address(0));\n }\n if (spender == address(0)) {\n revert ERC20InvalidSpender(address(0));\n }\n _allowances[owner][spender] = value;\n if (emitEvent) {\n emit Approval(owner, spender, value);\n }\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `value`.\n *\n * Does not update the allowance value in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Does not emit an {Approval} event.\n */\n function _spendAllowance(address owner, address spender, uint256 value) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n if (currentAllowance \u003c value) {\n revert ERC20InsufficientAllowance(spender, currentAllowance, value);\n }\n unchecked {\n _approve(owner, spender, currentAllowance - value, false);\n }\n }\n }\n}\n\n// test/MockERC20.sol\n\ncontract MockERC20 is ERC20 {\n uint8 private _decimals;\n\n constructor(string memory name_, uint8 decimals_) ERC20(name_, name_) {\n _decimals = decimals_;\n }\n\n function decimals() public view override returns (uint8) {\n return _decimals;\n }\n\n function burn(address account, uint256 amount) external {\n _burn(account, amount);\n }\n\n function mint(address account, uint256 amount) external {\n _mint(account, amount);\n }\n}\n","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","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":"sender","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"owner","type":"address"}],"name":"ERC721IncorrectOwner","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ERC721InsufficientApproval","type":"error"},{"inputs":[{"internalType":"address","name":"approver","type":"address"}],"name":"ERC721InvalidApprover","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"ERC721InvalidOperator","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"ERC721InvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC721InvalidReceiver","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"ERC721InvalidSender","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ERC721NonexistentToken","type":"error"}],"userDoc":{"kind":"user","methods":{},"version":1},"developerDoc":{"details":"Standard ERC721 Errors Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens.","errors":{"ERC721IncorrectOwner(address,uint256,address)":[{"details":"Indicates an error related to the ownership over a particular token. Used in transfers.","params":{"owner":"Address of the current owner of a token.","sender":"Address whose tokens are being transferred.","tokenId":"Identifier number of a token."}}],"ERC721InsufficientApproval(address,uint256)":[{"details":"Indicates a failure with the `operator`’s approval. Used in transfers.","params":{"operator":"Address that may be allowed to operate on tokens without being their owner.","tokenId":"Identifier number of a token."}}],"ERC721InvalidApprover(address)":[{"details":"Indicates a failure with the `approver` of a token to be approved. Used in approvals.","params":{"approver":"Address initiating an approval operation."}}],"ERC721InvalidOperator(address)":[{"details":"Indicates a failure with the `operator` to be approved. Used in approvals.","params":{"operator":"Address that may be allowed to operate on tokens without being their owner."}}],"ERC721InvalidOwner(address)":[{"details":"Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20. Used in balance queries.","params":{"owner":"Address of the current owner of a token."}}],"ERC721InvalidReceiver(address)":[{"details":"Indicates a failure with the token `receiver`. Used in transfers.","params":{"receiver":"Address to which tokens are being transferred."}}],"ERC721InvalidSender(address)":[{"details":"Indicates a failure with the token `sender`. Used in transfers.","params":{"sender":"Address whose tokens are being transferred."}}],"ERC721NonexistentToken(uint256)":[{"details":"Indicates a `tokenId` whose `owner` is the zero address.","params":{"tokenId":"Identifier number of a token."}}]},"kind":"dev","methods":{},"version":1},"metadata":"{\"compiler\":{\"version\":\"0.8.20+commit.a1b79de6\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"ERC721IncorrectOwner\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"ERC721InsufficientApproval\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"approver\",\"type\":\"address\"}],\"name\":\"ERC721InvalidApprover\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"ERC721InvalidOperator\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"ERC721InvalidOwner\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"}],\"name\":\"ERC721InvalidReceiver\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"ERC721InvalidSender\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"ERC721NonexistentToken\",\"type\":\"error\"}],\"devdoc\":{\"details\":\"Standard ERC721 Errors Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens.\",\"errors\":{\"ERC721IncorrectOwner(address,uint256,address)\":[{\"details\":\"Indicates an error related to the ownership over a particular token. Used in transfers.\",\"params\":{\"owner\":\"Address of the current owner of a token.\",\"sender\":\"Address whose tokens are being transferred.\",\"tokenId\":\"Identifier number of a token.\"}}],\"ERC721InsufficientApproval(address,uint256)\":[{\"details\":\"Indicates a failure with the `operator`\\u2019s approval. Used in transfers.\",\"params\":{\"operator\":\"Address that may be allowed to operate on tokens without being their owner.\",\"tokenId\":\"Identifier number of a token.\"}}],\"ERC721InvalidApprover(address)\":[{\"details\":\"Indicates a failure with the `approver` of a token to be approved. Used in approvals.\",\"params\":{\"approver\":\"Address initiating an approval operation.\"}}],\"ERC721InvalidOperator(address)\":[{\"details\":\"Indicates a failure with the `operator` to be approved. Used in approvals.\",\"params\":{\"operator\":\"Address that may be allowed to operate on tokens without being their owner.\"}}],\"ERC721InvalidOwner(address)\":[{\"details\":\"Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20. Used in balance queries.\",\"params\":{\"owner\":\"Address of the current owner of a token.\"}}],\"ERC721InvalidReceiver(address)\":[{\"details\":\"Indicates a failure with the token `receiver`. Used in transfers.\",\"params\":{\"receiver\":\"Address to which tokens are being transferred.\"}}],\"ERC721InvalidSender(address)\":[{\"details\":\"Indicates a failure with the token `sender`. Used in transfers.\",\"params\":{\"sender\":\"Address whose tokens are being transferred.\"}}],\"ERC721NonexistentToken(uint256)\":[{\"details\":\"Indicates a `tokenId` whose `owner` is the zero address.\",\"params\":{\"tokenId\":\"Identifier number of a token.\"}}]},\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/MockERC20.sol\":\"IERC721Errors\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/MockERC20.sol\":{\"keccak256\":\"0xd602e791370b799101e4231c18317acecb9b397f92b6786483957405214ae011\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://71377faac66fbd6553967b93c94de35db8f6d710e578d0d4c021064a7a316d4c\",\"dweb:/ipfs/QmNMzNoV8SFKmwsswdmEnhsHKxEaxv9G8sL9eKuA6hEaPr\"]}},\"version\":1}"},"hashes":{}},"solidity/MockERC20.sol:MockERC20":{"code":"0x60806040523480156200001157600080fd5b5060405162000d4f38038062000d4f8339810160408190526200003491620000a0565b8180600362000044828262000217565b50600462000053828262000217565b50506005805460ff191660ff939093169290921790915550620002e39050565b634e487b7160e01b600052604160045260246000fd5b805160ff811681146200009b57600080fd5b919050565b60008060408385031215620000b457600080fd5b82516001600160401b0380821115620000cc57600080fd5b818501915085601f830112620000e157600080fd5b815181811115620000f657620000f662000073565b604051601f8201601f19908116603f0116810190838211818310171562000121576200012162000073565b816040528281526020935088848487010111156200013e57600080fd5b600091505b8282101562000162578482018401518183018501529083019062000143565b60008484830101528096505050506200017d81860162000089565b925050509250929050565b600181811c908216806200019d57607f821691505b602082108103620001be57634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200021257600081815260208120601f850160051c81016020861015620001ed5750805b601f850160051c820191505b818110156200020e57828155600101620001f9565b5050505b505050565b81516001600160401b0381111562000233576200023362000073565b6200024b8162000244845462000188565b84620001c4565b602080601f8311600181146200028357600084156200026a5750858301515b600019600386901b1c1916600185901b1785556200020e565b600085815260208120601f198616915b82811015620002b45788860151825594840194600190910190840162000293565b5085821015620002d35787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b610a5c80620002f36000396000f3fe608060405234801561001057600080fd5b50600436106100c95760003560e01c806340c10f19116100815780639dc29fac1161005b5780639dc29fac1461019c578063a9059cbb146101af578063dd62ed3e146101c257600080fd5b806340c10f191461014957806370a082311461015e57806395d89b411461019457600080fd5b806318160ddd116100b257806318160ddd1461010f57806323b872dd14610121578063313ce5671461013457600080fd5b806306fdde03146100ce578063095ea7b3146100ec575b600080fd5b6100d6610208565b6040516100e39190610849565b60405180910390f35b6100ff6100fa3660046108de565b61029a565b60405190151581526020016100e3565b6002545b6040519081526020016100e3565b6100ff61012f366004610908565b6102b4565b60055460405160ff90911681526020016100e3565b61015c6101573660046108de565b6102d8565b005b61011361016c366004610944565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090205490565b6100d66102e6565b61015c6101aa3660046108de565b6102f5565b6100ff6101bd3660046108de565b6102ff565b6101136101d0366004610966565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260016020908152604080832093909416825291909152205490565b60606003805461021790610999565b80601f016020809104026020016040519081016040528092919081815260200182805461024390610999565b80156102905780601f1061026557610100808354040283529160200191610290565b820191906000526020600020905b81548152906001019060200180831161027357829003601f168201915b5050505050905090565b6000336102a881858561030d565b60019150505b92915050565b6000336102c285828561031f565b6102cd8585856103f3565b506001949350505050565b6102e2828261049e565b5050565b60606004805461021790610999565b6102e282826104fa565b6000336102a88185856103f3565b61031a8383836001610556565b505050565b73ffffffffffffffffffffffffffffffffffffffff8381166000908152600160209081526040808320938616835292905220547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146103ed57818110156103de576040517ffb8f41b200000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8416600482015260248101829052604481018390526064015b60405180910390fd5b6103ed84848484036000610556565b50505050565b73ffffffffffffffffffffffffffffffffffffffff8316610443576040517f96c6fd1e000000000000000000000000000000000000000000000000000000008152600060048201526024016103d5565b73ffffffffffffffffffffffffffffffffffffffff8216610493576040517fec442f05000000000000000000000000000000000000000000000000000000008152600060048201526024016103d5565b61031a83838361069e565b73ffffffffffffffffffffffffffffffffffffffff82166104ee576040517fec442f05000000000000000000000000000000000000000000000000000000008152600060048201526024016103d5565b6102e26000838361069e565b73ffffffffffffffffffffffffffffffffffffffff821661054a576040517f96c6fd1e000000000000000000000000000000000000000000000000000000008152600060048201526024016103d5565b6102e28260008361069e565b73ffffffffffffffffffffffffffffffffffffffff84166105a6576040517fe602df05000000000000000000000000000000000000000000000000000000008152600060048201526024016103d5565b73ffffffffffffffffffffffffffffffffffffffff83166105f6576040517f94280d62000000000000000000000000000000000000000000000000000000008152600060048201526024016103d5565b73ffffffffffffffffffffffffffffffffffffffff808516600090815260016020908152604080832093871683529290522082905580156103ed578273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258460405161069091815260200190565b60405180910390a350505050565b73ffffffffffffffffffffffffffffffffffffffff83166106d65780600260008282546106cb91906109ec565b909155506107889050565b73ffffffffffffffffffffffffffffffffffffffff83166000908152602081905260409020548181101561075c576040517fe450d38c00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8516600482015260248101829052604481018390526064016103d5565b73ffffffffffffffffffffffffffffffffffffffff841660009081526020819052604090209082900390555b73ffffffffffffffffffffffffffffffffffffffff82166107b1576002805482900390556107dd565b73ffffffffffffffffffffffffffffffffffffffff821660009081526020819052604090208054820190555b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161083c91815260200190565b60405180910390a3505050565b600060208083528351808285015260005b818110156108765785810183015185820160400152820161085a565b5060006040828601015260407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8301168501019250505092915050565b803573ffffffffffffffffffffffffffffffffffffffff811681146108d957600080fd5b919050565b600080604083850312156108f157600080fd5b6108fa836108b5565b946020939093013593505050565b60008060006060848603121561091d57600080fd5b610926846108b5565b9250610934602085016108b5565b9150604084013590509250925092565b60006020828403121561095657600080fd5b61095f826108b5565b9392505050565b6000806040838503121561097957600080fd5b610982836108b5565b9150610990602084016108b5565b90509250929050565b600181811c908216806109ad57607f821691505b6020821081036109e6577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b808201808211156102ae577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fdfea2646970667358221220428220e8be4ebcf1fe446b01bd00b8071f21b3f673aaea3b2d7b75204390a40664736f6c63430008140033","runtime-code":"0x608060405234801561001057600080fd5b50600436106100c95760003560e01c806340c10f19116100815780639dc29fac1161005b5780639dc29fac1461019c578063a9059cbb146101af578063dd62ed3e146101c257600080fd5b806340c10f191461014957806370a082311461015e57806395d89b411461019457600080fd5b806318160ddd116100b257806318160ddd1461010f57806323b872dd14610121578063313ce5671461013457600080fd5b806306fdde03146100ce578063095ea7b3146100ec575b600080fd5b6100d6610208565b6040516100e39190610849565b60405180910390f35b6100ff6100fa3660046108de565b61029a565b60405190151581526020016100e3565b6002545b6040519081526020016100e3565b6100ff61012f366004610908565b6102b4565b60055460405160ff90911681526020016100e3565b61015c6101573660046108de565b6102d8565b005b61011361016c366004610944565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090205490565b6100d66102e6565b61015c6101aa3660046108de565b6102f5565b6100ff6101bd3660046108de565b6102ff565b6101136101d0366004610966565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260016020908152604080832093909416825291909152205490565b60606003805461021790610999565b80601f016020809104026020016040519081016040528092919081815260200182805461024390610999565b80156102905780601f1061026557610100808354040283529160200191610290565b820191906000526020600020905b81548152906001019060200180831161027357829003601f168201915b5050505050905090565b6000336102a881858561030d565b60019150505b92915050565b6000336102c285828561031f565b6102cd8585856103f3565b506001949350505050565b6102e2828261049e565b5050565b60606004805461021790610999565b6102e282826104fa565b6000336102a88185856103f3565b61031a8383836001610556565b505050565b73ffffffffffffffffffffffffffffffffffffffff8381166000908152600160209081526040808320938616835292905220547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146103ed57818110156103de576040517ffb8f41b200000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8416600482015260248101829052604481018390526064015b60405180910390fd5b6103ed84848484036000610556565b50505050565b73ffffffffffffffffffffffffffffffffffffffff8316610443576040517f96c6fd1e000000000000000000000000000000000000000000000000000000008152600060048201526024016103d5565b73ffffffffffffffffffffffffffffffffffffffff8216610493576040517fec442f05000000000000000000000000000000000000000000000000000000008152600060048201526024016103d5565b61031a83838361069e565b73ffffffffffffffffffffffffffffffffffffffff82166104ee576040517fec442f05000000000000000000000000000000000000000000000000000000008152600060048201526024016103d5565b6102e26000838361069e565b73ffffffffffffffffffffffffffffffffffffffff821661054a576040517f96c6fd1e000000000000000000000000000000000000000000000000000000008152600060048201526024016103d5565b6102e28260008361069e565b73ffffffffffffffffffffffffffffffffffffffff84166105a6576040517fe602df05000000000000000000000000000000000000000000000000000000008152600060048201526024016103d5565b73ffffffffffffffffffffffffffffffffffffffff83166105f6576040517f94280d62000000000000000000000000000000000000000000000000000000008152600060048201526024016103d5565b73ffffffffffffffffffffffffffffffffffffffff808516600090815260016020908152604080832093871683529290522082905580156103ed578273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258460405161069091815260200190565b60405180910390a350505050565b73ffffffffffffffffffffffffffffffffffffffff83166106d65780600260008282546106cb91906109ec565b909155506107889050565b73ffffffffffffffffffffffffffffffffffffffff83166000908152602081905260409020548181101561075c576040517fe450d38c00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8516600482015260248101829052604481018390526064016103d5565b73ffffffffffffffffffffffffffffffffffffffff841660009081526020819052604090209082900390555b73ffffffffffffffffffffffffffffffffffffffff82166107b1576002805482900390556107dd565b73ffffffffffffffffffffffffffffffffffffffff821660009081526020819052604090208054820190555b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161083c91815260200190565b60405180910390a3505050565b600060208083528351808285015260005b818110156108765785810183015185820160400152820161085a565b5060006040828601015260407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8301168501019250505092915050565b803573ffffffffffffffffffffffffffffffffffffffff811681146108d957600080fd5b919050565b600080604083850312156108f157600080fd5b6108fa836108b5565b946020939093013593505050565b60008060006060848603121561091d57600080fd5b610926846108b5565b9250610934602085016108b5565b9150604084013590509250925092565b60006020828403121561095657600080fd5b61095f826108b5565b9392505050565b6000806040838503121561097957600080fd5b610982836108b5565b9150610990602084016108b5565b90509250929050565b600181811c908216806109ad57607f821691505b6020821081036109e6577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b808201808211156102ae577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fdfea2646970667358221220428220e8be4ebcf1fe446b01bd00b8071f21b3f673aaea3b2d7b75204390a40664736f6c63430008140033","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17 ^0.8.20;\n\n// node_modules/@openzeppelin/contracts/interfaces/draft-IERC6093.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol)\n\n/**\n * @dev Standard ERC20 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens.\n */\ninterface IERC20Errors {\n /**\n * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n * @param balance Current balance for the interacting account.\n * @param needed Minimum amount required to perform a transfer.\n */\n error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);\n\n /**\n * @dev Indicates a failure with the token `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n */\n error ERC20InvalidSender(address sender);\n\n /**\n * @dev Indicates a failure with the token `receiver`. Used in transfers.\n * @param receiver Address to which tokens are being transferred.\n */\n error ERC20InvalidReceiver(address receiver);\n\n /**\n * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.\n * @param spender Address that may be allowed to operate on tokens without being their owner.\n * @param allowance Amount of tokens a `spender` is allowed to operate with.\n * @param needed Minimum amount required to perform a transfer.\n */\n error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);\n\n /**\n * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n * @param approver Address initiating an approval operation.\n */\n error ERC20InvalidApprover(address approver);\n\n /**\n * @dev Indicates a failure with the `spender` to be approved. Used in approvals.\n * @param spender Address that may be allowed to operate on tokens without being their owner.\n */\n error ERC20InvalidSpender(address spender);\n}\n\n/**\n * @dev Standard ERC721 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens.\n */\ninterface IERC721Errors {\n /**\n * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20.\n * Used in balance queries.\n * @param owner Address of the current owner of a token.\n */\n error ERC721InvalidOwner(address owner);\n\n /**\n * @dev Indicates a `tokenId` whose `owner` is the zero address.\n * @param tokenId Identifier number of a token.\n */\n error ERC721NonexistentToken(uint256 tokenId);\n\n /**\n * @dev Indicates an error related to the ownership over a particular token. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n * @param tokenId Identifier number of a token.\n * @param owner Address of the current owner of a token.\n */\n error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);\n\n /**\n * @dev Indicates a failure with the token `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n */\n error ERC721InvalidSender(address sender);\n\n /**\n * @dev Indicates a failure with the token `receiver`. Used in transfers.\n * @param receiver Address to which tokens are being transferred.\n */\n error ERC721InvalidReceiver(address receiver);\n\n /**\n * @dev Indicates a failure with the `operator`’s approval. Used in transfers.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n * @param tokenId Identifier number of a token.\n */\n error ERC721InsufficientApproval(address operator, uint256 tokenId);\n\n /**\n * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n * @param approver Address initiating an approval operation.\n */\n error ERC721InvalidApprover(address approver);\n\n /**\n * @dev Indicates a failure with the `operator` to be approved. Used in approvals.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n */\n error ERC721InvalidOperator(address operator);\n}\n\n/**\n * @dev Standard ERC1155 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens.\n */\ninterface IERC1155Errors {\n /**\n * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n * @param balance Current balance for the interacting account.\n * @param needed Minimum amount required to perform a transfer.\n * @param tokenId Identifier number of a token.\n */\n error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);\n\n /**\n * @dev Indicates a failure with the token `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n */\n error ERC1155InvalidSender(address sender);\n\n /**\n * @dev Indicates a failure with the token `receiver`. Used in transfers.\n * @param receiver Address to which tokens are being transferred.\n */\n error ERC1155InvalidReceiver(address receiver);\n\n /**\n * @dev Indicates a failure with the `operator`’s approval. Used in transfers.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n * @param owner Address of the current owner of a token.\n */\n error ERC1155MissingApprovalForAll(address operator, address owner);\n\n /**\n * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n * @param approver Address initiating an approval operation.\n */\n error ERC1155InvalidApprover(address approver);\n\n /**\n * @dev Indicates a failure with the `operator` to be approved. Used in approvals.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n */\n error ERC1155InvalidOperator(address operator);\n\n /**\n * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.\n * Used in batch transfers.\n * @param idsLength Length of the array of token identifiers\n * @param valuesLength Length of the array of token amounts\n */\n error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);\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/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/token/ERC20/extensions/IERC20Metadata.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol)\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n\n// node_modules/@openzeppelin/contracts/token/ERC20/ERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/ERC20.sol)\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * The default value of {decimals} is 18. To change this, you should override\n * this function so it returns a different value.\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n */\nabstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors {\n mapping(address account =\u003e uint256) private _balances;\n\n mapping(address account =\u003e mapping(address spender =\u003e uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the default value returned by this function, unless\n * it's overridden.\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `value`.\n */\n function transfer(address to, uint256 value) public virtual returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, value);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 value) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, value);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `value`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `value`.\n */\n function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, value);\n _transfer(from, to, value);\n return true;\n }\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * NOTE: This function is not virtual, {_update} should be overridden instead.\n */\n function _transfer(address from, address to, uint256 value) internal {\n if (from == address(0)) {\n revert ERC20InvalidSender(address(0));\n }\n if (to == address(0)) {\n revert ERC20InvalidReceiver(address(0));\n }\n _update(from, to, value);\n }\n\n /**\n * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from`\n * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding\n * this function.\n *\n * Emits a {Transfer} event.\n */\n function _update(address from, address to, uint256 value) internal virtual {\n if (from == address(0)) {\n // Overflow check required: The rest of the code assumes that totalSupply never overflows\n _totalSupply += value;\n } else {\n uint256 fromBalance = _balances[from];\n if (fromBalance \u003c value) {\n revert ERC20InsufficientBalance(from, fromBalance, value);\n }\n unchecked {\n // Overflow not possible: value \u003c= fromBalance \u003c= totalSupply.\n _balances[from] = fromBalance - value;\n }\n }\n\n if (to == address(0)) {\n unchecked {\n // Overflow not possible: value \u003c= totalSupply or value \u003c= fromBalance \u003c= totalSupply.\n _totalSupply -= value;\n }\n } else {\n unchecked {\n // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.\n _balances[to] += value;\n }\n }\n\n emit Transfer(from, to, value);\n }\n\n /**\n * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).\n * Relies on the `_update` mechanism\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * NOTE: This function is not virtual, {_update} should be overridden instead.\n */\n function _mint(address account, uint256 value) internal {\n if (account == address(0)) {\n revert ERC20InvalidReceiver(address(0));\n }\n _update(address(0), account, value);\n }\n\n /**\n * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply.\n * Relies on the `_update` mechanism.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * NOTE: This function is not virtual, {_update} should be overridden instead\n */\n function _burn(address account, uint256 value) internal {\n if (account == address(0)) {\n revert ERC20InvalidSender(address(0));\n }\n _update(account, address(0), value);\n }\n\n /**\n * @dev Sets `value` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n *\n * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.\n */\n function _approve(address owner, address spender, uint256 value) internal {\n _approve(owner, spender, value, true);\n }\n\n /**\n * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event.\n *\n * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by\n * `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any\n * `Approval` event during `transferFrom` operations.\n *\n * Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to\n * true using the following override:\n * ```\n * function _approve(address owner, address spender, uint256 value, bool) internal virtual override {\n * super._approve(owner, spender, value, true);\n * }\n * ```\n *\n * Requirements are the same as {_approve}.\n */\n function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {\n if (owner == address(0)) {\n revert ERC20InvalidApprover(address(0));\n }\n if (spender == address(0)) {\n revert ERC20InvalidSpender(address(0));\n }\n _allowances[owner][spender] = value;\n if (emitEvent) {\n emit Approval(owner, spender, value);\n }\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `value`.\n *\n * Does not update the allowance value in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Does not emit an {Approval} event.\n */\n function _spendAllowance(address owner, address spender, uint256 value) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n if (currentAllowance \u003c value) {\n revert ERC20InsufficientAllowance(spender, currentAllowance, value);\n }\n unchecked {\n _approve(owner, spender, currentAllowance - value, false);\n }\n }\n }\n}\n\n// test/MockERC20.sol\n\ncontract MockERC20 is ERC20 {\n uint8 private _decimals;\n\n constructor(string memory name_, uint8 decimals_) ERC20(name_, name_) {\n _decimals = decimals_;\n }\n\n function decimals() public view override returns (uint8) {\n return _decimals;\n }\n\n function burn(address account, uint256 amount) external {\n _burn(account, amount);\n }\n\n function mint(address account, uint256 amount) external {\n _mint(account, amount);\n }\n}\n","language":"Solidity","languageVersion":"0.8.20","compilerVersion":"0.8.20","compilerOptions":"--combined-json bin,bin-runtime,srcmap,srcmap-runtime,abi,userdoc,devdoc,metadata,hashes --optimize --optimize-runs 10000 --allow-paths ., ./, ../ --evm-version=istanbul","srcMap":"21989:472:0:-:0;;;22053:108;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;22109:5;;12784;:13;22109:5;12784;:13;:::i;:::-;-1:-1:-1;12807:7:0;:17;12817:7;12807;:17;:::i;:::-;-1:-1:-1;;22133:9:0::1;:21:::0;;-1:-1:-1;;22133:21:0::1;;::::0;;;::::1;::::0;;;::::1;::::0;;;-1:-1:-1;21989:472:0;;-1:-1:-1;21989:472:0;14:127:1;75:10;70:3;66:20;63:1;56:31;106:4;103:1;96:15;130:4;127:1;120:15;146:160;223:13;;276:4;265:16;;255:27;;245:55;;296:1;293;286:12;245:55;146:160;;;:::o;311:1125::-;398:6;406;459:2;447:9;438:7;434:23;430:32;427:52;;;475:1;472;465:12;427:52;502:16;;-1:-1:-1;;;;;567:14:1;;;564:34;;;594:1;591;584:12;564:34;632:6;621:9;617:22;607:32;;677:7;670:4;666:2;662:13;658:27;648:55;;699:1;696;689:12;648:55;728:2;722:9;750:2;746;743:10;740:36;;;756:18;;:::i;:::-;831:2;825:9;799:2;885:13;;-1:-1:-1;;881:22:1;;;905:2;877:31;873:40;861:53;;;929:18;;;949:22;;;926:46;923:72;;;975:18;;:::i;:::-;1015:10;1011:2;1004:22;1050:2;1042:6;1035:18;1072:4;1062:14;;1113:7;1108:2;1103;1099;1095:11;1091:20;1088:33;1085:53;;;1134:1;1131;1124:12;1085:53;1156:1;1147:10;;1166:129;1180:2;1177:1;1174:9;1166:129;;;1268:10;;;1264:19;;1258:26;1237:14;;;1233:23;;1226:59;1191:10;;;;1166:129;;;1337:1;1332:2;1327;1319:6;1315:15;1311:24;1304:35;1358:6;1348:16;;;;;1383:47;1426:2;1415:9;1411:18;1383:47;:::i;:::-;1373:57;;;;311:1125;;;;;:::o;1441:380::-;1520:1;1516:12;;;;1563;;;1584:61;;1638:4;1630:6;1626:17;1616:27;;1584:61;1691:2;1683:6;1680:14;1660:18;1657:38;1654:161;;1737:10;1732:3;1728:20;1725:1;1718:31;1772:4;1769:1;1762:15;1800:4;1797:1;1790:15;1654:161;;1441:380;;;:::o;1952:545::-;2054:2;2049:3;2046:11;2043:448;;;2090:1;2115:5;2111:2;2104:17;2160:4;2156:2;2146:19;2230:2;2218:10;2214:19;2211:1;2207:27;2201:4;2197:38;2266:4;2254:10;2251:20;2248:47;;;-1:-1:-1;2289:4:1;2248:47;2344:2;2339:3;2335:12;2332:1;2328:20;2322:4;2318:31;2308:41;;2399:82;2417:2;2410:5;2407:13;2399:82;;;2462:17;;;2443:1;2432:13;2399:82;;;2403:3;;;2043:448;1952:545;;;:::o;2673:1352::-;2793:10;;-1:-1:-1;;;;;2815:30:1;;2812:56;;;2848:18;;:::i;:::-;2877:97;2967:6;2927:38;2959:4;2953:11;2927:38;:::i;:::-;2921:4;2877:97;:::i;:::-;3029:4;;3093:2;3082:14;;3110:1;3105:663;;;;3812:1;3829:6;3826:89;;;-1:-1:-1;3881:19:1;;;3875:26;3826:89;-1:-1:-1;;2630:1:1;2626:11;;;2622:24;2618:29;2608:40;2654:1;2650:11;;;2605:57;3928:81;;3075:944;;3105:663;1899:1;1892:14;;;1936:4;1923:18;;-1:-1:-1;;3141:20:1;;;3259:236;3273:7;3270:1;3267:14;3259:236;;;3362:19;;;3356:26;3341:42;;3454:27;;;;3422:1;3410:14;;;;3289:19;;3259:236;;;3263:3;3523:6;3514:7;3511:19;3508:201;;;3584:19;;;3578:26;-1:-1:-1;;3667:1:1;3663:14;;;3679:3;3659:24;3655:37;3651:42;3636:58;3621:74;;3508:201;-1:-1:-1;;;;;3755:1:1;3739:14;;;3735:22;3722:36;;-1:-1:-1;2673:1352:1:o;:::-;21989:472:0;;;;;;","srcMapRuntime":"21989:472:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;12896:89;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;15115:186;;;;;;:::i;:::-;;:::i;:::-;;;1251:14:1;;1244:22;1226:41;;1214:2;1199:18;15115:186:0;1086:187:1;13966:97:0;14044:12;;13966:97;;;1424:25:1;;;1412:2;1397:18;13966:97:0;1278:177:1;15861:244:0;;;;;;:::i;:::-;;:::i;22167:90::-;22241:9;;22167:90;;22241:9;;;;1935:36:1;;1923:2;1908:18;22167:90:0;1793:184:1;22364:95:0;;;;;;:::i;:::-;;:::i;:::-;;14121:116;;;;;;:::i;:::-;14212:18;;14186:7;14212:18;;;;;;;;;;;;14121:116;13098:93;;;:::i;22263:95::-;;;;;;:::i;:::-;;:::i;14432:178::-;;;;;;:::i;:::-;;:::i;14668:140::-;;;;;;:::i;:::-;14774:18;;;;14748:7;14774:18;;;:11;:18;;;;;;;;:27;;;;;;;;;;;;;14668:140;12896:89;12941:13;12973:5;12966:12;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;12896:89;:::o;15115:186::-;15188:4;10135:10;15242:31;10135:10;15258:7;15267:5;15242:8;:31::i;:::-;15290:4;15283:11;;;15115:186;;;;;:::o;15861:244::-;15948:4;10135:10;16004:37;16020:4;10135:10;16035:5;16004:15;:37::i;:::-;16051:26;16061:4;16067:2;16071:5;16051:9;:26::i;:::-;-1:-1:-1;16094:4:0;;15861:244;-1:-1:-1;;;;15861:244:0:o;22364:95::-;22430:22;22436:7;22445:6;22430:5;:22::i;:::-;22364:95;;:::o;13098:93::-;13145:13;13177:7;13170:14;;;;;:::i;22263:95::-;22329:22;22335:7;22344:6;22329:5;:22::i;14432:178::-;14501:4;10135:10;14555:27;10135:10;14572:2;14576:5;14555:9;:27::i;19811:128::-;19895:37;19904:5;19911:7;19920:5;19927:4;19895:8;:37::i;:::-;19811:128;;;:::o;21485:477::-;14774:18;;;;21584:24;14774:18;;;:11;:18;;;;;;;;:27;;;;;;;;;;21670:17;21650:37;;21646:310;;21726:5;21707:16;:24;21703:130;;;21758:60;;;;;3112:42:1;3100:55;;21758:60:0;;;3082:74:1;3172:18;;;3165:34;;;3215:18;;;3208:34;;;3055:18;;21758:60:0;;;;;;;;21703:130;21874:57;21883:5;21890:7;21918:5;21899:16;:24;21925:5;21874:8;:57::i;:::-;21574:388;21485:477;;;:::o;16478:300::-;16561:18;;;16557:86;;16602:30;;;;;16629:1;16602:30;;;3399:74:1;3372:18;;16602:30:0;3253:226:1;16557:86:0;16656:16;;;16652:86;;16695:32;;;;;16724:1;16695:32;;;3399:74:1;3372:18;;16695:32:0;3253:226:1;16652:86:0;16747:24;16755:4;16761:2;16765:5;16747:7;:24::i;18543:208::-;18613:21;;;18609:91;;18657:32;;;;;18686:1;18657:32;;;3399:74:1;3372:18;;18657:32:0;3253:226:1;18609:91:0;18709:35;18725:1;18729:7;18738:5;18709:7;:35::i;19069:206::-;19139:21;;;19135:89;;19183:30;;;;;19210:1;19183:30;;;3399:74:1;3372:18;;19183:30:0;3253:226:1;19135:89:0;19233:35;19241:7;19258:1;19262:5;19233:7;:35::i;20771:432::-;20883:19;;;20879:89;;20925:32;;;;;20954:1;20925:32;;;3399:74:1;3372:18;;20925:32:0;3253:226:1;20879:89:0;20981:21;;;20977:90;;21025:31;;;;;21053:1;21025:31;;;3399:74:1;3372:18;;21025:31:0;3253:226:1;20977:90:0;21076:18;;;;;;;;:11;:18;;;;;;;;:27;;;;;;;;;:35;;;21121:76;;;;21171:7;21155:31;;21164:5;21155:31;;;21180:5;21155:31;;;;1424:25:1;;1412:2;1397:18;;1278:177;21155:31:0;;;;;;;;20771:432;;;;:::o;17093:1107::-;17182:18;;;17178:540;;17334:5;17318:12;;:21;;;;;;;:::i;:::-;;;;-1:-1:-1;17178:540:0;;-1:-1:-1;17178:540:0;;17392:15;;;17370:19;17392:15;;;;;;;;;;;17425:19;;;17421:115;;;17471:50;;;;;3112:42:1;3100:55;;17471:50:0;;;3082:74:1;3172:18;;;3165:34;;;3215:18;;;3208:34;;;3055:18;;17471:50:0;2880:368:1;17421:115:0;17656:15;;;:9;:15;;;;;;;;;;17674:19;;;;17656:37;;17178:540;17732:16;;;17728:425;;17895:12;:21;;;;;;;17728:425;;;18106:13;;;:9;:13;;;;;;;;;;:22;;;;;;17728:425;18183:2;18168:25;;18177:4;18168:25;;;18187:5;18168:25;;;;1424::1;;1412:2;1397:18;;1278:177;18168:25:0;;;;;;;;17093:1107;;;:::o;14:607:1:-;126:4;155:2;184;173:9;166:21;216:6;210:13;259:6;254:2;243:9;239:18;232:34;284:1;294:140;308:6;305:1;302:13;294:140;;;403:14;;;399:23;;393:30;369:17;;;388:2;365:26;358:66;323:10;;294:140;;;298:3;483:1;478:2;469:6;458:9;454:22;450:31;443:42;612:2;542:66;537:2;529:6;525:15;521:88;510:9;506:104;502:113;494:121;;;;14:607;;;;:::o;626:196::-;694:20;;754:42;743:54;;733:65;;723:93;;812:1;809;802:12;723:93;626:196;;;:::o;827:254::-;895:6;903;956:2;944:9;935:7;931:23;927:32;924:52;;;972:1;969;962:12;924:52;995:29;1014:9;995:29;:::i;:::-;985:39;1071:2;1056:18;;;;1043:32;;-1:-1:-1;;;827:254:1:o;1460:328::-;1537:6;1545;1553;1606:2;1594:9;1585:7;1581:23;1577:32;1574:52;;;1622:1;1619;1612:12;1574:52;1645:29;1664:9;1645:29;:::i;:::-;1635:39;;1693:38;1727:2;1716:9;1712:18;1693:38;:::i;:::-;1683:48;;1778:2;1767:9;1763:18;1750:32;1740:42;;1460:328;;;;;:::o;1982:186::-;2041:6;2094:2;2082:9;2073:7;2069:23;2065:32;2062:52;;;2110:1;2107;2100:12;2062:52;2133:29;2152:9;2133:29;:::i;:::-;2123:39;1982:186;-1:-1:-1;;;1982:186:1:o;2173:260::-;2241:6;2249;2302:2;2290:9;2281:7;2277:23;2273:32;2270:52;;;2318:1;2315;2308:12;2270:52;2341:29;2360:9;2341:29;:::i;:::-;2331:39;;2389:38;2423:2;2412:9;2408:18;2389:38;:::i;:::-;2379:48;;2173:260;;;;;:::o;2438:437::-;2517:1;2513:12;;;;2560;;;2581:61;;2635:4;2627:6;2623:17;2613:27;;2581:61;2688:2;2680:6;2677:14;2657:18;2654:38;2651:218;;2725:77;2722:1;2715:88;2826:4;2823:1;2816:15;2854:4;2851:1;2844:15;2651:218;;2438:437;;;:::o;3484:279::-;3549:9;;;3570:10;;;3567:190;;;3613:77;3610:1;3603:88;3714:4;3711:1;3704:15;3742:4;3739:1;3732:15","abiDefinition":[{"inputs":[{"internalType":"string","name":"name_","type":"string"},{"internalType":"uint8","name":"decimals_","type":"uint8"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"allowance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"ERC20InsufficientAllowance","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"ERC20InsufficientBalance","type":"error"},{"inputs":[{"internalType":"address","name":"approver","type":"address"}],"name":"ERC20InvalidApprover","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC20InvalidReceiver","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"ERC20InvalidSender","type":"error"},{"inputs":[{"internalType":"address","name":"spender","type":"address"}],"name":"ERC20InvalidSpender","type":"error"},{"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":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"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":{"errors":{"ERC20InsufficientAllowance(address,uint256,uint256)":[{"details":"Indicates a failure with the `spender`’s `allowance`. Used in transfers.","params":{"allowance":"Amount of tokens a `spender` is allowed to operate with.","needed":"Minimum amount required to perform a transfer.","spender":"Address that may be allowed to operate on tokens without being their owner."}}],"ERC20InsufficientBalance(address,uint256,uint256)":[{"details":"Indicates an error related to the current `balance` of a `sender`. Used in transfers.","params":{"balance":"Current balance for the interacting account.","needed":"Minimum amount required to perform a transfer.","sender":"Address whose tokens are being transferred."}}],"ERC20InvalidApprover(address)":[{"details":"Indicates a failure with the `approver` of a token to be approved. Used in approvals.","params":{"approver":"Address initiating an approval operation."}}],"ERC20InvalidReceiver(address)":[{"details":"Indicates a failure with the token `receiver`. Used in transfers.","params":{"receiver":"Address to which tokens are being transferred."}}],"ERC20InvalidSender(address)":[{"details":"Indicates a failure with the token `sender`. Used in transfers.","params":{"sender":"Address whose tokens are being transferred."}}],"ERC20InvalidSpender(address)":[{"details":"Indicates a failure with the `spender` to be approved. Used in approvals.","params":{"spender":"Address that may be allowed to operate on tokens without being their owner."}}]},"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":"See {IERC20-allowance}."},"approve(address,uint256)":{"details":"See {IERC20-approve}. NOTE: If `value` is the maximum `uint256`, the allowance is not updated on `transferFrom`. This is semantically equivalent to an infinite approval. Requirements: - `spender` cannot be the zero address."},"balanceOf(address)":{"details":"See {IERC20-balanceOf}."},"decimals()":{"details":"Returns the number of decimals used to get its user representation. For example, if `decimals` equals `2`, a balance of `505` tokens should be displayed to a user as `5.05` (`505 / 10 ** 2`). Tokens usually opt for a value of 18, imitating the relationship between Ether and Wei. This is the default value returned by this function, unless it's overridden. NOTE: This information is only used for _display_ purposes: it in no way affects any of the arithmetic of the contract, including {IERC20-balanceOf} and {IERC20-transfer}."},"name()":{"details":"Returns the name of the token."},"symbol()":{"details":"Returns the symbol of the token, usually a shorter version of the name."},"totalSupply()":{"details":"See {IERC20-totalSupply}."},"transfer(address,uint256)":{"details":"See {IERC20-transfer}. Requirements: - `to` cannot be the zero address. - the caller must have a balance of at least `value`."},"transferFrom(address,address,uint256)":{"details":"See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}. NOTE: Does not update the allowance if the current allowance is the maximum `uint256`. Requirements: - `from` and `to` cannot be the zero address. - `from` must have a balance of at least `value`. - the caller must have allowance for ``from``'s tokens of at least `value`."}},"version":1},"metadata":"{\"compiler\":{\"version\":\"0.8.20+commit.a1b79de6\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name_\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"decimals_\",\"type\":\"uint8\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"allowance\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"needed\",\"type\":\"uint256\"}],\"name\":\"ERC20InsufficientAllowance\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"balance\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"needed\",\"type\":\"uint256\"}],\"name\":\"ERC20InsufficientBalance\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"approver\",\"type\":\"address\"}],\"name\":\"ERC20InvalidApprover\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"}],\"name\":\"ERC20InvalidReceiver\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"ERC20InvalidSender\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"}],\"name\":\"ERC20InvalidSpender\",\"type\":\"error\"},{\"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\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"burn\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"mint\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"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\":{\"errors\":{\"ERC20InsufficientAllowance(address,uint256,uint256)\":[{\"details\":\"Indicates a failure with the `spender`\\u2019s `allowance`. Used in transfers.\",\"params\":{\"allowance\":\"Amount of tokens a `spender` is allowed to operate with.\",\"needed\":\"Minimum amount required to perform a transfer.\",\"spender\":\"Address that may be allowed to operate on tokens without being their owner.\"}}],\"ERC20InsufficientBalance(address,uint256,uint256)\":[{\"details\":\"Indicates an error related to the current `balance` of a `sender`. Used in transfers.\",\"params\":{\"balance\":\"Current balance for the interacting account.\",\"needed\":\"Minimum amount required to perform a transfer.\",\"sender\":\"Address whose tokens are being transferred.\"}}],\"ERC20InvalidApprover(address)\":[{\"details\":\"Indicates a failure with the `approver` of a token to be approved. Used in approvals.\",\"params\":{\"approver\":\"Address initiating an approval operation.\"}}],\"ERC20InvalidReceiver(address)\":[{\"details\":\"Indicates a failure with the token `receiver`. Used in transfers.\",\"params\":{\"receiver\":\"Address to which tokens are being transferred.\"}}],\"ERC20InvalidSender(address)\":[{\"details\":\"Indicates a failure with the token `sender`. Used in transfers.\",\"params\":{\"sender\":\"Address whose tokens are being transferred.\"}}],\"ERC20InvalidSpender(address)\":[{\"details\":\"Indicates a failure with the `spender` to be approved. Used in approvals.\",\"params\":{\"spender\":\"Address that may be allowed to operate on tokens without being their owner.\"}}]},\"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\":\"See {IERC20-allowance}.\"},\"approve(address,uint256)\":{\"details\":\"See {IERC20-approve}. NOTE: If `value` is the maximum `uint256`, the allowance is not updated on `transferFrom`. This is semantically equivalent to an infinite approval. Requirements: - `spender` cannot be the zero address.\"},\"balanceOf(address)\":{\"details\":\"See {IERC20-balanceOf}.\"},\"decimals()\":{\"details\":\"Returns the number of decimals used to get its user representation. For example, if `decimals` equals `2`, a balance of `505` tokens should be displayed to a user as `5.05` (`505 / 10 ** 2`). Tokens usually opt for a value of 18, imitating the relationship between Ether and Wei. This is the default value returned by this function, unless it's overridden. NOTE: This information is only used for _display_ purposes: it in no way affects any of the arithmetic of the contract, including {IERC20-balanceOf} and {IERC20-transfer}.\"},\"name()\":{\"details\":\"Returns the name of the token.\"},\"symbol()\":{\"details\":\"Returns the symbol of the token, usually a shorter version of the name.\"},\"totalSupply()\":{\"details\":\"See {IERC20-totalSupply}.\"},\"transfer(address,uint256)\":{\"details\":\"See {IERC20-transfer}. Requirements: - `to` cannot be the zero address. - the caller must have a balance of at least `value`.\"},\"transferFrom(address,address,uint256)\":{\"details\":\"See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}. NOTE: Does not update the allowance if the current allowance is the maximum `uint256`. Requirements: - `from` and `to` cannot be the zero address. - `from` must have a balance of at least `value`. - the caller must have allowance for ``from``'s tokens of at least `value`.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/MockERC20.sol\":\"MockERC20\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/MockERC20.sol\":{\"keccak256\":\"0xd602e791370b799101e4231c18317acecb9b397f92b6786483957405214ae011\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://71377faac66fbd6553967b93c94de35db8f6d710e578d0d4c021064a7a316d4c\",\"dweb:/ipfs/QmNMzNoV8SFKmwsswdmEnhsHKxEaxv9G8sL9eKuA6hEaPr\"]}},\"version\":1}"},"hashes":{"allowance(address,address)":"dd62ed3e","approve(address,uint256)":"095ea7b3","balanceOf(address)":"70a08231","burn(address,uint256)":"9dc29fac","decimals()":"313ce567","mint(address,uint256)":"40c10f19","name()":"06fdde03","symbol()":"95d89b41","totalSupply()":"18160ddd","transfer(address,uint256)":"a9059cbb","transferFrom(address,address,uint256)":"23b872dd"}}} \ No newline at end of file