diff --git a/.gitignore b/.gitignore index 86c4727c..4fb13e9a 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,7 @@ src/types typechain-types/ .env +.env.* .DS_Store .gas-snapshot/ @@ -26,8 +27,9 @@ broadcast/ .cursorrules -deployments/local_addresses.json -deployments/local_verification.json +deployments/local_addresses* +deployments/local_verification* +deployments/stage_addresses_* testScript.sh CLAUDE.md diff --git a/Errors.md b/Errors.md index 2acd69a3..638654ed 100644 --- a/Errors.md +++ b/Errors.md @@ -1,178 +1,186 @@ # Custom Error Codes + ## evmx/fees/FeesPool.sol -| Error | Signature | -| ------------------ | ------------ | +| Error | Signature | +|-------|-----------| | `TransferFailed()` | `0x90b8ec18` | ## evmx/helpers/AsyncPromise.sol -| Error | Signature | -| -------------------------- | ------------ | +| Error | Signature | +|-------|-----------| | `PromiseAlreadyResolved()` | `0x56b63537` | -| `OnlyInvoker()` | `0x74ed21f5` | -| `PromiseAlreadySetUp()` | `0x927c53d5` | -| `PromiseRevertFailed()` | `0x0175b9de` | -| `NotLatestPromise()` | `0x39ca95d3` | +| `OnlyInvoker()` | `0x74ed21f5` | +| `PromiseAlreadySetUp()` | `0x927c53d5` | +| `PromiseRevertFailed()` | `0x0175b9de` | +| `NotLatestPromise()` | `0x39ca95d3` | + +## evmx/helpers/ForwarderSolana.sol + +| Error | Signature | +|-------|-----------| +| `InvalidSolanaChainSlug()` | `0xe37803ab` | +| `AddressResolverNotSet()` | `0x6d55276d` | ## evmx/plugs/ContractFactoryPlug.sol -| Error | Signature | -| -------------------------------- | ------------ | -| `DeploymentFailed()` | `0x30116425` | +| Error | Signature | +|-------|-----------| +| `DeploymentFailed()` | `0x30116425` | | `ExecutionFailed(bytes32,bytes)` | `0xd255d8a3` | -| `information(bool,,bytes)` | `0x3a82a1f3` | +| `information(bool,,bytes)` | `0x3a82a1f3` | ## evmx/plugs/FeesPlug.sol -| Error | Signature | -| --------------------------------------------------- | ------------ | +| Error | Signature | +|-------|-----------| | `InsufficientTokenBalance(address,uint256,uint256)` | `0xebd6ced9` | -| `InvalidDepositAmount()` | `0xfe9ba5cd` | -| `TokenNotWhitelisted(address)` | `0xea3bff2e` | +| `InvalidDepositAmount()` | `0xfe9ba5cd` | +| `TokenNotWhitelisted(address)` | `0xea3bff2e` | ## evmx/watcher/RequestHandler.sol -| Error | Signature | -| ----------------------- | ------------ | +| Error | Signature | +|-------|-----------| | `InsufficientMaxFees()` | `0x0e5bc492` | ## protocol/Socket.sol -| Error | Signature | -| ----------------------------------------- | ------------ | +| Error | Signature | +|-------|-----------| | `PayloadAlreadyExecuted(ExecutionStatus)` | `0xf4c54edd` | -| `VerificationFailed()` | `0x439cc0cd` | -| `LowGasLimit()` | `0xd38edae0` | -| `InsufficientMsgValue()` | `0x78f38f76` | +| `VerificationFailed()` | `0x439cc0cd` | +| `LowGasLimit()` | `0xd38edae0` | +| `InsufficientMsgValue()` | `0x78f38f76` | ## protocol/SocketConfig.sol -| Error | Signature | -| --------------------- | ------------ | +| Error | Signature | +|-------|-----------| | `SwitchboardExists()` | `0x2dff8555` | -| `PlugNotConnected()` | `0x411d0255` | +| `PlugNotConnected()` | `0x411d0255` | ## protocol/SocketFeeManager.sol -| Error | Signature | -| -------------------- | ------------ | +| Error | Signature | +|-------|-----------| | `InsufficientFees()` | `0x8d53e553` | -| `FeeTooLow()` | `0x732f9413` | +| `FeeTooLow()` | `0x732f9413` | ## protocol/SocketUtils.sol -| Error | Signature | -| -------------------- | ------------ | -| `OnlyOffChain()` | `0x9cbfe066` | +| Error | Signature | +|-------|-----------| +| `OnlyOffChain()` | `0x9cbfe066` | | `SimulationFailed()` | `0x2fbab3ac` | ## protocol/base/MessagePlugBase.sol -| Error | Signature | -| ---------------- | ------------ | +| Error | Signature | +|-------|-----------| | `NotSupported()` | `0xa0387940` | ## protocol/switchboard/CCTPSwitchboard.sol -| Error | Signature | -| ------------------------------- | ------------ | -| `RemoteExecutionNotFound()` | `0xbd506972` | +| Error | Signature | +|-------|-----------| +| `RemoteExecutionNotFound()` | `0xbd506972` | | `PrevBatchDigestHashMismatch()` | `0xc9864e9d` | -| `NotAttested()` | `0x99efb890` | -| `NotExecuted()` | `0xec84b1da` | -| `InvalidSender()` | `0xddb5de5e` | -| `OnlyMessageTransmitter()` | `0x935ac89c` | +| `NotAttested()` | `0x99efb890` | +| `NotExecuted()` | `0xec84b1da` | +| `InvalidSender()` | `0xddb5de5e` | +| `OnlyMessageTransmitter()` | `0x935ac89c` | ## protocol/switchboard/FastSwitchboard.sol -| Error | Signature | -| ------------------- | ------------ | +| Error | Signature | +|-------|-----------| | `AlreadyAttested()` | `0x35d90805` | | `WatcherNotFound()` | `0xa278e4ad` | ## protocol/switchboard/MessageSwitchboard.sol -| Error | Signature | -| ----------------------------- | ------------ | -| `AlreadyAttested()` | `0x35d90805` | -| `WatcherNotFound()` | `0xa278e4ad` | -| `SiblingNotFound()` | `0xb3b47851` | +| Error | Signature | +|-------|-----------| +| `AlreadyAttested()` | `0x35d90805` | +| `WatcherNotFound()` | `0xa278e4ad` | +| `SiblingNotFound()` | `0xb3b47851` | | `InvalidTargetVerification()` | `0xe9377a19` | -| `InvalidMsgValue()` | `0x1841b4e1` | +| `InvalidMsgValue()` | `0x1841b4e1` | ## utils/AccessControl.sol -| Error | Signature | -| ------------------- | ------------ | +| Error | Signature | +|-------|-----------| | `NoPermit(bytes32)` | `0x962f6333` | ## utils/common/Converters.sol -| Error | Signature | -| -------------------------- | ------------ | +| Error | Signature | +|-------|-----------| | `NotAnEvmAddress(bytes32)` | `0x33b960d0` | ## utils/common/Errors.sol -| Error | Signature | -| --------------------------------------------- | ------------ | -| `ZeroAddress()` | `0xd92e233d` | -| `InvalidTransmitter()` | `0x58a70a0a` | -| `InvalidTokenAddress()` | `0x1eb00b06` | -| `InvalidSwitchboard()` | `0xf63c9e4d` | -| `SocketAlreadyInitialized()` | `0xc9500b00` | -| `NotSocket()` | `0xc59f8f7c` | -| `PlugNotFound()` | `0x5f1ac76a` | -| `ResolvingScheduleTooEarly()` | `0x207e8731` | -| `CallFailed()` | `0x3204506f` | -| `InvalidAppGateway()` | `0x82ded261` | -| `AppGatewayAlreadyCalled()` | `0xb224683f` | -| `InvalidCallerTriggered()` | `0x3292d247` | -| `InvalidPromise()` | `0x45f2d176` | -| `InvalidWatcherSignature()` | `0x5029f14f` | -| `NonceUsed()` | `0x1f6d5aef` | -| `AsyncModifierNotSet()` | `0xcae106f9` | -| `WatcherNotSet()` | `0x42d473a7` | -| `InvalidTarget()` | `0x82d5d76a` | -| `InvalidIndex()` | `0x63df8171` | -| `InvalidChainSlug()` | `0xbff6b106` | -| `InvalidPayloadSize()` | `0xfbdf7954` | -| `InvalidOnChainAddress()` | `0xb758c606` | -| `InvalidScheduleDelay()` | `0x9a993219` | -| `AuctionClosed()` | `0x36b6b46d` | -| `AuctionNotOpen()` | `0xf0460077` | -| `BidExceedsMaxFees()` | `0x4c923f3c` | -| `LowerBidAlreadyExists()` | `0xaaa1f709` | -| `RequestCountMismatch()` | `0x98bbcbff` | -| `InvalidAmount()` | `0x2c5211c6` | -| `InsufficientCreditsAvailable()` | `0xe61dc0aa` | -| `InsufficientBalance()` | `0xf4d678b8` | -| `InvalidCaller()` | `0x48f5c3ed` | -| `InvalidGateway()` | `0xfc9dfe85` | -| `RequestAlreadyCancelled()` | `0xc70f47d8` | -| `DeadlineNotPassedForOnChainRevert()` | `0x7006aa10` | -| `InvalidBid()` | `0xc6388ef7` | -| `MaxReAuctionCountReached()` | `0xf2b4388c` | -| `MaxMsgValueLimitExceeded()` | `0x97b4e8ce` | -| `OnlyWatcherAllowed()` | `0xdf7d227c` | -| `InvalidPrecompileData()` | `0x320062c0` | -| `InvalidCallType()` | `0x39d2eb55` | -| `NotRequestHandler()` | `0x8f8cba5b` | -| `NotInvoker()` | `0x8a6353d1` | -| `NotPromiseResolver()` | `0x86d876b2` | -| `RequestPayloadCountLimitExceeded()` | `0xcbef144b` | -| `InsufficientFees()` | `0x8d53e553` | -| `RequestAlreadySettled()` | `0x66fad465` | -| `NoWriteRequest()` | `0x9dcd3065` | -| `AlreadyAssigned()` | `0x9688dc51` | -| `OnlyAppGateway()` | `0xfec944ea` | +| Error | Signature | +|-------|-----------| +| `ZeroAddress()` | `0xd92e233d` | +| `InvalidTransmitter()` | `0x58a70a0a` | +| `InvalidTokenAddress()` | `0x1eb00b06` | +| `InvalidSwitchboard()` | `0xf63c9e4d` | +| `SocketAlreadyInitialized()` | `0xc9500b00` | +| `NotSocket()` | `0xc59f8f7c` | +| `PlugNotFound()` | `0x5f1ac76a` | +| `ResolvingScheduleTooEarly()` | `0x207e8731` | +| `CallFailed()` | `0x3204506f` | +| `InvalidAppGateway()` | `0x82ded261` | +| `AppGatewayAlreadyCalled()` | `0xb224683f` | +| `InvalidCallerTriggered()` | `0x3292d247` | +| `InvalidPromise()` | `0x45f2d176` | +| `InvalidWatcherSignature()` | `0x5029f14f` | +| `NonceUsed()` | `0x1f6d5aef` | +| `AsyncModifierNotSet()` | `0xcae106f9` | +| `WatcherNotSet()` | `0x42d473a7` | +| `InvalidTarget()` | `0x82d5d76a` | +| `InvalidIndex()` | `0x63df8171` | +| `InvalidChainSlug()` | `0xbff6b106` | +| `InvalidPayloadSize()` | `0xfbdf7954` | +| `InvalidOnChainAddress()` | `0xb758c606` | +| `InvalidScheduleDelay()` | `0x9a993219` | +| `AuctionClosed()` | `0x36b6b46d` | +| `AuctionNotOpen()` | `0xf0460077` | +| `BidExceedsMaxFees()` | `0x4c923f3c` | +| `LowerBidAlreadyExists()` | `0xaaa1f709` | +| `RequestCountMismatch()` | `0x98bbcbff` | +| `InvalidAmount()` | `0x2c5211c6` | +| `InsufficientCreditsAvailable()` | `0xe61dc0aa` | +| `InsufficientBalance()` | `0xf4d678b8` | +| `InvalidCaller()` | `0x48f5c3ed` | +| `InvalidGateway()` | `0xfc9dfe85` | +| `RequestAlreadyCancelled()` | `0xc70f47d8` | +| `DeadlineNotPassedForOnChainRevert()` | `0x7006aa10` | +| `InvalidBid()` | `0xc6388ef7` | +| `MaxReAuctionCountReached()` | `0xf2b4388c` | +| `MaxMsgValueLimitExceeded()` | `0x97b4e8ce` | +| `OnlyWatcherAllowed()` | `0xdf7d227c` | +| `InvalidPrecompileData()` | `0x320062c0` | +| `InvalidCallType()` | `0x39d2eb55` | +| `NotRequestHandler()` | `0x8f8cba5b` | +| `NotInvoker()` | `0x8a6353d1` | +| `NotPromiseResolver()` | `0x86d876b2` | +| `RequestPayloadCountLimitExceeded()` | `0xcbef144b` | +| `InsufficientFees()` | `0x8d53e553` | +| `RequestAlreadySettled()` | `0x66fad465` | +| `NoWriteRequest()` | `0x9dcd3065` | +| `AlreadyAssigned()` | `0x9688dc51` | +| `OnlyAppGateway()` | `0xfec944ea` | | `NewMaxFeesLowerThanCurrent(uint256,uint256)` | `0x1345dda1` | -| `InvalidContract()` | `0x6eefed20` | -| `InvalidData()` | `0x5cb045db` | -| `InvalidSignature()` | `0x8baa579f` | -| `DeadlinePassed()` | `0x70f65caa` | -| `OnlyRequestHandlerAllowed()` | `0x5c1aa683` | -| `OnlyPromiseResolverAllowed()` | `0x2392c25e` | -| `InvalidReceiver()` | `0x1e4ec46b` | +| `InvalidContract()` | `0x6eefed20` | +| `InvalidData()` | `0x5cb045db` | +| `InvalidSignature()` | `0x8baa579f` | +| `DeadlinePassed()` | `0x70f65caa` | +| `OnlyRequestHandlerAllowed()` | `0x5c1aa683` | +| `OnlyPromiseResolverAllowed()` | `0x2392c25e` | +| `InvalidReceiver()` | `0x1e4ec46b` | diff --git a/EventTopics.md b/EventTopics.md index 9c39c004..07e8e7f5 100644 --- a/EventTopics.md +++ b/EventTopics.md @@ -2,41 +2,41 @@ ## AuctionManager -| Event | Arguments | Topic | -| ---------------------------- | ------------------------------------------- | -------------------------------------------------------------------- | -| `AuctionEndDelaySecondsSet` | `(auctionEndDelaySeconds: uint256)` | `0xf38f0d9dc8459cf5426728c250d115196a4c065ebc1a6c29da24764a8c0da722` | -| `AuctionEnded` | `(requestCount: uint40, winningBid: tuple)` | `0xede4ec1efc469fac10dcb4930f70be4cd21f3700ed61c91967c19a7cd7c0d86e` | -| `AuctionRestarted` | `(requestCount: uint40)` | `0x071867b21946ec4655665f0d4515d3757a5a52f144c762ecfdfb11e1da542b82` | -| `AuctionStarted` | `(requestCount: uint40)` | `0xcd040613cf8ef0cfcaa3af0d711783e827a275fc647c116b74595bf17cb9364f` | -| `BidPlaced` | `(requestCount: uint40, bid: tuple)` | `0x7f79485e4c9aeea5d4899bc6f7c63b22ac1f4c01d2d28c801e94732fee657b5d` | -| `Initialized` | `(version: uint64)` | `0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2` | -| `MaxReAuctionCountSet` | `(maxReAuctionCount: uint256)` | `0x2f6fadde7ab8ab83d21ab10c3bc09dde179f8696d47c4176581facf0c6f96bbf` | -| `OwnershipHandoverCanceled` | `(pendingOwner: address)` | `0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92` | -| `OwnershipHandoverRequested` | `(pendingOwner: address)` | `0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d` | -| `OwnershipTransferred` | `(oldOwner: address, newOwner: address)` | `0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0` | -| `RoleGranted` | `(role: bytes32, grantee: address)` | `0x2ae6a113c0ed5b78a53413ffbb7679881f11145ccfba4fb92e863dfcd5a1d2f3` | -| `RoleRevoked` | `(role: bytes32, revokee: address)` | `0x155aaafb6329a2098580462df33ec4b7441b19729b9601c5fc17ae1cf99a8a52` | +| Event | Arguments | Topic | +| ----- | --------- | ----- | +| `AuctionEndDelaySecondsSet` | `(auctionEndDelaySeconds: uint256)` | `0xf38f0d9dc8459cf5426728c250d115196a4c065ebc1a6c29da24764a8c0da722` | +| `AuctionEnded` | `(requestCount: uint40, winningBid: tuple)` | `0xede4ec1efc469fac10dcb4930f70be4cd21f3700ed61c91967c19a7cd7c0d86e` | +| `AuctionRestarted` | `(requestCount: uint40)` | `0x071867b21946ec4655665f0d4515d3757a5a52f144c762ecfdfb11e1da542b82` | +| `AuctionStarted` | `(requestCount: uint40)` | `0xcd040613cf8ef0cfcaa3af0d711783e827a275fc647c116b74595bf17cb9364f` | +| `BidPlaced` | `(requestCount: uint40, bid: tuple)` | `0x7f79485e4c9aeea5d4899bc6f7c63b22ac1f4c01d2d28c801e94732fee657b5d` | +| `Initialized` | `(version: uint64)` | `0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2` | +| `MaxReAuctionCountSet` | `(maxReAuctionCount: uint256)` | `0x2f6fadde7ab8ab83d21ab10c3bc09dde179f8696d47c4176581facf0c6f96bbf` | +| `OwnershipHandoverCanceled` | `(pendingOwner: address)` | `0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92` | +| `OwnershipHandoverRequested` | `(pendingOwner: address)` | `0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d` | +| `OwnershipTransferred` | `(oldOwner: address, newOwner: address)` | `0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0` | +| `RoleGranted` | `(role: bytes32, grantee: address)` | `0x2ae6a113c0ed5b78a53413ffbb7679881f11145ccfba4fb92e863dfcd5a1d2f3` | +| `RoleRevoked` | `(role: bytes32, revokee: address)` | `0x155aaafb6329a2098580462df33ec4b7441b19729b9601c5fc17ae1cf99a8a52` | ## Socket -| Event | Arguments | Topic | -| ---------------------------- | --------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------- | -| `AppGatewayCallRequested` | `(triggerId: bytes32, appGatewayId: bytes32, switchboardId: uint64, plug: bytes32, overrides: bytes, payload: bytes)` | `0x8ff0599581fd62c5733e52cea3abd7874731f4a9f86ebb929e5e4afe103f74d4` | -| `ExecutionFailed` | `(payloadId: bytes32, exceededMaxCopy: bool, returnData: bytes)` | `0x385334bc68a32c4d164625189adc7633e6074eb1b837fb4d11d768245151e4ce` | -| `ExecutionSuccess` | `(payloadId: bytes32, exceededMaxCopy: bool, returnData: bytes)` | `0x324d63a433b21a12b90e79cd2ba736b2a5238be6165e03b750fa4a7d5193d5d9` | -| `GasLimitBufferUpdated` | `(gasLimitBuffer: uint256)` | `0xd0e3eb5d0d212f0a08af2be98373721fc901ed26fbac645e08bd664fef818366` | -| `MaxCopyBytesUpdated` | `(maxCopyBytes: uint16)` | `0x294d0c11af52572317e5a0e1362cbf85b3b7c1f7b3f6c7b7e3e5c29c76da33e2` | -| `OwnershipHandoverCanceled` | `(pendingOwner: address)` | `0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92` | -| `OwnershipHandoverRequested` | `(pendingOwner: address)` | `0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d` | -| `OwnershipTransferred` | `(oldOwner: address, newOwner: address)` | `0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0` | -| `PlugConnected` | `(plug: address, appGatewayId: bytes32, switchboardId: uint64)` | `0xb2a45daaee4fc6ced936700efec176684095e7b77c4cb1419b578ecc6f2ebce6` | -| `PlugDisconnected` | `(plug: address)` | `0x474a53f61630e976f47075b6029ba8d55d0563151bdb9222c5dbdc88f7af6f51` | -| `RoleGranted` | `(role: bytes32, grantee: address)` | `0x2ae6a113c0ed5b78a53413ffbb7679881f11145ccfba4fb92e863dfcd5a1d2f3` | -| `RoleRevoked` | `(role: bytes32, revokee: address)` | `0x155aaafb6329a2098580462df33ec4b7441b19729b9601c5fc17ae1cf99a8a52` | -| `SocketFeeManagerUpdated` | `(oldSocketFeeManager: address, newSocketFeeManager: address)` | `0xdcb02e10d5220346a4638aa2826eaab1897306623bc40a427049e4ebd12255b4` | -| `SwitchboardAdded` | `(switchboard: address, switchboardId: uint64)` | `0x2f945cce0a82eacc4841d996b3d0429e01c7c603f3f900253d21b428c760dce1` | -| `SwitchboardDisabled` | `(switchboardId: uint64)` | `0x9ab25a32266417ee52a390121ebca0463374e76cecb25596a0f68e9d96a9e0ff` | -| `SwitchboardEnabled` | `(switchboardId: uint64)` | `0xa1cea6c3e73c288db1f2e2d7f04d9fd5f12463c30019b4ed354ba8bc7bc26f28` | +| Event | Arguments | Topic | +| ----- | --------- | ----- | +| `AppGatewayCallRequested` | `(triggerId: bytes32, appGatewayId: bytes32, switchboardId: uint64, plug: bytes32, overrides: bytes, payload: bytes)` | `0x8ff0599581fd62c5733e52cea3abd7874731f4a9f86ebb929e5e4afe103f74d4` | +| `ExecutionFailed` | `(payloadId: bytes32, exceededMaxCopy: bool, returnData: bytes)` | `0x385334bc68a32c4d164625189adc7633e6074eb1b837fb4d11d768245151e4ce` | +| `ExecutionSuccess` | `(payloadId: bytes32, exceededMaxCopy: bool, returnData: bytes)` | `0x324d63a433b21a12b90e79cd2ba736b2a5238be6165e03b750fa4a7d5193d5d9` | +| `GasLimitBufferUpdated` | `(gasLimitBuffer: uint256)` | `0xd0e3eb5d0d212f0a08af2be98373721fc901ed26fbac645e08bd664fef818366` | +| `MaxCopyBytesUpdated` | `(maxCopyBytes: uint16)` | `0x294d0c11af52572317e5a0e1362cbf85b3b7c1f7b3f6c7b7e3e5c29c76da33e2` | +| `OwnershipHandoverCanceled` | `(pendingOwner: address)` | `0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92` | +| `OwnershipHandoverRequested` | `(pendingOwner: address)` | `0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d` | +| `OwnershipTransferred` | `(oldOwner: address, newOwner: address)` | `0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0` | +| `PlugConnected` | `(plug: address, appGatewayId: bytes32, switchboardId: uint64)` | `0xb2a45daaee4fc6ced936700efec176684095e7b77c4cb1419b578ecc6f2ebce6` | +| `PlugDisconnected` | `(plug: address)` | `0x474a53f61630e976f47075b6029ba8d55d0563151bdb9222c5dbdc88f7af6f51` | +| `RoleGranted` | `(role: bytes32, grantee: address)` | `0x2ae6a113c0ed5b78a53413ffbb7679881f11145ccfba4fb92e863dfcd5a1d2f3` | +| `RoleRevoked` | `(role: bytes32, revokee: address)` | `0x155aaafb6329a2098580462df33ec4b7441b19729b9601c5fc17ae1cf99a8a52` | +| `SocketFeeManagerUpdated` | `(oldSocketFeeManager: address, newSocketFeeManager: address)` | `0xdcb02e10d5220346a4638aa2826eaab1897306623bc40a427049e4ebd12255b4` | +| `SwitchboardAdded` | `(switchboard: address, switchboardId: uint64)` | `0x2f945cce0a82eacc4841d996b3d0429e01c7c603f3f900253d21b428c760dce1` | +| `SwitchboardDisabled` | `(switchboardId: uint64)` | `0x9ab25a32266417ee52a390121ebca0463374e76cecb25596a0f68e9d96a9e0ff` | +| `SwitchboardEnabled` | `(switchboardId: uint64)` | `0xa1cea6c3e73c288db1f2e2d7f04d9fd5f12463c30019b4ed354ba8bc7bc26f28` | ## IFastSwitchboard @@ -45,214 +45,222 @@ ## SocketBatcher -| Event | Arguments | Topic | -| ---------------------------- | ---------------------------------------- | -------------------------------------------------------------------- | -| `OwnershipHandoverCanceled` | `(pendingOwner: address)` | `0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92` | -| `OwnershipHandoverRequested` | `(pendingOwner: address)` | `0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d` | -| `OwnershipTransferred` | `(oldOwner: address, newOwner: address)` | `0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0` | +| Event | Arguments | Topic | +| ----- | --------- | ----- | +| `OwnershipHandoverCanceled` | `(pendingOwner: address)` | `0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92` | +| `OwnershipHandoverRequested` | `(pendingOwner: address)` | `0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d` | +| `OwnershipTransferred` | `(oldOwner: address, newOwner: address)` | `0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0` | ## SocketFeeManager -| Event | Arguments | Topic | -| ---------------------------- | ---------------------------------------- | -------------------------------------------------------------------- | -| `OwnershipHandoverCanceled` | `(pendingOwner: address)` | `0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92` | -| `OwnershipHandoverRequested` | `(pendingOwner: address)` | `0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d` | -| `OwnershipTransferred` | `(oldOwner: address, newOwner: address)` | `0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0` | -| `RoleGranted` | `(role: bytes32, grantee: address)` | `0x2ae6a113c0ed5b78a53413ffbb7679881f11145ccfba4fb92e863dfcd5a1d2f3` | -| `RoleRevoked` | `(role: bytes32, revokee: address)` | `0x155aaafb6329a2098580462df33ec4b7441b19729b9601c5fc17ae1cf99a8a52` | -| `SocketFeesUpdated` | `(oldFees: uint256, newFees: uint256)` | `0xcbd4d756fb6198bbcc2e4013cce929f504ad46e9d97c543ef9a8dfea3e407053` | +| Event | Arguments | Topic | +| ----- | --------- | ----- | +| `OwnershipHandoverCanceled` | `(pendingOwner: address)` | `0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92` | +| `OwnershipHandoverRequested` | `(pendingOwner: address)` | `0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d` | +| `OwnershipTransferred` | `(oldOwner: address, newOwner: address)` | `0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0` | +| `RoleGranted` | `(role: bytes32, grantee: address)` | `0x2ae6a113c0ed5b78a53413ffbb7679881f11145ccfba4fb92e863dfcd5a1d2f3` | +| `RoleRevoked` | `(role: bytes32, revokee: address)` | `0x155aaafb6329a2098580462df33ec4b7441b19729b9601c5fc17ae1cf99a8a52` | +| `SocketFeesUpdated` | `(oldFees: uint256, newFees: uint256)` | `0xcbd4d756fb6198bbcc2e4013cce929f504ad46e9d97c543ef9a8dfea3e407053` | ## FeesManager -| Event | Arguments | Topic | -| ----------------------------- | ------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------- | -| `Approval` | `(owner: address, spender: address, amount: uint256)` | `0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925` | -| `CreditsBlocked` | `(requestCount: uint40, consumeFrom: address, amount: uint256)` | `0xf037c15aef41440aa823cf1fdeaea332105d8b23d52557f6670189b5d76f1eed` | -| `CreditsUnblocked` | `(requestCount: uint40, consumeFrom: address)` | `0x45db29ef2701319155cac058aa2f56ce1f73e0e238161d3db9f8c9a47655210d` | -| `CreditsUnblockedAndAssigned` | `(requestCount: uint40, consumeFrom: address, transmitter: address, amount: uint256)` | `0x38fd327622576a468e1b2818b00f50c8854703633ef8e583e1f31662888ffac2` | -| `CreditsUnwrapped` | `(consumeFrom: address, amount: uint256)` | `0xdcc9473b722b4c953617ab373840b365298a520bc7f20ce94fa7314f4a857774` | -| `CreditsWrapped` | `(consumeFrom: address, amount: uint256)` | `0x40246503613721eb4acf4020c6c56b6a16e5d08713316db0bea5210e8819c592` | -| `Deposited` | `(chainSlug: uint32, token: address, depositTo: address, creditAmount: uint256, nativeAmount: uint256)` | `0x72aedd284699bbd7a987e6942b824cfd6c627e354cb5a0760ac5768acd473f4a` | -| `FeesPlugSet` | `(chainSlug: uint32, feesPlug: bytes32)` | `0x677a00737c8099aa9e6c554104ca7941deb59125335cfb3d0d9f604f178db59c` | -| `FeesPoolSet` | `(feesPool: address)` | `0xd07af3fd70b48ab3c077a8d45c3a288498d905d0e3d1e65bc171f6c2e890d8ef` | -| `Initialized` | `(version: uint64)` | `0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2` | -| `MaxFeesPerChainSlugSet` | `(chainSlug: uint32, fees: uint256)` | `0x555c0e83b1803127d009074a9b66632defb06a95449961404b3d454d6181b137` | -| `OwnershipHandoverCanceled` | `(pendingOwner: address)` | `0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92` | -| `OwnershipHandoverRequested` | `(pendingOwner: address)` | `0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d` | -| `OwnershipTransferred` | `(oldOwner: address, newOwner: address)` | `0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0` | -| `SusdcTokenSet` | `(chainSlug: uint32, susdcToken: bytes32)` | `0xa268c0ce0f78082ba676c10a8a79a2785e196d85b3e883f8368f663536189525` | -| `Transfer` | `(from: address, to: address, amount: uint256)` | `0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef` | -| `WhitelistedReceiverSet` | `(receiver: address, isWhitelisted: bool)` | `0x1fc608eb6791d1ef5d49904b6fc17867efb0319743013f69d29403e20741e53b` | -| `WithdrawFailed` | `(payloadId: bytes32)` | `0xea147eb2109f71b4bda9e57528ba08b84821087a31cb43a7851dc6ff743d9be7` | +| Event | Arguments | Topic | +| ----- | --------- | ----- | +| `Approval` | `(owner: address, spender: address, amount: uint256)` | `0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925` | +| `CreditsBlocked` | `(requestCount: uint40, consumeFrom: address, amount: uint256)` | `0xf037c15aef41440aa823cf1fdeaea332105d8b23d52557f6670189b5d76f1eed` | +| `CreditsUnblocked` | `(requestCount: uint40, consumeFrom: address)` | `0x45db29ef2701319155cac058aa2f56ce1f73e0e238161d3db9f8c9a47655210d` | +| `CreditsUnblockedAndAssigned` | `(requestCount: uint40, consumeFrom: address, transmitter: address, amount: uint256)` | `0x38fd327622576a468e1b2818b00f50c8854703633ef8e583e1f31662888ffac2` | +| `CreditsUnwrapped` | `(consumeFrom: address, amount: uint256)` | `0xdcc9473b722b4c953617ab373840b365298a520bc7f20ce94fa7314f4a857774` | +| `CreditsWrapped` | `(consumeFrom: address, amount: uint256)` | `0x40246503613721eb4acf4020c6c56b6a16e5d08713316db0bea5210e8819c592` | +| `Deposited` | `(chainSlug: uint32, token: bytes32, depositToEVMxAddress: address, creditAmount: uint256, nativeAmount: uint256)` | `0xaf5f5fe7e3a90d5dfb5b19922194db93ca79fd0deba4dfc677fdb6eaee590206` | +| `FeesPlugSet` | `(chainSlug: uint32, feesPlug: bytes32)` | `0x677a00737c8099aa9e6c554104ca7941deb59125335cfb3d0d9f604f178db59c` | +| `FeesPlugSolanaSet` | `(feesPlugSolanaProgramId: bytes32)` | `0x1ef21861e65f3e05aa757701da35284dbcda30a87e5b3d368ec3dbd083903d75` | +| `FeesPoolSet` | `(feesPool: address)` | `0xd07af3fd70b48ab3c077a8d45c3a288498d905d0e3d1e65bc171f6c2e890d8ef` | +| `Initialized` | `(version: uint64)` | `0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2` | +| `MaxFeesPerChainSlugSet` | `(chainSlug: uint32, fees: uint256)` | `0x555c0e83b1803127d009074a9b66632defb06a95449961404b3d454d6181b137` | +| `OwnershipHandoverCanceled` | `(pendingOwner: address)` | `0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92` | +| `OwnershipHandoverRequested` | `(pendingOwner: address)` | `0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d` | +| `OwnershipTransferred` | `(oldOwner: address, newOwner: address)` | `0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0` | +| `SusdcTokenSet` | `(chainSlug: uint32, susdcContractId: bytes32)` | `0xa268c0ce0f78082ba676c10a8a79a2785e196d85b3e883f8368f663536189525` | +| `Transfer` | `(from: address, to: address, amount: uint256)` | `0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef` | +| `WhitelistedReceiverSet` | `(receiver: address, isWhitelisted: bool)` | `0x1fc608eb6791d1ef5d49904b6fc17867efb0319743013f69d29403e20741e53b` | +| `WithdrawFailed` | `(payloadId: bytes32)` | `0xea147eb2109f71b4bda9e57528ba08b84821087a31cb43a7851dc6ff743d9be7` | ## FeesPool -| Event | Arguments | Topic | -| ---------------------------- | ----------------------------------------------- | -------------------------------------------------------------------- | -| `NativeDeposited` | `(from: address, amount: uint256)` | `0xb5d7700fb0cf415158b8db7cc7c39f0eab16a825c92e221404b4c8bb099b4bbb` | -| `NativeWithdrawn` | `(success: bool, to: address, amount: uint256)` | `0xa81f1c8490022ee829d2e1a231053f5dbecad46caee71f6ea38a9db663a3f12b` | -| `OwnershipHandoverCanceled` | `(pendingOwner: address)` | `0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92` | -| `OwnershipHandoverRequested` | `(pendingOwner: address)` | `0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d` | -| `OwnershipTransferred` | `(oldOwner: address, newOwner: address)` | `0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0` | -| `RoleGranted` | `(role: bytes32, grantee: address)` | `0x2ae6a113c0ed5b78a53413ffbb7679881f11145ccfba4fb92e863dfcd5a1d2f3` | -| `RoleRevoked` | `(role: bytes32, revokee: address)` | `0x155aaafb6329a2098580462df33ec4b7441b19729b9601c5fc17ae1cf99a8a52` | +| Event | Arguments | Topic | +| ----- | --------- | ----- | +| `NativeDeposited` | `(from: address, amount: uint256)` | `0xb5d7700fb0cf415158b8db7cc7c39f0eab16a825c92e221404b4c8bb099b4bbb` | +| `NativeWithdrawn` | `(success: bool, to: address, amount: uint256)` | `0xa81f1c8490022ee829d2e1a231053f5dbecad46caee71f6ea38a9db663a3f12b` | +| `OwnershipHandoverCanceled` | `(pendingOwner: address)` | `0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92` | +| `OwnershipHandoverRequested` | `(pendingOwner: address)` | `0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d` | +| `OwnershipTransferred` | `(oldOwner: address, newOwner: address)` | `0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0` | +| `RoleGranted` | `(role: bytes32, grantee: address)` | `0x2ae6a113c0ed5b78a53413ffbb7679881f11145ccfba4fb92e863dfcd5a1d2f3` | +| `RoleRevoked` | `(role: bytes32, revokee: address)` | `0x155aaafb6329a2098580462df33ec4b7441b19729b9601c5fc17ae1cf99a8a52` | ## AddressResolver -| Event | Arguments | Topic | -| ------------------------------ | --------------------------------------------------- | -------------------------------------------------------------------- | -| `AsyncDeployerUpdated` | `(asyncDeployer_: address)` | `0x4df9cdd01544e8f6b0326650bc0b55611f47ce5ba2faa522d21fb675e9fc1f73` | -| `ContractAddressUpdated` | `(contractId_: bytes32, contractAddress_: address)` | `0xdf5ec2c15e11ce657bb21bc09c0b5ba95e315b4dba9934c6e311f47559babf28` | -| `DefaultAuctionManagerUpdated` | `(defaultAuctionManager_: address)` | `0x60f296739208a505ead7fb622df0f76b7791b824481b120a2300bdaf85e3e3d6` | -| `DeployForwarderUpdated` | `(deployForwarder_: address)` | `0x237b9bc9fef7508a02ca9ccca81f6965e500064a58024cae1218035da865fd2b` | -| `FeesManagerUpdated` | `(feesManager_: address)` | `0x94e67aa1341a65767dfde81e62fd265bfbade1f5744bfd3cd73f99a6eca0572a` | -| `Initialized` | `(version: uint64)` | `0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2` | -| `OwnershipHandoverCanceled` | `(pendingOwner: address)` | `0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92` | -| `OwnershipHandoverRequested` | `(pendingOwner: address)` | `0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d` | -| `OwnershipTransferred` | `(oldOwner: address, newOwner: address)` | `0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0` | -| `WatcherUpdated` | `(watcher_: address)` | `0xc13081d38d92b454cdb6ca20bbc65c12fa43a7a14a1529204ced5b6350052bb0` | +| Event | Arguments | Topic | +| ----- | --------- | ----- | +| `AsyncDeployerUpdated` | `(asyncDeployer_: address)` | `0x4df9cdd01544e8f6b0326650bc0b55611f47ce5ba2faa522d21fb675e9fc1f73` | +| `ContractAddressUpdated` | `(contractId_: bytes32, contractAddress_: address)` | `0xdf5ec2c15e11ce657bb21bc09c0b5ba95e315b4dba9934c6e311f47559babf28` | +| `DefaultAuctionManagerUpdated` | `(defaultAuctionManager_: address)` | `0x60f296739208a505ead7fb622df0f76b7791b824481b120a2300bdaf85e3e3d6` | +| `DeployForwarderUpdated` | `(deployForwarder_: address)` | `0x237b9bc9fef7508a02ca9ccca81f6965e500064a58024cae1218035da865fd2b` | +| `FeesManagerUpdated` | `(feesManager_: address)` | `0x94e67aa1341a65767dfde81e62fd265bfbade1f5744bfd3cd73f99a6eca0572a` | +| `Initialized` | `(version: uint64)` | `0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2` | +| `OwnershipHandoverCanceled` | `(pendingOwner: address)` | `0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92` | +| `OwnershipHandoverRequested` | `(pendingOwner: address)` | `0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d` | +| `OwnershipTransferred` | `(oldOwner: address, newOwner: address)` | `0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0` | +| `WatcherUpdated` | `(watcher_: address)` | `0xc13081d38d92b454cdb6ca20bbc65c12fa43a7a14a1529204ced5b6350052bb0` | ## AsyncDeployer -| Event | Arguments | Topic | -| ---------------------------- | ---------------------------------------------------- | -------------------------------------------------------------------- | -| `AsyncPromiseDeployed` | `(newAsyncPromise: address, salt: bytes32)` | `0xb6c5491cf83e09749b1a4dd6a9f07b0e925fcb0a915ac8c2b40e8ab28191c270` | -| `ForwarderDeployed` | `(newForwarder: address, salt: bytes32)` | `0x4dbbecb9cf9c8b93da9743a2b48ea52efe68d69230ab1c1b711891d9d223b29f` | -| `ImplementationUpdated` | `(contractName: string, newImplementation: address)` | `0xa1e41aa2c2f3f20d9b63ac06b634d2788768d6034f3d9192cdf7d07374bb16f4` | -| `Initialized` | `(version: uint64)` | `0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2` | -| `OwnershipHandoverCanceled` | `(pendingOwner: address)` | `0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92` | -| `OwnershipHandoverRequested` | `(pendingOwner: address)` | `0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d` | -| `OwnershipTransferred` | `(oldOwner: address, newOwner: address)` | `0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0` | +| Event | Arguments | Topic | +| ----- | --------- | ----- | +| `AsyncPromiseDeployed` | `(newAsyncPromise: address, salt: bytes32)` | `0xb6c5491cf83e09749b1a4dd6a9f07b0e925fcb0a915ac8c2b40e8ab28191c270` | +| `ForwarderDeployed` | `(newForwarder: address, salt: bytes32)` | `0x4dbbecb9cf9c8b93da9743a2b48ea52efe68d69230ab1c1b711891d9d223b29f` | +| `ImplementationUpdated` | `(contractName: string, newImplementation: address)` | `0xa1e41aa2c2f3f20d9b63ac06b634d2788768d6034f3d9192cdf7d07374bb16f4` | +| `Initialized` | `(version: uint64)` | `0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2` | +| `OwnershipHandoverCanceled` | `(pendingOwner: address)` | `0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92` | +| `OwnershipHandoverRequested` | `(pendingOwner: address)` | `0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d` | +| `OwnershipTransferred` | `(oldOwner: address, newOwner: address)` | `0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0` | ## AsyncPromise -| Event | Arguments | Topic | -| ------------- | ------------------- | -------------------------------------------------------------------- | +| Event | Arguments | Topic | +| ----- | --------- | ----- | | `Initialized` | `(version: uint64)` | `0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2` | ## DeployForwarder -| Event | Arguments | Topic | -| ---------------------------- | ---------------------------------------- | -------------------------------------------------------------------- | -| `Initialized` | `(version: uint64)` | `0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2` | -| `OwnershipHandoverCanceled` | `(pendingOwner: address)` | `0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92` | -| `OwnershipHandoverRequested` | `(pendingOwner: address)` | `0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d` | -| `OwnershipTransferred` | `(oldOwner: address, newOwner: address)` | `0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0` | +| Event | Arguments | Topic | +| ----- | --------- | ----- | +| `Initialized` | `(version: uint64)` | `0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2` | +| `OwnershipHandoverCanceled` | `(pendingOwner: address)` | `0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92` | +| `OwnershipHandoverRequested` | `(pendingOwner: address)` | `0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d` | +| `OwnershipTransferred` | `(oldOwner: address, newOwner: address)` | `0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0` | ## Forwarder -| Event | Arguments | Topic | -| ------------- | ------------------- | -------------------------------------------------------------------- | +| Event | Arguments | Topic | +| ----- | --------- | ----- | +| `Initialized` | `(version: uint64)` | `0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2` | + +## ForwarderSolana + +| Event | Arguments | Topic | +| ----- | --------- | ----- | | `Initialized` | `(version: uint64)` | `0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2` | ## ProxyFactory -| Event | Arguments | Topic | -| -------------- | ----------------------------------------------------------- | -------------------------------------------------------------------- | -| `AdminChanged` | `(proxy: address, admin: address)` | `0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f` | -| `Deployed` | `(proxy: address, implementation: address, admin: address)` | `0xc95935a66d15e0da5e412aca0ad27ae891d20b2fb91cf3994b6a3bf2b8178082` | -| `Upgraded` | `(proxy: address, implementation: address)` | `0x5d611f318680d00598bb735d61bacf0c514c6b50e1e5ad30040a4df2b12791c7` | +| Event | Arguments | Topic | +| ----- | --------- | ----- | +| `AdminChanged` | `(proxy: address, admin: address)` | `0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f` | +| `Deployed` | `(proxy: address, implementation: address, admin: address)` | `0xc95935a66d15e0da5e412aca0ad27ae891d20b2fb91cf3994b6a3bf2b8178082` | +| `Upgraded` | `(proxy: address, implementation: address)` | `0x5d611f318680d00598bb735d61bacf0c514c6b50e1e5ad30040a4df2b12791c7` | ## TestUSDC -| Event | Arguments | Topic | -| ---------- | ----------------------------------------------------- | -------------------------------------------------------------------- | +| Event | Arguments | Topic | +| ----- | --------- | ----- | | `Approval` | `(owner: address, spender: address, amount: uint256)` | `0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925` | -| `Transfer` | `(from: address, to: address, amount: uint256)` | `0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef` | +| `Transfer` | `(from: address, to: address, amount: uint256)` | `0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef` | ## ContractFactoryPlug -| Event | Arguments | Topic | -| ---------------------------- | --------------------------------------------------- | -------------------------------------------------------------------- | -| `ConnectorPlugDisconnected` | `()` | `0xc2af098c82dba3c4b00be8bda596d62d13b98a87b42626fefa67e0bb0e198fdd` | -| `Deployed` | `(addr: address, salt: bytes32, returnData: bytes)` | `0x1246c6f8fd9f4abc542c7c8c8f793cfcde6b67aed1976a38aa134fc24af2dfe3` | -| `OwnershipHandoverCanceled` | `(pendingOwner: address)` | `0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92` | -| `OwnershipHandoverRequested` | `(pendingOwner: address)` | `0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d` | -| `OwnershipTransferred` | `(oldOwner: address, newOwner: address)` | `0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0` | -| `RoleGranted` | `(role: bytes32, grantee: address)` | `0x2ae6a113c0ed5b78a53413ffbb7679881f11145ccfba4fb92e863dfcd5a1d2f3` | -| `RoleRevoked` | `(role: bytes32, revokee: address)` | `0x155aaafb6329a2098580462df33ec4b7441b19729b9601c5fc17ae1cf99a8a52` | +| Event | Arguments | Topic | +| ----- | --------- | ----- | +| `ConnectorPlugDisconnected` | `()` | `0xc2af098c82dba3c4b00be8bda596d62d13b98a87b42626fefa67e0bb0e198fdd` | +| `Deployed` | `(addr: address, salt: bytes32, returnData: bytes)` | `0x1246c6f8fd9f4abc542c7c8c8f793cfcde6b67aed1976a38aa134fc24af2dfe3` | +| `OwnershipHandoverCanceled` | `(pendingOwner: address)` | `0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92` | +| `OwnershipHandoverRequested` | `(pendingOwner: address)` | `0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d` | +| `OwnershipTransferred` | `(oldOwner: address, newOwner: address)` | `0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0` | +| `RoleGranted` | `(role: bytes32, grantee: address)` | `0x2ae6a113c0ed5b78a53413ffbb7679881f11145ccfba4fb92e863dfcd5a1d2f3` | +| `RoleRevoked` | `(role: bytes32, revokee: address)` | `0x155aaafb6329a2098580462df33ec4b7441b19729b9601c5fc17ae1cf99a8a52` | ## FeesPlug -| Event | Arguments | Topic | -| ---------------------------- | ------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------- | -| `ConnectorPlugDisconnected` | `()` | `0xc2af098c82dba3c4b00be8bda596d62d13b98a87b42626fefa67e0bb0e198fdd` | -| `FeesDeposited` | `(token: address, receiver: address, creditAmount: uint256, nativeAmount: uint256, data: bytes)` | `0x91f985f17a8632ae2e0a009d65ae250f373d82359d2389b58ea50ada6436682a` | -| `FeesWithdrawn` | `(token: address, receiver: address, amount: uint256)` | `0x5e110f8bc8a20b65dcc87f224bdf1cc039346e267118bae2739847f07321ffa8` | -| `OwnershipHandoverCanceled` | `(pendingOwner: address)` | `0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92` | -| `OwnershipHandoverRequested` | `(pendingOwner: address)` | `0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d` | -| `OwnershipTransferred` | `(oldOwner: address, newOwner: address)` | `0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0` | -| `RoleGranted` | `(role: bytes32, grantee: address)` | `0x2ae6a113c0ed5b78a53413ffbb7679881f11145ccfba4fb92e863dfcd5a1d2f3` | -| `RoleRevoked` | `(role: bytes32, revokee: address)` | `0x155aaafb6329a2098580462df33ec4b7441b19729b9601c5fc17ae1cf99a8a52` | -| `TokenRemovedFromWhitelist` | `(token: address)` | `0xdd2e6d9f52cbe8f695939d018b7d4a216dc613a669876163ac548b916489d917` | -| `TokenWhitelisted` | `(token: address)` | `0x6a65f90b1a644d2faac467a21e07e50e3f8fa5846e26231d30ae79a417d3d262` | +| Event | Arguments | Topic | +| ----- | --------- | ----- | +| `ConnectorPlugDisconnected` | `()` | `0xc2af098c82dba3c4b00be8bda596d62d13b98a87b42626fefa67e0bb0e198fdd` | +| `FeesDeposited` | `(token: address, receiver: address, creditAmount: uint256, nativeAmount: uint256, data: bytes)` | `0x91f985f17a8632ae2e0a009d65ae250f373d82359d2389b58ea50ada6436682a` | +| `FeesWithdrawn` | `(token: address, receiver: address, amount: uint256)` | `0x5e110f8bc8a20b65dcc87f224bdf1cc039346e267118bae2739847f07321ffa8` | +| `OwnershipHandoverCanceled` | `(pendingOwner: address)` | `0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92` | +| `OwnershipHandoverRequested` | `(pendingOwner: address)` | `0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d` | +| `OwnershipTransferred` | `(oldOwner: address, newOwner: address)` | `0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0` | +| `RoleGranted` | `(role: bytes32, grantee: address)` | `0x2ae6a113c0ed5b78a53413ffbb7679881f11145ccfba4fb92e863dfcd5a1d2f3` | +| `RoleRevoked` | `(role: bytes32, revokee: address)` | `0x155aaafb6329a2098580462df33ec4b7441b19729b9601c5fc17ae1cf99a8a52` | +| `TokenRemovedFromWhitelist` | `(token: address)` | `0xdd2e6d9f52cbe8f695939d018b7d4a216dc613a669876163ac548b916489d917` | +| `TokenWhitelisted` | `(token: address)` | `0x6a65f90b1a644d2faac467a21e07e50e3f8fa5846e26231d30ae79a417d3d262` | ## SUSDC -| Event | Arguments | Topic | -| ---------------------------- | ------------------------------------------------------------ | -------------------------------------------------------------------- | -| `Approval` | `(owner: address, spender: address, amount: uint256)` | `0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925` | -| `ConnectorPlugDisconnected` | `()` | `0xc2af098c82dba3c4b00be8bda596d62d13b98a87b42626fefa67e0bb0e198fdd` | -| `OwnershipHandoverCanceled` | `(pendingOwner: address)` | `0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92` | -| `OwnershipHandoverRequested` | `(pendingOwner: address)` | `0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d` | -| `OwnershipTransferred` | `(oldOwner: address, newOwner: address)` | `0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0` | -| `RoleGranted` | `(role: bytes32, grantee: address)` | `0x2ae6a113c0ed5b78a53413ffbb7679881f11145ccfba4fb92e863dfcd5a1d2f3` | -| `RoleRevoked` | `(role: bytes32, revokee: address)` | `0x155aaafb6329a2098580462df33ec4b7441b19729b9601c5fc17ae1cf99a8a52` | -| `TokensBurned` | `(from: address, to: address, amount: uint256, data: bytes)` | `0x568ab03f32147bb501e2805da5910cb00bfca97231507d615ce5326dcf93eae6` | -| `TokensMinted` | `(to: address, amount: uint256)` | `0x3f2c9d57c068687834f0de942a9babb9e5acab57d516d3480a3c16ee165a4273` | -| `Transfer` | `(from: address, to: address, amount: uint256)` | `0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef` | +| Event | Arguments | Topic | +| ----- | --------- | ----- | +| `Approval` | `(owner: address, spender: address, amount: uint256)` | `0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925` | +| `ConnectorPlugDisconnected` | `()` | `0xc2af098c82dba3c4b00be8bda596d62d13b98a87b42626fefa67e0bb0e198fdd` | +| `OwnershipHandoverCanceled` | `(pendingOwner: address)` | `0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92` | +| `OwnershipHandoverRequested` | `(pendingOwner: address)` | `0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d` | +| `OwnershipTransferred` | `(oldOwner: address, newOwner: address)` | `0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0` | +| `RoleGranted` | `(role: bytes32, grantee: address)` | `0x2ae6a113c0ed5b78a53413ffbb7679881f11145ccfba4fb92e863dfcd5a1d2f3` | +| `RoleRevoked` | `(role: bytes32, revokee: address)` | `0x155aaafb6329a2098580462df33ec4b7441b19729b9601c5fc17ae1cf99a8a52` | +| `TokensBurned` | `(from: address, to: address, amount: uint256, data: bytes)` | `0x568ab03f32147bb501e2805da5910cb00bfca97231507d615ce5326dcf93eae6` | +| `TokensMinted` | `(to: address, amount: uint256)` | `0x3f2c9d57c068687834f0de942a9babb9e5acab57d516d3480a3c16ee165a4273` | +| `Transfer` | `(from: address, to: address, amount: uint256)` | `0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef` | ## Configurations -| Event | Arguments | Topic | -| ---------------------------- | ------------------------------------------------------------------------ | -------------------------------------------------------------------- | -| `Initialized` | `(version: uint64)` | `0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2` | -| `IsValidPlugSet` | `(isValid: bool, chainSlug: uint32, plug: bytes32, appGateway: address)` | `0xdd99f9f3d0179d3845b6c9b5e020d80c32ca46007e43c43c6ab6a86cb259ed28` | -| `OwnershipHandoverCanceled` | `(pendingOwner: address)` | `0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92` | -| `OwnershipHandoverRequested` | `(pendingOwner: address)` | `0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d` | -| `OwnershipTransferred` | `(oldOwner: address, newOwner: address)` | `0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0` | -| `PlugAdded` | `(appGatewayId: bytes32, chainSlug: uint32, plug: bytes32)` | `0x3734a2406c5c2f2556c82a0819c51e42a135dd102465cc9856594481ea2f1637` | -| `SocketSet` | `(chainSlug: uint32, socket: bytes32)` | `0x3200bf6ad2ab31b9220ed9d2f83089d7a1332f55aaa3825c57510743a315165b` | -| `SwitchboardSet` | `(chainSlug: uint32, sbType: bytes32, switchboardId: uint64)` | `0x5aeb296e3ed47512d11032a96d11f93d8538b9eb87aa1db45d412e7165d6850a` | +| Event | Arguments | Topic | +| ----- | --------- | ----- | +| `Initialized` | `(version: uint64)` | `0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2` | +| `IsValidPlugSet` | `(isValid: bool, chainSlug: uint32, plug: bytes32, appGateway: address)` | `0xdd99f9f3d0179d3845b6c9b5e020d80c32ca46007e43c43c6ab6a86cb259ed28` | +| `OwnershipHandoverCanceled` | `(pendingOwner: address)` | `0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92` | +| `OwnershipHandoverRequested` | `(pendingOwner: address)` | `0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d` | +| `OwnershipTransferred` | `(oldOwner: address, newOwner: address)` | `0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0` | +| `PlugAdded` | `(appGatewayId: bytes32, chainSlug: uint32, plug: bytes32)` | `0x3734a2406c5c2f2556c82a0819c51e42a135dd102465cc9856594481ea2f1637` | +| `SocketSet` | `(chainSlug: uint32, socket: bytes32)` | `0x3200bf6ad2ab31b9220ed9d2f83089d7a1332f55aaa3825c57510743a315165b` | +| `SwitchboardSet` | `(chainSlug: uint32, sbType: bytes32, switchboardId: uint64)` | `0x5aeb296e3ed47512d11032a96d11f93d8538b9eb87aa1db45d412e7165d6850a` | +| `VerifyGateway` | `(chainSlug: uint32, plug: bytes32, appGateway: address, appGatewayId: bytes32)` | `0xfa22ddb14257be11d400b24055b9161c7843dfa7362d3d629f0028a2218c1643` | ## PromiseResolver -| Event | Arguments | Topic | -| -------------------- | ------------------------------------------------ | -------------------------------------------------------------------- | -| `MarkedRevert` | `(payloadId: bytes32, isRevertingOnchain: bool)` | `0xcf1fd844cb4d32cbebb5ca6ce4ac834fe98da3ddac44deb77fffd22ad933824c` | -| `PromiseNotResolved` | `(payloadId: bytes32, asyncPromise: address)` | `0xbcf0d0c678940566e9e64f0c871439395bd5fb5c39bca3547b126fe6ee467937` | -| `PromiseResolved` | `(payloadId: bytes32, asyncPromise: address)` | `0x1b1b5810494fb3e17f7c46547e6e67cd6ad3e6001ea6fb7d12ea0241ba13c4ba` | +| Event | Arguments | Topic | +| ----- | --------- | ----- | +| `MarkedRevert` | `(payloadId: bytes32, isRevertingOnchain: bool)` | `0xcf1fd844cb4d32cbebb5ca6ce4ac834fe98da3ddac44deb77fffd22ad933824c` | +| `PromiseNotResolved` | `(payloadId: bytes32, asyncPromise: address)` | `0xbcf0d0c678940566e9e64f0c871439395bd5fb5c39bca3547b126fe6ee467937` | +| `PromiseResolved` | `(payloadId: bytes32, asyncPromise: address)` | `0x1b1b5810494fb3e17f7c46547e6e67cd6ad3e6001ea6fb7d12ea0241ba13c4ba` | ## RequestHandler -| Event | Arguments | Topic | -| ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------- | -| `FeesIncreased` | `(requestCount: uint40, newMaxFees: uint256)` | `0xf258fca4e49b803ee2a4c2e33b6fcf18bc3982df21f111c00677025bf1ccbb6a` | -| `Initialized` | `(version: uint64)` | `0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2` | -| `OwnershipHandoverCanceled` | `(pendingOwner: address)` | `0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92` | -| `OwnershipHandoverRequested` | `(pendingOwner: address)` | `0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d` | -| `OwnershipTransferred` | `(oldOwner: address, newOwner: address)` | `0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0` | -| `PrecompileSet` | `(callType: bytes4, precompile: address)` | `0x5254189aca1b416c09dad7fb656bf0ed2c07e03ccd240bd95dfbfbaeb5e10e7b` | -| `RequestCancelled` | `(requestCount: uint40)` | `0xff191657769be72fc08def44c645014c60d18cb24b9ca05c9a33406a28253245` | -| `RequestCompletedWithErrors` | `(requestCount: uint40)` | `0xd8d9915dc14b5a29b66cb263e1ea1e99e60418fc21d97f0fbf09cae1281291e2` | -| `RequestPayloadCountLimitSet` | `(requestPayloadCountLimit: uint128)` | `0x67f58095e99ad7f9519f3b80372f6bab373a6217d08c9479fe58b80dcd5b4b7d` | -| `RequestSettled` | `(requestCount: uint40, winner: address)` | `0x1234f98acbe1548b214f4528461a5377f1e2349569c04caa59325e488e7d2aa4` | -| `RequestSubmitted` | `(hasWrite: bool, requestCount: uint40, totalEstimatedWatcherFees: uint256, requestParams: tuple, payloadParamsArray: tuple[])` | `0xb730ca5523e3f80e88b4bb71e1e78d447553069cd9a7143bb0032b957135b530` | +| Event | Arguments | Topic | +| ----- | --------- | ----- | +| `FeesIncreased` | `(requestCount: uint40, newMaxFees: uint256)` | `0xf258fca4e49b803ee2a4c2e33b6fcf18bc3982df21f111c00677025bf1ccbb6a` | +| `Initialized` | `(version: uint64)` | `0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2` | +| `OwnershipHandoverCanceled` | `(pendingOwner: address)` | `0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92` | +| `OwnershipHandoverRequested` | `(pendingOwner: address)` | `0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d` | +| `OwnershipTransferred` | `(oldOwner: address, newOwner: address)` | `0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0` | +| `PrecompileSet` | `(callType: bytes4, precompile: address)` | `0x5254189aca1b416c09dad7fb656bf0ed2c07e03ccd240bd95dfbfbaeb5e10e7b` | +| `RequestCancelled` | `(requestCount: uint40)` | `0xff191657769be72fc08def44c645014c60d18cb24b9ca05c9a33406a28253245` | +| `RequestCompletedWithErrors` | `(requestCount: uint40)` | `0xd8d9915dc14b5a29b66cb263e1ea1e99e60418fc21d97f0fbf09cae1281291e2` | +| `RequestPayloadCountLimitSet` | `(requestPayloadCountLimit: uint128)` | `0x67f58095e99ad7f9519f3b80372f6bab373a6217d08c9479fe58b80dcd5b4b7d` | +| `RequestSettled` | `(requestCount: uint40, winner: address)` | `0x1234f98acbe1548b214f4528461a5377f1e2349569c04caa59325e488e7d2aa4` | +| `RequestSubmitted` | `(hasWrite: bool, requestCount: uint40, totalEstimatedWatcherFees: uint256, requestParams: tuple, payloadParamsArray: tuple[])` | `0xb730ca5523e3f80e88b4bb71e1e78d447553069cd9a7143bb0032b957135b530` | ## Watcher -| Event | Arguments | Topic | -| ---------------------------- | ----------------------------------------------------------------------------- | -------------------------------------------------------------------- | -| `AppGatewayCallFailed` | `(triggerId: bytes32)` | `0xcaf8475fdade8465ea31672463949e6cf1797fdcdd11eeddbbaf857e1e5907b7` | -| `CalledAppGateway` | `(triggerId: bytes32)` | `0xf659ffb3875368f54fb4ab8f5412ac4518af79701a48076f7a58d4448e4bdd0b` | -| `CoreContractsSet` | `(requestHandler: address, configManager: address, promiseResolver: address)` | `0x32f3480588270473dc6418270d922a820dd9e914739e09a98241457dca2fd560` | -| `Initialized` | `(version: uint64)` | `0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2` | -| `OwnershipHandoverCanceled` | `(pendingOwner: address)` | `0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92` | -| `OwnershipHandoverRequested` | `(pendingOwner: address)` | `0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d` | -| `OwnershipTransferred` | `(oldOwner: address, newOwner: address)` | `0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0` | -| `TriggerFailed` | `(triggerId: bytes32)` | `0x4386783bb0f7cad4ba12f033dbec03dc3441e7757a122f3097a7a4d945c98040` | -| `TriggerFeesSet` | `(triggerFees: uint256)` | `0x7df3967b7c8727af5ac0ee9825d88aafeb899d769bc428b91f8967fa0b623084` | -| `TriggerSucceeded` | `(triggerId: bytes32)` | `0x92d20fbcbf31370b8218e10ed00c5aad0e689022da30a08905ba5ced053219eb` | +| Event | Arguments | Topic | +| ----- | --------- | ----- | +| `AppGatewayCallFailed` | `(triggerId: bytes32)` | `0xcaf8475fdade8465ea31672463949e6cf1797fdcdd11eeddbbaf857e1e5907b7` | +| `CalledAppGateway` | `(triggerId: bytes32)` | `0xf659ffb3875368f54fb4ab8f5412ac4518af79701a48076f7a58d4448e4bdd0b` | +| `CoreContractsSet` | `(requestHandler: address, configManager: address, promiseResolver: address)` | `0x32f3480588270473dc6418270d922a820dd9e914739e09a98241457dca2fd560` | +| `Initialized` | `(version: uint64)` | `0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2` | +| `OwnershipHandoverCanceled` | `(pendingOwner: address)` | `0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92` | +| `OwnershipHandoverRequested` | `(pendingOwner: address)` | `0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d` | +| `OwnershipTransferred` | `(oldOwner: address, newOwner: address)` | `0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0` | +| `TriggerFailed` | `(triggerId: bytes32)` | `0x4386783bb0f7cad4ba12f033dbec03dc3441e7757a122f3097a7a4d945c98040` | +| `TriggerFeesSet` | `(triggerFees: uint256)` | `0x7df3967b7c8727af5ac0ee9825d88aafeb899d769bc428b91f8967fa0b623084` | +| `TriggerSucceeded` | `(triggerId: bytes32)` | `0x92d20fbcbf31370b8218e10ed00c5aad0e689022da30a08905ba5ced053219eb` | ## IMessageSwitchboard @@ -266,71 +274,75 @@ ## CCTPSwitchboard -| Event | Arguments | Topic | -| ---------------------------- | ----------------------------------------- | -------------------------------------------------------------------- | -| `Attested` | `(payloadId_: bytes32, watcher: address)` | `0x3d83c7bc55c269e0bc853ddc0d7b9fca30216ecc43779acb4e36b7e0ad1c71e4` | -| `OwnershipHandoverCanceled` | `(pendingOwner: address)` | `0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92` | -| `OwnershipHandoverRequested` | `(pendingOwner: address)` | `0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d` | -| `OwnershipTransferred` | `(oldOwner: address, newOwner: address)` | `0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0` | -| `RoleGranted` | `(role: bytes32, grantee: address)` | `0x2ae6a113c0ed5b78a53413ffbb7679881f11145ccfba4fb92e863dfcd5a1d2f3` | -| `RoleRevoked` | `(role: bytes32, revokee: address)` | `0x155aaafb6329a2098580462df33ec4b7441b19729b9601c5fc17ae1cf99a8a52` | +| Event | Arguments | Topic | +| ----- | --------- | ----- | +| `Attested` | `(payloadId_: bytes32, watcher: address)` | `0x3d83c7bc55c269e0bc853ddc0d7b9fca30216ecc43779acb4e36b7e0ad1c71e4` | +| `OwnershipHandoverCanceled` | `(pendingOwner: address)` | `0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92` | +| `OwnershipHandoverRequested` | `(pendingOwner: address)` | `0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d` | +| `OwnershipTransferred` | `(oldOwner: address, newOwner: address)` | `0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0` | +| `RoleGranted` | `(role: bytes32, grantee: address)` | `0x2ae6a113c0ed5b78a53413ffbb7679881f11145ccfba4fb92e863dfcd5a1d2f3` | +| `RoleRevoked` | `(role: bytes32, revokee: address)` | `0x155aaafb6329a2098580462df33ec4b7441b19729b9601c5fc17ae1cf99a8a52` | ## FastSwitchboard -| Event | Arguments | Topic | -| ---------------------------- | ----------------------------------------- | -------------------------------------------------------------------- | -| `Attested` | `(payloadId_: bytes32, watcher: address)` | `0x3d83c7bc55c269e0bc853ddc0d7b9fca30216ecc43779acb4e36b7e0ad1c71e4` | -| `OwnershipHandoverCanceled` | `(pendingOwner: address)` | `0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92` | -| `OwnershipHandoverRequested` | `(pendingOwner: address)` | `0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d` | -| `OwnershipTransferred` | `(oldOwner: address, newOwner: address)` | `0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0` | -| `RoleGranted` | `(role: bytes32, grantee: address)` | `0x2ae6a113c0ed5b78a53413ffbb7679881f11145ccfba4fb92e863dfcd5a1d2f3` | -| `RoleRevoked` | `(role: bytes32, revokee: address)` | `0x155aaafb6329a2098580462df33ec4b7441b19729b9601c5fc17ae1cf99a8a52` | +| Event | Arguments | Topic | +| ----- | --------- | ----- | +| `Attested` | `(payloadId_: bytes32, watcher: address)` | `0x3d83c7bc55c269e0bc853ddc0d7b9fca30216ecc43779acb4e36b7e0ad1c71e4` | +| `OwnershipHandoverCanceled` | `(pendingOwner: address)` | `0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92` | +| `OwnershipHandoverRequested` | `(pendingOwner: address)` | `0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d` | +| `OwnershipTransferred` | `(oldOwner: address, newOwner: address)` | `0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0` | +| `RoleGranted` | `(role: bytes32, grantee: address)` | `0x2ae6a113c0ed5b78a53413ffbb7679881f11145ccfba4fb92e863dfcd5a1d2f3` | +| `RoleRevoked` | `(role: bytes32, revokee: address)` | `0x155aaafb6329a2098580462df33ec4b7441b19729b9601c5fc17ae1cf99a8a52` | ## MessageSwitchboard -| Event | Arguments | Topic | -| ---------------------------- | ---------------------------------------------------------------------------------------- | -------------------------------------------------------------------- | -| `Attested` | `(payloadId: bytes32, digest: bytes32, watcher: address)` | `0x2f8e66b1207a4b70274a2a3da88ffb5737c8214576490da1b35acc38b2d62db6` | -| `OwnershipHandoverCanceled` | `(pendingOwner: address)` | `0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92` | -| `OwnershipHandoverRequested` | `(pendingOwner: address)` | `0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d` | -| `OwnershipTransferred` | `(oldOwner: address, newOwner: address)` | `0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0` | -| `RoleGranted` | `(role: bytes32, grantee: address)` | `0x2ae6a113c0ed5b78a53413ffbb7679881f11145ccfba4fb92e863dfcd5a1d2f3` | -| `RoleRevoked` | `(role: bytes32, revokee: address)` | `0x155aaafb6329a2098580462df33ec4b7441b19729b9601c5fc17ae1cf99a8a52` | -| `SiblingConfigSet` | `(chainSlug: uint32, fee: uint256, socket: bytes32, switchboard: bytes32)` | `0xc34c3d0f0300f406c0f0608f6f6d70b36f5e90ccd1f1e1065bbe899f64cc81f0` | -| `SiblingRegistered` | `(chainSlug: uint32, plugAddress: address, siblingPlug: bytes32)` | `0xbb232aa6c0cb95b30a887c06b678538c818d3eac0dfd4d83299a18867cae220b` | -| `SwitchboardFeesSet` | `(chainSlug: uint32, feeAmount: uint256)` | `0x5e544c79c5017ebf2ea6aa546cd1c37272d5b4335247f0ceaabef51903dc5260` | -| `TriggerProcessed` | `(dstChainSlug: uint32, switchboardFees: uint256, digest: bytes32, digestParams: tuple)` | `0x0d585f64e2ebf6cc2b04ccbbaf63459f3b52c84111559988d28d6872185caa32` | +| Event | Arguments | Topic | +| ----- | --------- | ----- | +| `Attested` | `(payloadId: bytes32, digest: bytes32, watcher: address)` | `0x2f8e66b1207a4b70274a2a3da88ffb5737c8214576490da1b35acc38b2d62db6` | +| `OwnershipHandoverCanceled` | `(pendingOwner: address)` | `0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92` | +| `OwnershipHandoverRequested` | `(pendingOwner: address)` | `0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d` | +| `OwnershipTransferred` | `(oldOwner: address, newOwner: address)` | `0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0` | +| `RoleGranted` | `(role: bytes32, grantee: address)` | `0x2ae6a113c0ed5b78a53413ffbb7679881f11145ccfba4fb92e863dfcd5a1d2f3` | +| `RoleRevoked` | `(role: bytes32, revokee: address)` | `0x155aaafb6329a2098580462df33ec4b7441b19729b9601c5fc17ae1cf99a8a52` | +| `SiblingConfigSet` | `(chainSlug: uint32, fee: uint256, socket: bytes32, switchboard: bytes32)` | `0xc34c3d0f0300f406c0f0608f6f6d70b36f5e90ccd1f1e1065bbe899f64cc81f0` | +| `SiblingRegistered` | `(chainSlug: uint32, plugAddress: address, siblingPlug: bytes32)` | `0xbb232aa6c0cb95b30a887c06b678538c818d3eac0dfd4d83299a18867cae220b` | +| `SwitchboardFeesSet` | `(chainSlug: uint32, feeAmount: uint256)` | `0x5e544c79c5017ebf2ea6aa546cd1c37272d5b4335247f0ceaabef51903dc5260` | +| `TriggerProcessed` | `(dstChainSlug: uint32, switchboardFees: uint256, digest: bytes32, digestParams: tuple)` | `0x0d585f64e2ebf6cc2b04ccbbaf63459f3b52c84111559988d28d6872185caa32` | ## ReadPrecompile -| Event | Arguments | Topic | -| --------------- | ---------------------------------------------------------------------- | -------------------------------------------------------------------- | -| `ExpiryTimeSet` | `(expiryTime: uint256)` | `0x07e837e13ad9a34715a6bd45f49bbf12de19f06df79cb0be12b3a7d7f2397fa9` | -| `ReadFeesSet` | `(readFees: uint256)` | `0xc674cb6dde3a59f84dbf226832e606ffc54ac8a169e1568fc834c7813010f926` | +| Event | Arguments | Topic | +| ----- | --------- | ----- | +| `ExpiryTimeSet` | `(expiryTime: uint256)` | `0x07e837e13ad9a34715a6bd45f49bbf12de19f06df79cb0be12b3a7d7f2397fa9` | +| `ReadFeesSet` | `(readFees: uint256)` | `0xc674cb6dde3a59f84dbf226832e606ffc54ac8a169e1568fc834c7813010f926` | | `ReadRequested` | `(transaction: tuple, readAtBlockNumber: uint256, payloadId: bytes32)` | `0xbcad63ac625c0f3cb23b62b126567728fcf5950ca8e559150e764eced73e794a` | ## SchedulePrecompile -| Event | Arguments | Topic | -| ------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------- | -| `ExpiryTimeSet` | `(expiryTime_: uint256)` | `0x07e837e13ad9a34715a6bd45f49bbf12de19f06df79cb0be12b3a7d7f2397fa9` | -| `MaxScheduleDelayInSecondsSet` | `(maxScheduleDelayInSeconds_: uint256)` | `0xfd5e4f0e96753ffb08a583390c2f151c51001d8e560625ab93b7fa7b4dac6d75` | -| `ScheduleCallbackFeesSet` | `(scheduleCallbackFees_: uint256)` | `0x82a2f41efc81ce7bfabc0affda7354dae42a3d09bd74a6196e8904b223138a52` | -| `ScheduleFeesPerSecondSet` | `(scheduleFeesPerSecond_: uint256)` | `0x7901a21229f6d2543d8676f53e21214d15f42513e7d46e0dcb510357222bdc7c` | -| `ScheduleRequested` | `(payloadId: bytes32, executeAfter: uint256, deadline: uint256, localInvoker: address, callbackSelector: bytes4, callbackData: bytes)` | `0xbeceaccdb128631e58b881241d4fb46e53d8b2b2aa3f1ce77ba6fb80af038e30` | -| `ScheduleResolved` | `(payloadId: bytes32)` | `0x925dc6c3ebffa07cac89d6e9675f1a5d04e045f2ed9a4fa442665935cb73e26b` | +| Event | Arguments | Topic | +| ----- | --------- | ----- | +| `ExpiryTimeSet` | `(expiryTime_: uint256)` | `0x07e837e13ad9a34715a6bd45f49bbf12de19f06df79cb0be12b3a7d7f2397fa9` | +| `MaxScheduleDelayInSecondsSet` | `(maxScheduleDelayInSeconds_: uint256)` | `0xfd5e4f0e96753ffb08a583390c2f151c51001d8e560625ab93b7fa7b4dac6d75` | +| `ScheduleCallbackFeesSet` | `(scheduleCallbackFees_: uint256)` | `0x82a2f41efc81ce7bfabc0affda7354dae42a3d09bd74a6196e8904b223138a52` | +| `ScheduleFeesPerSecondSet` | `(scheduleFeesPerSecond_: uint256)` | `0x7901a21229f6d2543d8676f53e21214d15f42513e7d46e0dcb510357222bdc7c` | +| `ScheduleRequested` | `(payloadId: bytes32, executeAfter: uint256, deadline: uint256, localInvoker: address, callbackSelector: bytes4, callbackData: bytes)` | `0xbeceaccdb128631e58b881241d4fb46e53d8b2b2aa3f1ce77ba6fb80af038e30` | +| `ScheduleResolved` | `(payloadId: bytes32)` | `0x925dc6c3ebffa07cac89d6e9675f1a5d04e045f2ed9a4fa442665935cb73e26b` | ## WritePrecompile -| Event | Arguments | Topic | -| ------------------------------- | ---------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------- | -| `ChainMaxMsgValueLimitsUpdated` | `(chainSlug: uint32, maxMsgValueLimit: uint256)` | `0x439087d094fe7dacbba3f0c67032041952d8bd58a891e15af10ced28fed0eb91` | -| `ContractFactoryPlugSet` | `(chainSlug: uint32, contractFactoryPlug: bytes32)` | `0xfad552a6feb82bef23201b8dce04b2460bff41b00f26fef3d791572cfdab49c2` | -| `ExpiryTimeSet` | `(expiryTime: uint256)` | `0x07e837e13ad9a34715a6bd45f49bbf12de19f06df79cb0be12b3a7d7f2397fa9` | -| `FeesSet` | `(writeFees: uint256)` | `0x3346af6da1932164d501f2ec28f8c5d686db5828a36b77f2da4332d89184fe7b` | -| `Initialized` | `(version: uint64)` | `0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2` | -| `OwnershipHandoverCanceled` | `(pendingOwner: address)` | `0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92` | -| `OwnershipHandoverRequested` | `(pendingOwner: address)` | `0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d` | -| `OwnershipTransferred` | `(oldOwner: address, newOwner: address)` | `0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0` | -| `WriteProofRequested` | `(transmitter: address, digest: bytes32, prevBatchDigestHash: bytes32, deadline: uint256, payloadParams: tuple)` | `0xe3e3e322b3c2964670f4b62d06647c2f711440be782105fc1c0a60cc934bb40a` | -| `WriteProofUploaded` | `(payloadId: bytes32, proof: bytes)` | `0xd8fe3a99a88c9630360418877afdf14e3e79f0f25fee162aeb230633ea740156` | +| Event | Arguments | Topic | +| ----- | --------- | ----- | +| `ChainMaxMsgValueLimitsUpdated` | `(chainSlug: uint32, maxMsgValueLimit: uint256)` | `0x439087d094fe7dacbba3f0c67032041952d8bd58a891e15af10ced28fed0eb91` | +| `ContractFactoryPlugSet` | `(chainSlug: uint32, contractFactoryPlug: bytes32)` | `0xfad552a6feb82bef23201b8dce04b2460bff41b00f26fef3d791572cfdab49c2` | +| `ExpiryTimeSet` | `(expiryTime: uint256)` | `0x07e837e13ad9a34715a6bd45f49bbf12de19f06df79cb0be12b3a7d7f2397fa9` | +| `FeesSet` | `(writeFees: uint256)` | `0x3346af6da1932164d501f2ec28f8c5d686db5828a36b77f2da4332d89184fe7b` | +| `Initialized` | `(version: uint64)` | `0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2` | +| `OwnershipHandoverCanceled` | `(pendingOwner: address)` | `0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92` | +| `OwnershipHandoverRequested` | `(pendingOwner: address)` | `0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d` | +| `OwnershipTransferred` | `(oldOwner: address, newOwner: address)` | `0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0` | +| `SolanaDecodedInstruction` | `(instruction: tuple)` | `0x7791efa1de7da86e7361c08c8707e7923d01f495c171ee45fa53453ef4acf9d9` | +| `SolanaFunctionArgsPacked` | `(functionArgsPacked: bytes)` | `0xfa5ef3ff566e5e9b89d176598ee9372fdd53a0e26390cc5923e681397ae71998` | +| `SolanaInstructionInput` | `(payload: bytes)` | `0x319b699bdeea750cdf8b8aa4fd827ba3ee8e6cd4e6d1db1e7d0381680362126d` | +| `WriteProofRequested` | `(transmitter: address, digest: bytes32, prevBatchDigestHash: bytes32, deadline: uint256, payloadParams: tuple)` | `0xe3e3e322b3c2964670f4b62d06647c2f711440be782105fc1c0a60cc934bb40a` | +| `WriteProofUploaded` | `(payloadId: bytes32, proof: bytes)` | `0xd8fe3a99a88c9630360418877afdf14e3e79f0f25fee162aeb230633ea740156` | + diff --git a/contracts/evmx/fees/Credit.sol b/contracts/evmx/fees/Credit.sol index 7fbfe747..4eda544a 100644 --- a/contracts/evmx/fees/Credit.sol +++ b/contracts/evmx/fees/Credit.sol @@ -18,9 +18,16 @@ import {WRITE} from "../../utils/common/Constants.sol"; import "../../utils/RescueFundsLib.sol"; import "../base/AppGatewayBase.sol"; import {toBytes32Format} from "../../utils/common/Converters.sol"; +import {ForwarderSolana} from "../helpers/ForwarderSolana.sol"; +import {SolanaInstruction, SolanaInstructionData, SolanaInstructionDataDescription} from "../../utils/common/Structs.sol"; +import {SusdcProgramPda} from "../helpers/solana-utils/program-pda/SUSDCPdas.sol"; +import {FeesPlugProgramPda} from "../helpers/solana-utils/program-pda/FeesPlugPdas.sol"; +import {SolanaPDA} from "../helpers/solana-utils/SolanaPda.sol"; +import {TOKEN_PROGRAM_ID, ASSOCIATED_TOKEN_PROGRAM_ID, SYSTEM_PROGRAM_ID} from "../helpers/solana-utils/SolanaPda.sol"; +import {CHAIN_SLUG_SOLANA_MAINNET} from "../../utils/common/Constants.sol"; interface ISUSDCPlug { - function mint(address receiver_, uint256 amount_) external; + function mint(address evmxReceiver_, uint256 amount_) external; } abstract contract FeesManagerStorage is IFeesManager { @@ -38,10 +45,11 @@ abstract contract FeesManagerStorage is IFeesManager { bytes32 public deprecatedSbType; // slot 52 - /// @notice Mapping to track blocked credits for each user - /// @dev address => userBlockedCredits - // TODO: this will have to be bytes32 (for solana addresses) - mapping(address => uint256) public userBlockedCredits; + /// @notice Mapping to track blocked credits for each credit holder (evmx address) + /// Blocking means that credits are blocked when bidding starts and released when request is done (if transmitter won the bidding auction), + /// it is here so that multiple auctions can happen simultaneously and we know that transmitter in not overspending credits + /// @dev creditHolder address => blockedCredits amount + mapping(address => uint256) public blockedCredits; // slot 53 /// @notice Mapping to track request credits details for each request count @@ -54,14 +62,12 @@ abstract contract FeesManagerStorage is IFeesManager { // slot 55 // token pool balances // chainSlug => token address => amount - // TODO: this will have to be bytes32 (for solana tokens) - mapping(uint32 => mapping(address => uint256)) public tokenOnChainBalances; + mapping(uint32 => mapping(bytes32 => uint256)) public tokenOnChainBalances; // slot 56 - /// @notice Mapping to track nonce to whether it has been used + /// @notice Mapping to track nonce to whether it has been used by given EVMx credit holder (therefore it is evm like address) /// @dev address => signatureNonce => isNonceUsed /// @dev used by watchers or other users in signatures - // TODO: how about this, do we need to change it to bytes32 ? - how nonces are used here ? mapping(address => mapping(uint256 => bool)) public isNonceUsed; // slot 57 @@ -70,21 +76,27 @@ abstract contract FeesManagerStorage is IFeesManager { mapping(uint32 => bytes32) public feesPlugs; // slot 58 - /// @notice Mapping to track token for each chain slug + /// @notice Contract id that represents SUSDC on-chain contracts - on each chain it might have a different address but all + /// of this contracts have one business logic - they are the same entities but on different chains /// @dev chainSlug => token address - bytes32 public susdcToken; + bytes32 public susdcContractId; // slot 59 - /// @notice Mapping to track whitelisted receivers + /// @notice Mapping to track whitelisted EVMx receivers /// @dev receiver address => bool - mapping(address => bool) public whitelistedReceivers; + mapping(address => bool) public whitelistedEvmxReceivers; /// @notice Mapping to track max fees per chain slug /// @dev chainSlug => max fees mapping(uint32 => uint256) public maxFeesPerChainSlug; + ForwarderSolana public forwarderSolana; + + bytes32 public susdcSolanaProgramId; + bytes32 public feesPlugSolanaProgramId; + // slots [60-107] reserved for gap - uint256[47] _gap_after; + uint256[44] _gap_after; // slots [108-157] 50 slots reserved for address resolver util // 9 slots for app gateway base @@ -95,14 +107,14 @@ abstract contract FeesManagerStorage is IFeesManager { abstract contract Credit is FeesManagerStorage, Initializable, Ownable, AppGatewayBase, ERC20 { /// @notice Emitted when fees deposited are updated /// @param chainSlug The chain identifier - /// @param token The token address - /// @param depositTo The address to deposit to + /// @param token Original on-chain token address + /// @param depositToEVMxAddress The EVMx address where credits are deposited /// @param creditAmount The credit amount added /// @param nativeAmount The native amount transferred event Deposited( uint32 indexed chainSlug, - address indexed token, - address indexed depositTo, + bytes32 indexed token, + address indexed depositToEVMxAddress, uint256 creditAmount, uint256 nativeAmount ); @@ -123,7 +135,10 @@ abstract contract Credit is FeesManagerStorage, Initializable, Ownable, AppGatew event WithdrawFailed(bytes32 indexed payloadId); /// @notice Emitted when susdc token is set - event SusdcTokenSet(uint32 indexed chainSlug, bytes32 indexed susdcToken); + event SusdcTokenSet(uint32 indexed chainSlug, bytes32 indexed susdcContractId); + + /// @notice Emitted when fees plug solana program id is set + event FeesPlugSolanaSet(bytes32 indexed feesPlugSolanaProgramId); /// @notice Emitted when whitelisted receiver is set event WhitelistedReceiverSet(address indexed receiver, bool isWhitelisted); @@ -138,18 +153,30 @@ abstract contract Credit is FeesManagerStorage, Initializable, Ownable, AppGatew emit FeesPoolSet(feesPool_); } - function setSusdcToken(uint32 chainSlug_, bytes32 susdcToken_) external onlyOwner { - forwarderAddresses[susdcToken][chainSlug_] = asyncDeployer__().getOrDeployForwarderContract( - susdcToken_, - chainSlug_ - ); - _setValidPlug(true, chainSlug_, susdcToken); - emit SusdcTokenSet(chainSlug_, susdcToken_); + // In deployment script add calling this for Solana chain slug + function setSusdcToken(uint32 chainSlug_, bytes32 susdcContractId_) external onlyOwner { + if (chainSlug_ != CHAIN_SLUG_SOLANA_MAINNET) { + forwarderAddresses[susdcContractId][chainSlug_] = asyncDeployer__() + .getOrDeployForwarderContract(susdcContractId_, chainSlug_); + _setValidPlug(true, chainSlug_, susdcContractId); + } else { + // TODO: this is not entirely right, this method should be called setSusdcPlug() as SUSDC token on Solana is a separate thing that is managed by SusdcProgram plug + susdcSolanaProgramId = susdcContractId_; + watcher__().setIsValidPlug(true, chainSlug_, susdcContractId_); + } + + emit SusdcTokenSet(chainSlug_, susdcContractId_); + } + + function setFeesPlugSolana(bytes32 feesPlugSolanaProgramId_) external onlyOwner { + feesPlugSolanaProgramId = feesPlugSolanaProgramId_; + watcher__().setIsValidPlug(true, CHAIN_SLUG_SOLANA_MAINNET, feesPlugSolanaProgramId); + emit FeesPlugSolanaSet(feesPlugSolanaProgramId); } - function setWhitelistedReceiver(address receiver_, bool isWhitelisted_) external onlyOwner { - whitelistedReceivers[receiver_] = isWhitelisted_; - emit WhitelistedReceiverSet(receiver_, isWhitelisted_); + function setWhitelistedReceiver(address evmxReceiver_, bool isWhitelisted_) external onlyOwner { + whitelistedEvmxReceivers[evmxReceiver_] = isWhitelisted_; + emit WhitelistedReceiverSet(evmxReceiver_, isWhitelisted_); } function getMaxFees(uint32 chainSlug_) public view returns (uint256) { @@ -163,79 +190,95 @@ abstract contract Credit is FeesManagerStorage, Initializable, Ownable, AppGatew return allowance(user_, appGateway_) > 0; } - /// @notice Deposits credits and native tokens to a user - /// @param depositTo_ The EVMx address to deposit the credits to (it serves as accounting contract that mirrors real on-chain balances) + /// @dev Native tokens are used to pay gas fees on EVMx. + /// Credit tokens are represent funds that user deposits to EVMx (those credits in case of Game is SUSDC). Credits are sort of utility tokens on EVMx that + /// the mirror user on-chain balances that were deposited to FeesPlug (on-chai contract). + /// Native and Credit are 1:1 and can we converted to each other using wrap and unwrap functions. + /// @notice Deposits credits and native tokens to a evmx address (credit holder) + /// @param depositToEvmxAddress_ The EVMx address to deposit the credits to (it serves as accounting contract that mirrors real on-chain balances) /// @param chainSlug_ The chain slug - /// @param token_ The token address - /// @param nativeAmount_ The native amount - /// @param creditAmount_ The credit amount - // TODO:4: for Solana handling we will need to have separate function deposit_solana() so that we do not have to change - (?) - // existing function on EVM UserVault which will refer to this one - // - also different handling on transmitter and indexer + /// @param onChainTokenAddress_ The on-chain token address that was deposited to FeesPlug and for which we will mint credit tokens to mirror this deposit. + /// - amount of onChainTokens deposited is equal to sum of Native and Credit amount (as you can specify that part of deposit should be account as Native) + /// @param nativeAmount_ The native amount - amount of onChainTokens that will be account as Native + /// @param creditAmount_ The credit amount - amount of onChainTokens that will be account as Credit + /// @param data_ The data that will be passed to the EVMx receiver contract + // Call to this function happens after FeesPlug.depositCredit() emits FeesDeposited event and than watcher reads it and calls this function (TO BE CONFIRMED) function deposit( uint32 chainSlug_, - // TODO: token will have to be bytes32 (for solana tokens) - this is the address of token on native chain (could be Solana) - address token_, - address depositTo_, + bytes32 onChainTokenAddress_, + address depositToEvmxAddress_, uint256 nativeAmount_, uint256 creditAmount_, bytes memory data_ ) external override onlyWatcher { - if (!whitelistedReceivers[depositTo_]) revert InvalidReceiver(); - tokenOnChainBalances[chainSlug_][token_] += creditAmount_ + nativeAmount_; + if (!whitelistedEvmxReceivers[depositToEvmxAddress_]) revert InvalidReceiver(); + tokenOnChainBalances[chainSlug_][onChainTokenAddress_] += creditAmount_ + nativeAmount_; // Mint tokens to the some evmx accounting contract - _mint(depositTo_, creditAmount_); + _mint(depositToEvmxAddress_, creditAmount_); if (nativeAmount_ > 0) { - // TODO: ask: what are native tokens in this context ? - native to real blockchains or to EVMx itself ? + // This is taking credit tokens and sending them to fees pool where there are treated as native tokens. // if native transfer fails, add to credit - bool success = feesPool.withdraw(depositTo_, nativeAmount_); + bool success = feesPool.withdraw(depositToEvmxAddress_, nativeAmount_); if (!success) { - _mint(depositTo_, creditAmount_); + _mint(depositToEvmxAddress_, creditAmount_); nativeAmount_ = 0; creditAmount_ += nativeAmount_; } } if (data_.length > 0) - IReceiver(depositTo_).onTransfer( + IReceiver(depositToEvmxAddress_).onTransfer( chainSlug_, - token_, + // onChainTokenAddress_, + address(0), // TODO: token_ param is not used and in future it will be removed so we can safely set it to address(0) creditAmount_, nativeAmount_, data_ ); - emit Deposited(chainSlug_, token_, depositTo_, creditAmount_, nativeAmount_); + emit Deposited( + chainSlug_, + onChainTokenAddress_, + depositToEvmxAddress_, + creditAmount_, + nativeAmount_ + ); } - function wrap(address receiver_) external payable override { + /// This is wrapping EVMx credit tokens to native EVMx gas tokens + /// native evmx credits are use to pay gas fees on EVMx - conversion is 1:1 like ETH and WETH on evm + /// @param evmxReceiver_ The EVMx address to wrap the credits to + // TODO:7: what is the role of fees pool in this context, why we mint and than send ETH to fees pool ? + function wrap(address evmxReceiver_) external payable override { uint256 amount = msg.value; if (amount == 0) revert InvalidAmount(); // Mint tokens to receiver - _mint(receiver_, amount); + _mint(evmxReceiver_, amount); // reverts if transfer fails SafeTransferLib.safeTransferETH(address(feesPool), amount); - emit CreditsWrapped(receiver_, amount); + emit CreditsWrapped(evmxReceiver_, amount); } - function unwrap(uint256 amount_, address receiver_) external { + // TODO:7: same question as in wrap function: why we do feesPool.withdraw() during unwrap ???? + function unwrap(uint256 amount_, address evmxReceiver_) external { if (balanceOf(msg.sender) < amount_) revert InsufficientCreditsAvailable(); // Burn tokens from sender _burn(msg.sender, amount_); - bool success = feesPool.withdraw(receiver_, amount_); + bool success = feesPool.withdraw(evmxReceiver_, amount_); if (!success) revert InsufficientBalance(); - emit CreditsUnwrapped(receiver_, amount_); + emit CreditsUnwrapped(evmxReceiver_, amount_); } - function mint(address to, uint256 amount, bytes memory data_) external onlyWatcher { + // function mint(address to, uint256 amount, bytes memory data_) external onlyWatcher + function mint(address to, uint256 amount, bytes memory data_) external { _mintWithData(to, amount, data_); } @@ -246,15 +289,26 @@ abstract contract Credit is FeesManagerStorage, Initializable, Ownable, AppGatew } } - function burn(uint32 chainSlug_, address receiver_, uint256 amount_) external async { + function burn(uint32 chainSlug_, address evmReceiver_, uint256 amount_) external async { _setMaxFees(getMaxFees(chainSlug_)); _burn(msg.sender, amount_); - ISUSDCPlug(forwarderAddresses[susdcToken][chainSlug_]).mint(receiver_, amount_); + ISUSDCPlug(forwarderAddresses[susdcContractId][chainSlug_]).mint(evmReceiver_, amount_); + } + + function burnSolana( + uint32 chainSlug_, + bytes32 solanaReceiver_, + uint256 amount_, + bytes32 susdcMint_ + ) external async { + _setMaxFees(getMaxFees(chainSlug_)); + _burn(msg.sender, amount_); + mintSusdcOnSolana(amount_, solanaReceiver_, susdcMint_); } /// @notice Override balanceOf to return available (unblocked) credits function balanceOf(address account) public view override returns (uint256) { - return super.balanceOf(account) - userBlockedCredits[account]; + return super.balanceOf(account) - blockedCredits[account]; } /// @notice Get total balance including blocked credits @@ -264,25 +318,25 @@ abstract contract Credit is FeesManagerStorage, Initializable, Ownable, AppGatew /// @notice Get blocked credits for an account function getBlockedCredits(address account) public view returns (uint256) { - return userBlockedCredits[account]; + return blockedCredits[account]; } /// @notice Checks if the user has enough credits - /// @param consumeFrom_ address to consume from + /// @param creditHolder_ - evxm credit holder who we need to check if has enough credits /// @param spender_ address to spend from /// @param amount_ amount to spend /// @return True if the user has enough credits, false otherwise function isCreditSpendable( - address consumeFrom_, + address creditHolder_, address spender_, uint256 amount_ ) public view override returns (bool) { - // If consumeFrom_ is not same as spender_ or spender_ is not watcher, check if it is approved - if (!_isWatcher(spender_) && consumeFrom_ != spender_) { - if (allowance(consumeFrom_, spender_) == 0) return false; + // If creditHolder_ is not same as spender_ or spender_ is not watcher, check if it is approved + if (!_isWatcher(spender_) && creditHolder_ != spender_) { + if (allowance(creditHolder_, spender_) == 0) return false; } - return balanceOf(consumeFrom_) >= amount_; + return balanceOf(creditHolder_) >= amount_; } // ERC20 Overrides to handle blocked credits @@ -331,7 +385,7 @@ abstract contract Credit is FeesManagerStorage, Initializable, Ownable, AppGatew /// @notice Approves an app gateway for the caller /// @dev Approval data is encoded to make app gateways compatible with future changes /// @param feeApprovalData_ The fee approval data - /// @return consumeFrom The consume from address + /// @return consumeFrom EVMx address (credit holder) that signed the approval /// @return spender The app gateway address /// @return approval The approval status function approveWithSignature( @@ -353,19 +407,19 @@ abstract contract Credit is FeesManagerStorage, Initializable, Ownable, AppGatew } /// @notice Withdraws funds to a specified receiver - /// @dev This function is used to withdraw fees from the fees plug + /// @dev This function is used to withdraw fees from the fees plug // TODO: this documentation is inconsistent - FeesManager function is withdrawCredits() not withdrawFees() /// @dev assumed that transmitter can bid for their request on AM /// @param chainSlug_ The chain identifier /// @param token_ The address of the token /// @param credits_ The amount of tokens to withdraw /// @param maxFees_ The fees needed to process the withdraw - /// @param receiver_ The address of the receiver + /// @param onchainReceiver_ The address of the receiver function withdrawCredits( uint32 chainSlug_, address token_, uint256 credits_, uint256 maxFees_, - address receiver_ + address onchainReceiver_ ) public override { address consumeFrom = msg.sender; @@ -375,21 +429,59 @@ abstract contract Credit is FeesManagerStorage, Initializable, Ownable, AppGatew // Burn tokens from sender _burn(consumeFrom, credits_); - tokenOnChainBalances[chainSlug_][token_] -= credits_; + tokenOnChainBalances[chainSlug_][toBytes32Format(token_)] -= credits_; // Add it to the queue and submit request _createRequest( chainSlug_, consumeFrom, maxFees_, - abi.encodeCall(IFeesPlug.withdrawFees, (token_, receiver_, credits_)) + abi.encodeCall(IFeesPlug.withdrawFees, (token_, onchainReceiver_, credits_)) + ); + } + + function withdrawCreditsSolana( + uint32 chainSlug_, + bytes32 token_, + uint256 credits_, + uint256 maxFees_, + bytes32 onchainReceiver_ + ) public override async { + // sender is evmx address (credit holder) that is making the call (it is will be AG in case of Game) + address consumeFrom = msg.sender; + + // Check if amount is available in fees plug + uint256 availableCredits = balanceOf(consumeFrom); + if (availableCredits < credits_ + maxFees_) revert InsufficientCreditsAvailable(); + + // Burn tokens from sender + _burn(consumeFrom, credits_); + tokenOnChainBalances[chainSlug_][token_] -= credits_; + + feesPlugWithdrawSolana(token_, credits_, onchainReceiver_); + } + + function feesPlugWithdrawSolana( + bytes32 token_, + uint256 credits_, + bytes32 onchainReceiver_ + ) internal { + SolanaInstruction memory solanaInstruction_ = createFeesPlugWithdrawInstructionSolana( + onchainReceiver_, + token_, + credits_ + ); + forwarderSolana.callSolana( + abi.encode(solanaInstruction_), + solanaInstruction_.data.programId, + address(this) ); } function _createRequest( uint32 chainSlug_, address consumeFrom_, - uint256 maxFees_, + uint256 /*maxFees_*/, bytes memory payload_ ) internal async { _setMaxFees(getMaxFees(chainSlug_)); @@ -452,4 +544,176 @@ abstract contract Credit is FeesManagerStorage, Initializable, Ownable, AppGatew ) public override { // todo: implement permit } + + function mintSusdcOnSolana( + uint256 susdcMintAmount_, + bytes32 userAddress_, + bytes32 susdcMint_ + ) internal { + SolanaInstruction memory solanaInstruction_ = createSusdcMintInstructionSolana( + susdcMintAmount_, + userAddress_, + susdcMint_ + ); + forwarderSolana.callSolana( + abi.encode(solanaInstruction_), + solanaInstruction_.data.programId, + address(this) + ); + } + + function createSusdcMintInstructionSolana( + uint256 susdcMintAmount_, + bytes32 userAddress_, + bytes32 susdcMint_ + ) internal view returns (SolanaInstruction memory) { + bytes32[] memory accounts = new bytes32[](6); + // accounts 0 - tmpReturnStoragePda + (accounts[0], ) = SusdcProgramPda.deriveTmpReturnStoragePda(susdcSolanaProgramId); + /*----------------- mint() accounts -----------------*/ + // accounts 1 - programConfigPda + (accounts[1], ) = SusdcProgramPda.deriveProgramConfigPda(susdcSolanaProgramId); + // accounts 2 - susdc mint address + accounts[2] = susdcMint_; + // accounts 3 - aliceSusdcAta + accounts[3] = SolanaPDA.deriveTokenAtaAddress(userAddress_, susdcMint_); + // accounts 4 - SYSTEM_PROGRAM_ID + accounts[4] = SYSTEM_PROGRAM_ID; + // accounts 5 - TOKEN_PROGRAM_ID + accounts[5] = TOKEN_PROGRAM_ID; + + bytes1[] memory accountFlags = new bytes1[](6); + // tmpReturnStoragePda is writable + accountFlags[0] = bytes1(0x01); // true + // programConfigPda is not writable + accountFlags[1] = bytes1(0x00); // false + // susdc mint address is writable + accountFlags[2] = bytes1(0x01); // true + // aliceSusdcAta is writable + accountFlags[3] = bytes1(0x01); // true + // SYSTEM_PROGRAM_ID is not writable + accountFlags[4] = bytes1(0x00); // false + // TOKEN_PROGRAM_ID is not writable + accountFlags[5] = bytes1(0x00); // false + + // mint instruction discriminator + bytes8 instructionDiscriminator = 0x3339e12fb69289a6; + + bytes[] memory functionArguments = new bytes[](1); + uint64 usdcMintAmountU64 = convertToSolanaUint64(susdcMintAmount_); + functionArguments[0] = abi.encode(usdcMintAmountU64); + + string[] memory functionArgumentTypeNames = new string[](1); + functionArgumentTypeNames[0] = "u64"; + + return + SolanaInstruction({ + data: SolanaInstructionData({ + programId: susdcSolanaProgramId, + instructionDiscriminator: instructionDiscriminator, + accounts: accounts, + functionArguments: functionArguments + }), + description: SolanaInstructionDataDescription({ + accountFlags: accountFlags, + functionArgumentTypeNames: functionArgumentTypeNames + }) + }); + } + + function createFeesPlugWithdrawInstructionSolana( + bytes32 userAddress_, + bytes32 susdcMint_, + uint256 withdrawAmount_ + ) internal view returns (SolanaInstruction memory) { + bytes32[] memory accounts = new bytes32[](11); + // accounts 0 - tmpReturnStoragePda + (accounts[0], ) = FeesPlugProgramPda.deriveTmpReturnStoragePda(feesPlugSolanaProgramId); + /*----------------- mint() accounts -----------------*/ + // accounts 1 - programConfigPda + (accounts[1], ) = FeesPlugProgramPda.deriveProgramConfigPda(feesPlugSolanaProgramId); + // accounts 2 - vaultConfigPda + (bytes32 vaultConfigPda, ) = FeesPlugProgramPda.deriveVaultConfigPda( + feesPlugSolanaProgramId + ); + accounts[2] = vaultConfigPda; + // accounts 3 - token mint address + accounts[3] = susdcMint_; + // accounts 4 - whitelistedTokenPda + (accounts[4], ) = FeesPlugProgramPda.deriveWhitelistedTokenPda( + feesPlugSolanaProgramId, + susdcMint_ + ); + // accounts 5 - receiver address + accounts[5] = userAddress_; + // accounts 6 - receiver ata address + accounts[6] = SolanaPDA.deriveTokenAtaAddress(userAddress_, susdcMint_); + // accounts 7 - vault ata address + accounts[7] = SolanaPDA.deriveTokenAtaAddress(vaultConfigPda, susdcMint_); + // accounts 8 - system program id + accounts[8] = SYSTEM_PROGRAM_ID; + // accounts 9 - token program id + accounts[9] = TOKEN_PROGRAM_ID; + // accounts 10 - associated token program id + accounts[10] = ASSOCIATED_TOKEN_PROGRAM_ID; + + bytes1[] memory accountFlags = new bytes1[](11); + // tmpReturnStoragePda is writable + accountFlags[0] = bytes1(0x01); // true + // programConfigPda is not writable + accountFlags[1] = bytes1(0x00); // false + // vaultConfigPda is writable + accountFlags[2] = bytes1(0x01); // true + // token mint address is not writable + accountFlags[3] = bytes1(0x00); // false + // whitelistedTokenPda is not writable + accountFlags[4] = bytes1(0x00); // false + // receiver address is writable + accountFlags[5] = bytes1(0x01); // true + // receiver ata address is writable + accountFlags[6] = bytes1(0x01); // true + // vault ata address is writable + accountFlags[7] = bytes1(0x01); // true + // system program id is not writable + accountFlags[8] = bytes1(0x00); // false + // token program id is not writable + accountFlags[9] = bytes1(0x00); // false + // associated token program id is not writable + accountFlags[10] = bytes1(0x00); // false + + // withdraw instruction discriminator + bytes8 instructionDiscriminator = 0xb712469c946da122; + + bytes[] memory functionArguments = new bytes[](2); + bool isNative = false; + // here on purpose we do not convert to uint64 as feesPlug withdraw function expects uint256 + uint64 withdrawAmountU64 = convertToSolanaUint64(withdrawAmount_); + functionArguments[0] = abi.encode(withdrawAmountU64); + functionArguments[1] = abi.encode(isNative ? 1 : 0); + + string[] memory functionArgumentTypeNames = new string[](2); + functionArgumentTypeNames[0] = "u64"; // this should fit most of the cases (but our BorshEncoder supports max 128 bits) + functionArgumentTypeNames[1] = "u8"; // bool is encoded as 1 or 0 + + return + SolanaInstruction({ + data: SolanaInstructionData({ + programId: feesPlugSolanaProgramId, + instructionDiscriminator: instructionDiscriminator, + accounts: accounts, + functionArguments: functionArguments + }), + description: SolanaInstructionDataDescription({ + accountFlags: accountFlags, + functionArgumentTypeNames: functionArgumentTypeNames + }) + }); + } +} + +// convert EVM uint256 18 decimals to Solana uint64 6 decimals +function convertToSolanaUint64(uint256 amount) pure returns (uint64) { + uint256 scaledAmount = amount / 10 ** 12; + require(scaledAmount <= type(uint64).max, "Amount exceeds uint64 max"); + return uint64(scaledAmount); } diff --git a/contracts/evmx/fees/FeesManager.sol b/contracts/evmx/fees/FeesManager.sol index 8b26e810..44be2a62 100644 --- a/contracts/evmx/fees/FeesManager.sol +++ b/contracts/evmx/fees/FeesManager.sol @@ -2,6 +2,7 @@ pragma solidity ^0.8.21; import "./Credit.sol"; +import {ForwarderSolana} from "../helpers/ForwarderSolana.sol"; /// @title FeesManager /// @notice Contract for managing fees @@ -53,17 +54,20 @@ contract FeesManager is Credit { address feesPool_, address owner_, uint256 fees_, - bytes32 sbType_ + bytes32 sbType_, + address forwarderSolana_ ) public reinitializer(2) { evmxSlug = evmxSlug_; sbType = sbType_; feesPool = IFeesPool(feesPool_); - susdcToken = _createContractId("susdc token"); + susdcContractId = _createContractId("susdc token"); maxFeesPerChainSlug[evmxSlug_] = fees_; _setMaxFees(fees_); _initializeOwner(owner_); _initializeAppGateway(addressResolver_); + + forwarderSolana = ForwarderSolana(forwarderSolana_); } function setChainMaxFees( @@ -94,56 +98,71 @@ contract FeesManager is Credit { /////////////////////// FEES MANAGEMENT /////////////////////// - /// @notice Blocks fees for a request count + /// @notice Blocks fees for a request count - called when bidding starts (auction is started) /// @param requestCount_ The batch identifier - /// @param consumeFrom_ The fees payer address + /// @param creditHolder_ The credit holder address (evmx address) /// @param credits_ The total fees to block /// @dev Only callable by delivery helper function blockCredits( uint40 requestCount_, - address consumeFrom_, + address creditHolder_, uint256 credits_ ) external override onlyRequestHandler { - if (balanceOf(consumeFrom_) < credits_) revert InsufficientCreditsAvailable(); + if (balanceOf(creditHolder_) < credits_) revert InsufficientCreditsAvailable(); - userBlockedCredits[consumeFrom_] += credits_; + blockedCredits[creditHolder_] += credits_; requestBlockedCredits[requestCount_] = credits_; - emit CreditsBlocked(requestCount_, consumeFrom_, credits_); + emit CreditsBlocked(requestCount_, creditHolder_, credits_); } - /// @notice Unblocks fees after successful execution and assigns them to the transmitter + /// @notice Unblocks fees after successful execution and assigns them to the transmitter - this is called when request execution by transmitter is done. + /// Then we assign used credits to the transmitter (credits come from user and transmitter is making a call in his name) and unused credits are returned to the user. /// @param requestCount_ The request count of the executed batch /// @param assignTo_ The address of the transmitter function unblockAndAssignCredits( uint40 requestCount_, address assignTo_ ) external override onlyRequestHandler { - uint256 blockedCredits = requestBlockedCredits[requestCount_]; - if (blockedCredits == 0) return; + uint256 blockedCreditsAmount = requestBlockedCredits[requestCount_]; + if (blockedCreditsAmount == 0) return; address consumeFrom = _getRequestParams(requestCount_).requestFeesDetails.consumeFrom; // Unblock credits from the original user - userBlockedCredits[consumeFrom] -= blockedCredits; + blockedCredits[consumeFrom] -= blockedCreditsAmount; // Burn tokens from the original user - _burn(consumeFrom, blockedCredits); + _burn(consumeFrom, blockedCreditsAmount); // Mint tokens to the transmitter - _mint(assignTo_, blockedCredits); + _mint(assignTo_, blockedCreditsAmount); // Clean up storage delete requestBlockedCredits[requestCount_]; - emit CreditsUnblockedAndAssigned(requestCount_, consumeFrom, assignTo_, blockedCredits); + emit CreditsUnblockedAndAssigned( + requestCount_, + consumeFrom, + assignTo_, + blockedCreditsAmount + ); + } + + function setFeesPlugSolanaProgramId(bytes32 feesPlugSolanaProgramId_) external onlyOwner { + feesPlugSolanaProgramId = feesPlugSolanaProgramId_; + } + + function setSusdcSolanaProgramId(bytes32 susdcSolanaProgramId_) external onlyOwner { + susdcSolanaProgramId = susdcSolanaProgramId_; } + /// @notice If there was an auction but no transmitter wanted to bid (auction was not finished), we unblock the credits and return them to the user function unblockCredits(uint40 requestCount_) external override onlyRequestHandler { - uint256 blockedCredits = requestBlockedCredits[requestCount_]; - if (blockedCredits == 0) return; + uint256 blockedCreditsAmount = requestBlockedCredits[requestCount_]; + if (blockedCreditsAmount == 0) return; // Unblock credits from the original user address consumeFrom = _getRequestParams(requestCount_).requestFeesDetails.consumeFrom; - userBlockedCredits[consumeFrom] -= blockedCredits; + blockedCredits[consumeFrom] -= blockedCreditsAmount; delete requestBlockedCredits[requestCount_]; emit CreditsUnblocked(requestCount_, consumeFrom); diff --git a/contracts/evmx/helpers/ForwarderSolana.sol b/contracts/evmx/helpers/ForwarderSolana.sol index 7bb9f2e0..a00ce187 100644 --- a/contracts/evmx/helpers/ForwarderSolana.sol +++ b/contracts/evmx/helpers/ForwarderSolana.sol @@ -56,8 +56,11 @@ contract ForwarderSolana is ForwarderStorage, Initializable, AddressResolverUtil /// @notice Fallback function to process the contract calls to onChainAddress /// @dev It queues the calls in the middleware and deploys the promise contract - // function callSolana(SolanaInstruction memory solanaInstruction, bytes32 switchboardSolana) external { - function callSolana(bytes memory solanaPayload, bytes32 target) external { + function callSolana( + bytes memory solanaPayload, + bytes32 target, + address callerAppGateway + ) external { if (address(addressResolver__) == address(0)) { revert AddressResolverNotSet(); } @@ -66,7 +69,8 @@ contract ForwarderSolana is ForwarderStorage, Initializable, AddressResolverUtil } // validates if the async modifier is set - address msgSender = msg.sender; + // address msgSender = msg.sender; + address msgSender = callerAppGateway; bool isAsyncModifierSet = IAppGateway(msgSender).isAsyncModifierSet(); if (!isAsyncModifierSet) revert AsyncModifierNotSet(); @@ -74,10 +78,6 @@ contract ForwarderSolana is ForwarderStorage, Initializable, AddressResolverUtil (OverrideParams memory overrideParams, bytes32 sbType) = IAppGateway(msgSender) .getOverrideParams(); - // TODO:GW: after POC make it work like below - // get the switchboard address from the watcher precompile config - // address switchboard = watcherPrecompileConfig().switchboards(chainSlug, sbType); - // Queue the call in the middleware. QueueParams memory queueParams; queueParams.overrideParams = overrideParams; diff --git a/contracts/evmx/helpers/solana-utils/Ed25519.sol b/contracts/evmx/helpers/solana-utils/Ed25519.sol new file mode 100644 index 00000000..9c81addc --- /dev/null +++ b/contracts/evmx/helpers/solana-utils/Ed25519.sol @@ -0,0 +1,906 @@ +// SPDX-License-Identifier: Apache-2.0 +pragma solidity ^0.8.21; + +import "./Sha512.sol"; +import "./Ed25519_pow.sol"; + +library Ed25519 { + function verify(bytes32 k, bytes32 r, bytes32 s, bytes memory m) internal pure returns (bool) { + unchecked { + uint256 hh; + // Step 1: compute SHA-512(R, A, M) + { + bytes memory rs = new bytes(k.length + r.length + m.length); + for (uint256 i = 0; i < r.length; i++) { + rs[i] = r[i]; + } + for (uint256 i = 0; i < k.length; i++) { + rs[i + 32] = k[i]; + } + for (uint256 i = 0; i < m.length; i++) { + rs[i + 64] = m[i]; + } + uint64[8] memory result = Sha512.hash(rs); + + uint256 h0 = uint256(result[0]) | + (uint256(result[1]) << 64) | + (uint256(result[2]) << 128) | + (uint256(result[3]) << 192); + + h0 = + ((h0 & + 0xff00ff_00ff00ff_00ff00ff_00ff00ff_00ff00ff_00ff00ff_00ff00ff_00ff00ff) << + 8) | + ((h0 & + 0xff00ff00_ff00ff00_ff00ff00_ff00ff00_ff00ff00_ff00ff00_ff00ff00_ff00ff00) >> + 8); + h0 = + ((h0 & 0xffff_0000ffff_0000ffff_0000ffff_0000ffff_0000ffff_0000ffff_0000ffff) << + 16) | + ((h0 & + 0xffff0000_ffff0000_ffff0000_ffff0000_ffff0000_ffff0000_ffff0000_ffff0000) >> + 16); + h0 = + ((h0 & 0xffffffff_00000000_ffffffff_00000000_ffffffff_00000000_ffffffff) << + 32) | + ((h0 & + 0xffffffff_00000000_ffffffff_00000000_ffffffff_00000000_ffffffff_00000000) >> + 32); + + uint256 h1 = uint256(result[4]) | + (uint256(result[5]) << 64) | + (uint256(result[6]) << 128) | + (uint256(result[7]) << 192); + + h1 = + ((h1 & + 0xff00ff_00ff00ff_00ff00ff_00ff00ff_00ff00ff_00ff00ff_00ff00ff_00ff00ff) << + 8) | + ((h1 & + 0xff00ff00_ff00ff00_ff00ff00_ff00ff00_ff00ff00_ff00ff00_ff00ff00_ff00ff00) >> + 8); + h1 = + ((h1 & 0xffff_0000ffff_0000ffff_0000ffff_0000ffff_0000ffff_0000ffff_0000ffff) << + 16) | + ((h1 & + 0xffff0000_ffff0000_ffff0000_ffff0000_ffff0000_ffff0000_ffff0000_ffff0000) >> + 16); + h1 = + ((h1 & 0xffffffff_00000000_ffffffff_00000000_ffffffff_00000000_ffffffff) << + 32) | + ((h1 & + 0xffffffff_00000000_ffffffff_00000000_ffffffff_00000000_ffffffff_00000000) >> + 32); + hh = addmod( + h0, + mulmod( + h1, + 0xfffffff_ffffffff_ffffffff_fffffffe_c6ef5bf4_737dcf70_d6ec3174_8d98951d, + 0x10000000_00000000_00000000_00000000_14def9de_a2f79cd6_5812631a_5cf5d3ed + ), + 0x10000000_00000000_00000000_00000000_14def9de_a2f79cd6_5812631a_5cf5d3ed + ); + } + // Step 2: unpack k + k = bytes32( + ((uint256(k) & + 0xff00ff_00ff00ff_00ff00ff_00ff00ff_00ff00ff_00ff00ff_00ff00ff_00ff00ff) << 8) | + ((uint256(k) & + 0xff00ff00_ff00ff00_ff00ff00_ff00ff00_ff00ff00_ff00ff00_ff00ff00_ff00ff00) >> + 8) + ); + k = bytes32( + ((uint256(k) & + 0xffff_0000ffff_0000ffff_0000ffff_0000ffff_0000ffff_0000ffff_0000ffff) << 16) | + ((uint256(k) & + 0xffff0000_ffff0000_ffff0000_ffff0000_ffff0000_ffff0000_ffff0000_ffff0000) >> + 16) + ); + k = bytes32( + ((uint256(k) & 0xffffffff_00000000_ffffffff_00000000_ffffffff_00000000_ffffffff) << + 32) | + ((uint256(k) & + 0xffffffff_00000000_ffffffff_00000000_ffffffff_00000000_ffffffff_00000000) >> + 32) + ); + k = bytes32( + ((uint256(k) & 0xffffffff_ffffffff_00000000_00000000_ffffffff_ffffffff) << 64) | + ((uint256(k) & + 0xffffffff_ffffffff_00000000_00000000_ffffffff_ffffffff_00000000_00000000) >> + 64) + ); + k = bytes32((uint256(k) << 128) | (uint256(k) >> 128)); + uint256 ky = uint256(k) & + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff; + uint256 kx; + { + uint256 ky2 = mulmod( + ky, + ky, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + uint256 u = addmod( + ky2, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffec, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + uint256 v = mulmod( + ky2, + 0x52036cee_2b6ffe73_8cc74079_7779e898_00700a4d_4141d8ab_75eb4dca_135978a3, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ) + 1; + uint256 t = mulmod( + u, + v, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + (kx, ) = Ed25519_pow.pow22501(t); + kx = mulmod( + kx, + kx, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + kx = mulmod( + u, + mulmod( + mulmod( + kx, + kx, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ), + t, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ), + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + t = mulmod( + mulmod( + kx, + kx, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ), + v, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + if (t != u) { + if ( + t != + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed - + u + ) { + return false; + } + kx = mulmod( + kx, + 0x2b832480_4fc1df0b_2b4d0099_3dfbd7a7_2f431806_ad2fe478_c4ee1b27_4a0ea0b0, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + } + } + if ((kx & 1) != uint256(k) >> 255) { + kx = 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed - kx; + } + // Verify s + s = bytes32( + ((uint256(s) & + 0xff00ff_00ff00ff_00ff00ff_00ff00ff_00ff00ff_00ff00ff_00ff00ff_00ff00ff) << 8) | + ((uint256(s) & + 0xff00ff00_ff00ff00_ff00ff00_ff00ff00_ff00ff00_ff00ff00_ff00ff00_ff00ff00) >> + 8) + ); + s = bytes32( + ((uint256(s) & + 0xffff_0000ffff_0000ffff_0000ffff_0000ffff_0000ffff_0000ffff_0000ffff) << 16) | + ((uint256(s) & + 0xffff0000_ffff0000_ffff0000_ffff0000_ffff0000_ffff0000_ffff0000_ffff0000) >> + 16) + ); + s = bytes32( + ((uint256(s) & 0xffffffff_00000000_ffffffff_00000000_ffffffff_00000000_ffffffff) << + 32) | + ((uint256(s) & + 0xffffffff_00000000_ffffffff_00000000_ffffffff_00000000_ffffffff_00000000) >> + 32) + ); + s = bytes32( + ((uint256(s) & 0xffffffff_ffffffff_00000000_00000000_ffffffff_ffffffff) << 64) | + ((uint256(s) & + 0xffffffff_ffffffff_00000000_00000000_ffffffff_ffffffff_00000000_00000000) >> + 64) + ); + s = bytes32((uint256(s) << 128) | (uint256(s) >> 128)); + if ( + uint256(s) >= + 0x10000000_00000000_00000000_00000000_14def9de_a2f79cd6_5812631a_5cf5d3ed + ) { + return false; + } + uint256 vx; + uint256 vu; + uint256 vy; + uint256 vv; + // Step 3: compute multiples of k + uint256[8][3][2] memory tables; + { + uint256 ks = ky + kx; + uint256 kd = ky + + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed - + kx; + uint256 k2dt = mulmod( + mulmod( + kx, + ky, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ), + 0x2406d9dc_56dffce7_198e80f2_eef3d130_00e0149a_8283b156_ebd69b94_26b2f159, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + uint256 kky = ky; + uint256 kkx = kx; + uint256 kku = 1; + uint256 kkv = 1; + { + uint256 xx = mulmod( + kkx, + kkv, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + uint256 yy = mulmod( + kky, + kku, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + uint256 zz = mulmod( + kku, + kkv, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + uint256 xx2 = mulmod( + xx, + xx, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + uint256 yy2 = mulmod( + yy, + yy, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + uint256 xxyy = mulmod( + xx, + yy, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + uint256 zz2 = mulmod( + zz, + zz, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + kkx = xxyy + xxyy; + kku = + yy2 - + xx2 + + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed; + kky = xx2 + yy2; + kkv = addmod( + zz2 + zz2, + 0xffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffda - + kku, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + } + { + uint256 xx = mulmod( + kkx, + kkv, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + uint256 yy = mulmod( + kky, + kku, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + uint256 zz = mulmod( + kku, + kkv, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + uint256 xx2 = mulmod( + xx, + xx, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + uint256 yy2 = mulmod( + yy, + yy, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + uint256 xxyy = mulmod( + xx, + yy, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + uint256 zz2 = mulmod( + zz, + zz, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + kkx = xxyy + xxyy; + kku = + yy2 - + xx2 + + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed; + kky = xx2 + yy2; + kkv = addmod( + zz2 + zz2, + 0xffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffda - + kku, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + } + { + uint256 xx = mulmod( + kkx, + kkv, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + uint256 yy = mulmod( + kky, + kku, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + uint256 zz = mulmod( + kku, + kkv, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + uint256 xx2 = mulmod( + xx, + xx, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + uint256 yy2 = mulmod( + yy, + yy, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + uint256 xxyy = mulmod( + xx, + yy, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + uint256 zz2 = mulmod( + zz, + zz, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + kkx = xxyy + xxyy; + kku = + yy2 - + xx2 + + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed; + kky = xx2 + yy2; + kkv = addmod( + zz2 + zz2, + 0xffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffda - + kku, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + } + uint256 cprod = 1; + uint256[8][3][2] memory tables_ = tables; + for (uint256 i = 0; ; i++) { + uint256 cs; + uint256 cd; + uint256 ct; + uint256 c2z; + { + uint256 cx = mulmod( + kkx, + kkv, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + uint256 cy = mulmod( + kky, + kku, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + uint256 cz = mulmod( + kku, + kkv, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + ct = mulmod( + kkx, + kky, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + cs = cy + cx; + cd = + cy - + cx + + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed; + c2z = cz + cz; + } + tables_[1][0][i] = cs; + tables_[1][1][i] = cd; + tables_[1][2][i] = mulmod( + ct, + 0x2406d9dc_56dffce7_198e80f2_eef3d130_00e0149a_8283b156_ebd69b94_26b2f159, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + tables_[0][0][i] = c2z; + tables_[0][1][i] = cprod; + cprod = mulmod( + cprod, + c2z, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + if (i == 7) { + break; + } + uint256 ab = mulmod( + cs, + ks, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + uint256 aa = mulmod( + cd, + kd, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + uint256 ac = mulmod( + ct, + k2dt, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + kkx = + ab - + aa + + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed; + kku = addmod( + c2z, + ac, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + kky = ab + aa; + kkv = addmod( + c2z, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed - + ac, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + } + uint256 t; + (cprod, t) = Ed25519_pow.pow22501(cprod); + cprod = mulmod( + cprod, + cprod, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + cprod = mulmod( + cprod, + cprod, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + cprod = mulmod( + cprod, + cprod, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + cprod = mulmod( + cprod, + cprod, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + cprod = mulmod( + cprod, + cprod, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + cprod = mulmod( + cprod, + t, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + for (uint256 i = 7; ; i--) { + uint256 cinv = mulmod( + cprod, + tables_[0][1][i], + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + tables_[1][0][i] = mulmod( + tables_[1][0][i], + cinv, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + tables_[1][1][i] = mulmod( + tables_[1][1][i], + cinv, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + tables_[1][2][i] = mulmod( + tables_[1][2][i], + cinv, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + if (i == 0) { + break; + } + cprod = mulmod( + cprod, + tables_[0][0][i], + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + } + tables_[0] = [ + [ + 0x43e7ce9d_19ea5d32_9385a44c_321ea161_67c996e3_7dc6070c_97de49e3_7ac61db9, + 0x40cff344_25d8ec30_a3bb74ba_58cd5854_fa1e3818_6ad0d31e_bc8ae251_ceb2c97e, + 0x459bd270_46e8dd45_aea7008d_b87a5a8f_79067792_53d64523_58951859_9fdfbf4b, + 0x69fdd1e2_8c23cc38_94d0c8ff_90e76f6d_5b6e4c2e_620136d0_4dd83c4a_51581ab9, + 0x54dceb34_13ce5cfa_11196dfc_960b6eda_f4b380c6_d4d23784_19cc0279_ba49c5f3, + 0x4e24184d_d71a3d77_eef3729f_7f8cf7c1_7224cf40_aa7b9548_b9942f3c_5084ceed, + 0x5a0e5aab_20262674_ae117576_1cbf5e88_9b52a55f_d7ac5027_c228cebd_c8d2360a, + 0x26239334_073e9b38_c6285955_6d451c3d_cc8d30e8_4b361174_f488eadd_e2cf17d9 + ], + [ + 0x227e97c9_4c7c0933_d2e0c21a_3447c504_fe9ccf82_e8a05f59_ce881c82_eba0489f, + 0x226a3e0e_cc4afec6_fd0d2884_13014a9d_bddecf06_c1a2f0bb_702ba77c_613d8209, + 0x34d7efc8_51d45c5e_71efeb0f_235b7946_91de6228_877569b3_a8d52bf0_58b8a4a0, + 0x3c1f5fb3_ca7166fc_e1471c9b_752b6d28_c56301ad_7b65e845_1b2c8c55_26726e12, + 0x6102416c_f02f02ff_5be75275_f55f28db_89b2a9d2_456b860c_e22fc0e5_031f7cc5, + 0x40adf677_f1bfdae0_57f0fd17_9c126179_18ddaa28_91a6530f_b1a4294f_a8665490, + 0x61936f3c_41560904_6187b8ba_a978cbc9_b4789336_3ae5a3cc_7d909f36_35ae7f48, + 0x562a9662_b6ec47f9_e979d473_c02b51e4_42336823_8c58ddb5_2f0e5c6a_180e6410 + ], + [ + 0x3788bdb4_4f8632d4_2d0dbee5_eea1acc6_136cf411_e655624f_55e48902_c3bd5534, + 0x6190cf2c_2a7b5ad7_69d594a8_2844f23b_4167fa7c_8ac30e51_aa6cfbeb_dcd4b945, + 0x65f77870_96be9204_123a71f3_ac88a87b_e1513217_737d6a1e_2f3a13a4_3d7e3a9a, + 0x23af32d_bfa67975_536479a7_a7ce74a0_2142147f_ac048018_7f1f1334_9cda1f2d, + 0x64fc44b7_fc6841bd_db0ced8b_8b0fe675_9137ef87_ee966512_15fc1dbc_d25c64dc, + 0x1434aa37_48b701d5_b69df3d7_d340c1fe_3f6b9c1e_fc617484_caadb47e_382f4475, + 0x457a6da8_c962ef35_f2b21742_3e5844e9_d2353452_7e8ea429_0d24e3dd_f21720c6, + 0x63b9540c_eb60ccb5_1e4d989d_956e053c_f2511837_efb79089_d2ff4028_4202c53d + ] + ]; + } + // Step 4: compute s*G - h*A + { + uint256 ss = uint256(s) << 3; + uint256 hhh = hh + + 0x80000000_00000000_00000000_00000000_a6f7cef5_17bce6b2_c09318d2_e7ae9f60; + uint256 vvx = 0; + uint256 vvu = 1; + uint256 vvy = 1; + uint256 vvv = 1; + for (uint256 i = 252; ; i--) { + uint256 bit = 8 << i; + if ((ss & bit) != 0) { + uint256 ws; + uint256 wd; + uint256 wz; + uint256 wt; + { + uint256 wx = mulmod( + vvx, + vvv, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + uint256 wy = mulmod( + vvy, + vvu, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + ws = wy + wx; + wd = + wy - + wx + + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed; + wz = mulmod( + vvu, + vvv, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + wt = mulmod( + vvx, + vvy, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + } + uint256 j = (ss >> i) & 7; + ss &= ~(7 << i); + uint256[8][3][2] memory tables_ = tables; + uint256 aa = mulmod( + wd, + tables_[0][1][j], + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + uint256 ab = mulmod( + ws, + tables_[0][0][j], + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + uint256 ac = mulmod( + wt, + tables_[0][2][j], + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + vvx = + ab - + aa + + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed; + vvu = wz + ac; + vvy = ab + aa; + vvv = + wz - + ac + + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed; + } + if ((hhh & bit) != 0) { + uint256 ws; + uint256 wd; + uint256 wz; + uint256 wt; + { + uint256 wx = mulmod( + vvx, + vvv, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + uint256 wy = mulmod( + vvy, + vvu, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + ws = wy + wx; + wd = + wy - + wx + + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed; + wz = mulmod( + vvu, + vvv, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + wt = mulmod( + vvx, + vvy, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + } + uint256 j = (hhh >> i) & 7; + hhh &= ~(7 << i); + uint256[8][3][2] memory tables_ = tables; + uint256 aa = mulmod( + wd, + tables_[1][0][j], + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + uint256 ab = mulmod( + ws, + tables_[1][1][j], + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + uint256 ac = mulmod( + wt, + tables_[1][2][j], + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + vvx = + ab - + aa + + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed; + vvu = + wz - + ac + + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed; + vvy = ab + aa; + vvv = wz + ac; + } + if (i == 0) { + uint256 ws; + uint256 wd; + uint256 wz; + uint256 wt; + { + uint256 wx = mulmod( + vvx, + vvv, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + uint256 wy = mulmod( + vvy, + vvu, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + ws = wy + wx; + wd = + wy - + wx + + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed; + wz = mulmod( + vvu, + vvv, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + wt = mulmod( + vvx, + vvy, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + } + uint256 j = hhh & 7; + uint256[8][3][2] memory tables_ = tables; + uint256 aa = mulmod( + wd, + tables_[1][0][j], + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + uint256 ab = mulmod( + ws, + tables_[1][1][j], + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + uint256 ac = mulmod( + wt, + tables_[1][2][j], + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + vvx = + ab - + aa + + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed; + vvu = + wz - + ac + + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed; + vvy = ab + aa; + vvv = wz + ac; + break; + } + { + uint256 xx = mulmod( + vvx, + vvv, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + uint256 yy = mulmod( + vvy, + vvu, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + uint256 zz = mulmod( + vvu, + vvv, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + uint256 xx2 = mulmod( + xx, + xx, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + uint256 yy2 = mulmod( + yy, + yy, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + uint256 xxyy = mulmod( + xx, + yy, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + uint256 zz2 = mulmod( + zz, + zz, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + vvx = xxyy + xxyy; + vvu = + yy2 - + xx2 + + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed; + vvy = xx2 + yy2; + vvv = addmod( + zz2 + zz2, + 0xffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffda - + vvu, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + } + } + vx = vvx; + vu = vvu; + vy = vvy; + vv = vvv; + } + // Step 5: compare the points + (uint256 vi, uint256 vj) = Ed25519_pow.pow22501( + mulmod( + vu, + vv, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ) + ); + vi = mulmod( + vi, + vi, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + vi = mulmod( + vi, + vi, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + vi = mulmod( + vi, + vi, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + vi = mulmod( + vi, + vi, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + vi = mulmod( + vi, + vi, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + vi = mulmod( + vi, + vj, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + vx = mulmod( + vx, + mulmod( + vi, + vv, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ), + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + vy = mulmod( + vy, + mulmod( + vi, + vu, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ), + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + bytes32 vr = bytes32(vy | (vx << 255)); + vr = bytes32( + ((uint256(vr) & + 0xff00ff_00ff00ff_00ff00ff_00ff00ff_00ff00ff_00ff00ff_00ff00ff_00ff00ff) << 8) | + ((uint256(vr) & + 0xff00ff00_ff00ff00_ff00ff00_ff00ff00_ff00ff00_ff00ff00_ff00ff00_ff00ff00) >> + 8) + ); + vr = bytes32( + ((uint256(vr) & + 0xffff_0000ffff_0000ffff_0000ffff_0000ffff_0000ffff_0000ffff_0000ffff) << 16) | + ((uint256(vr) & + 0xffff0000_ffff0000_ffff0000_ffff0000_ffff0000_ffff0000_ffff0000_ffff0000) >> + 16) + ); + vr = bytes32( + ((uint256(vr) & 0xffffffff_00000000_ffffffff_00000000_ffffffff_00000000_ffffffff) << + 32) | + ((uint256(vr) & + 0xffffffff_00000000_ffffffff_00000000_ffffffff_00000000_ffffffff_00000000) >> + 32) + ); + vr = bytes32( + ((uint256(vr) & 0xffffffff_ffffffff_00000000_00000000_ffffffff_ffffffff) << 64) | + ((uint256(vr) & + 0xffffffff_ffffffff_00000000_00000000_ffffffff_ffffffff_00000000_00000000) >> + 64) + ); + vr = bytes32((uint256(vr) << 128) | (uint256(vr) >> 128)); + + return vr == r; + } + } +} diff --git a/contracts/evmx/helpers/solana-utils/Ed25519_pow.sol b/contracts/evmx/helpers/solana-utils/Ed25519_pow.sol new file mode 100644 index 00000000..681efca6 --- /dev/null +++ b/contracts/evmx/helpers/solana-utils/Ed25519_pow.sol @@ -0,0 +1,329 @@ +// SPDX-License-Identifier: Apache-2.0 +pragma solidity ^0.8.21; + +library Ed25519_pow { + // Computes (v^(2^250-1), v^11) mod p + function pow22501(uint256 v) internal pure returns (uint256 p22501, uint256 p11) { + p11 = mulmod( + v, + v, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + p22501 = mulmod( + p11, + p11, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + p22501 = mulmod( + mulmod( + p22501, + p22501, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ), + v, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + p11 = mulmod( + p22501, + p11, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + p22501 = mulmod( + mulmod( + p11, + p11, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ), + p22501, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + uint256 a = mulmod( + p22501, + p22501, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + p22501 = mulmod( + p22501, + a, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + a = mulmod( + p22501, + p22501, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod( + p22501, + a, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + uint256 b = mulmod( + a, + a, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + p22501 = mulmod( + p22501, + a, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + a = mulmod( + p22501, + p22501, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod( + p22501, + a, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + b = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + b = mulmod(b, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, b, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + a = mulmod(a, a, 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed); + p22501 = mulmod( + p22501, + a, + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed + ); + } +} diff --git a/contracts/evmx/helpers/solana-utils/Sha512.sol b/contracts/evmx/helpers/solana-utils/Sha512.sol new file mode 100644 index 00000000..f51dcb4f --- /dev/null +++ b/contracts/evmx/helpers/solana-utils/Sha512.sol @@ -0,0 +1,278 @@ +// SPDX-License-Identifier: Apache-2.0 +pragma solidity ^0.8.21; + +// Reference: https://csrc.nist.gov/csrc/media/publications/fips/180/2/archive/2002-08-01/documents/fips180-2.pdf + +library Sha512 { + // @notice: The message, M, shall be padded before hash computation begins. + // The purpose of this padding is to ensure that the padded message is a multiple of 1024 bits. + // @param message input raw message bytes + // @return padded message bytes + function preprocess(bytes memory message) internal pure returns (bytes memory) { + uint256 padding = 128 - (message.length % 128); + if (message.length % 128 >= 112) { + padding = 256 - (message.length % 128); + } + bytes memory result = new bytes(message.length + padding); + + for (uint256 i = 0; i < message.length; i++) { + result[i] = message[i]; + } + result[message.length] = 0x80; + + uint128 bitSize = uint128(message.length * 8); + bytes memory bitlength = abi.encodePacked(bitSize); + for (uint256 index = 0; index < bitlength.length; index++) { + result[result.length - 1 - index] = bitlength[bitlength.length - 1 - index]; + } + return result; + } + + function bytesToBytes8(bytes memory b, uint256 offset) internal pure returns (bytes8) { + bytes8 out; + for (uint256 i = 0; i < 8; i++) { + out |= bytes8(b[offset + i] & 0xFF) >> (i * 8); + } + return out; + } + + function cutBlock( + bytes memory data, + uint256 blockIndex + ) internal pure returns (uint64[16] memory) { + uint64[16] memory result; + for (uint8 r = 0; r < result.length; r++) { + result[r] = uint64(bytesToBytes8(data, blockIndex * 128 + r * 8)); + } + return result; + } + + // This section defines the functions that are used by sha-512. + // https://csrc.nist.gov/csrc/media/publications/fips/180/2/archive/2002-08-01/documents/fips180-2.pdf#page=15 + + // @notice: Thus, ROTR(x, n) is equivalent to a circular shift (rotation) of x by n positions to the right. + // @param x input num + // @param n num of positions to circular shift + // @return uint64 + function ROTR(uint64 x, uint256 n) internal pure returns (uint64) { + return (x << (64 - n)) + (x >> n); + } + + // @notice: The right shift operation SHR n(x), where x is a w-bit word and n is an integer with 0 <= n < w, is defined by SHR(x, n) = x >> n. + // @param x input num + // @param n num of positions to shift + // @return uint64 + function SHR(uint64 x, uint256 n) internal pure returns (uint64) { + return uint64(x >> n); + } + + // @notice: Ch(x, y, z) = (x ^ y) ⊕ (﹁ x ^ z) + // @param x x + // @param y y + // @param z z + // @return uint64 + function Ch(uint64 x, uint64 y, uint64 z) internal pure returns (uint64) { + return (x & y) ^ ((x ^ 0xffffffffffffffff) & z); + } + + // @notice: Maj(x, y, z) = (x ^ y) ⊕ (x ^ z) ⊕ (y ^ z) + // @param x x + // @param y y + // @param z z + // @return uint64 + function Maj(uint64 x, uint64 y, uint64 z) internal pure returns (uint64) { + return (x & y) ^ (x & z) ^ (y & z); + } + + // @notice: sigma0(x) = ROTR(x, 28) ^ ROTR(x, 34) ^ ROTR(x, 39) + // @param x x + // @return uint64 + function sigma0(uint64 x) internal pure returns (uint64) { + return ROTR(x, 28) ^ ROTR(x, 34) ^ ROTR(x, 39); + } + + // @notice: sigma1(x) = ROTR(x, 14) ^ ROTR(x, 18) ^ ROTR(x, 41) + // @param x x + // @return uint64 + function sigma1(uint64 x) internal pure returns (uint64) { + return ROTR(x, 14) ^ ROTR(x, 18) ^ ROTR(x, 41); + } + + // @notice: gamma0(x) = OTR(x, 1) ^ ROTR(x, 8) ^ SHR(x, 7) + // @param x x + // @return uint64 + function gamma0(uint64 x) internal pure returns (uint64) { + return ROTR(x, 1) ^ ROTR(x, 8) ^ SHR(x, 7); + } + + // @notice: gamma1(x) = ROTR(x, 19) ^ ROTR(x, 61) ^ SHR(x, 6) + // @param x x + // @return uint64 + function gamma1(uint64 x) internal pure returns (uint64) { + return ROTR(x, 19) ^ ROTR(x, 61) ^ SHR(x, 6); + } + + struct FuncVar { + uint64 a; + uint64 b; + uint64 c; + uint64 d; + uint64 e; + uint64 f; + uint64 g; + uint64 h; + } + + // @notice Calculate the SHA512 of input data. + // @param data input data bytes + // @return 512 bits hash result + function hash(bytes memory data) internal pure returns (uint64[8] memory) { + uint64[8] memory H = [ + 0x6a09e667f3bcc908, + 0xbb67ae8584caa73b, + 0x3c6ef372fe94f82b, + 0xa54ff53a5f1d36f1, + 0x510e527fade682d1, + 0x9b05688c2b3e6c1f, + 0x1f83d9abfb41bd6b, + 0x5be0cd19137e2179 + ]; + + unchecked { + uint64 T1; + uint64 T2; + + uint64[80] memory W; + FuncVar memory fvar; + + uint64[80] memory K = [ + 0x428a2f98d728ae22, + 0x7137449123ef65cd, + 0xb5c0fbcfec4d3b2f, + 0xe9b5dba58189dbbc, + 0x3956c25bf348b538, + 0x59f111f1b605d019, + 0x923f82a4af194f9b, + 0xab1c5ed5da6d8118, + 0xd807aa98a3030242, + 0x12835b0145706fbe, + 0x243185be4ee4b28c, + 0x550c7dc3d5ffb4e2, + 0x72be5d74f27b896f, + 0x80deb1fe3b1696b1, + 0x9bdc06a725c71235, + 0xc19bf174cf692694, + 0xe49b69c19ef14ad2, + 0xefbe4786384f25e3, + 0x0fc19dc68b8cd5b5, + 0x240ca1cc77ac9c65, + 0x2de92c6f592b0275, + 0x4a7484aa6ea6e483, + 0x5cb0a9dcbd41fbd4, + 0x76f988da831153b5, + 0x983e5152ee66dfab, + 0xa831c66d2db43210, + 0xb00327c898fb213f, + 0xbf597fc7beef0ee4, + 0xc6e00bf33da88fc2, + 0xd5a79147930aa725, + 0x06ca6351e003826f, + 0x142929670a0e6e70, + 0x27b70a8546d22ffc, + 0x2e1b21385c26c926, + 0x4d2c6dfc5ac42aed, + 0x53380d139d95b3df, + 0x650a73548baf63de, + 0x766a0abb3c77b2a8, + 0x81c2c92e47edaee6, + 0x92722c851482353b, + 0xa2bfe8a14cf10364, + 0xa81a664bbc423001, + 0xc24b8b70d0f89791, + 0xc76c51a30654be30, + 0xd192e819d6ef5218, + 0xd69906245565a910, + 0xf40e35855771202a, + 0x106aa07032bbd1b8, + 0x19a4c116b8d2d0c8, + 0x1e376c085141ab53, + 0x2748774cdf8eeb99, + 0x34b0bcb5e19b48a8, + 0x391c0cb3c5c95a63, + 0x4ed8aa4ae3418acb, + 0x5b9cca4f7763e373, + 0x682e6ff3d6b2b8a3, + 0x748f82ee5defb2fc, + 0x78a5636f43172f60, + 0x84c87814a1f0ab72, + 0x8cc702081a6439ec, + 0x90befffa23631e28, + 0xa4506cebde82bde9, + 0xbef9a3f7b2c67915, + 0xc67178f2e372532b, + 0xca273eceea26619c, + 0xd186b8c721c0c207, + 0xeada7dd6cde0eb1e, + 0xf57d4f7fee6ed178, + 0x06f067aa72176fba, + 0x0a637dc5a2c898a6, + 0x113f9804bef90dae, + 0x1b710b35131c471b, + 0x28db77f523047d84, + 0x32caab7b40c72493, + 0x3c9ebe0a15c9bebc, + 0x431d67c49c100d4c, + 0x4cc5d4becb3e42b6, + 0x597f299cfc657e2a, + 0x5fcb6fab3ad6faec, + 0x6c44198c4a475817 + ]; + + bytes memory blocks = preprocess(data); + + for (uint256 j = 0; j < blocks.length / 128; j++) { + uint64[16] memory M = cutBlock(blocks, j); + + fvar.a = H[0]; + fvar.b = H[1]; + fvar.c = H[2]; + fvar.d = H[3]; + fvar.e = H[4]; + fvar.f = H[5]; + fvar.g = H[6]; + fvar.h = H[7]; + + for (uint256 i = 0; i < 80; i++) { + if (i < 16) { + W[i] = M[i]; + } else { + W[i] = gamma1(W[i - 2]) + W[i - 7] + gamma0(W[i - 15]) + W[i - 16]; + } + + T1 = fvar.h + sigma1(fvar.e) + Ch(fvar.e, fvar.f, fvar.g) + K[i] + W[i]; + T2 = sigma0(fvar.a) + Maj(fvar.a, fvar.b, fvar.c); + + fvar.h = fvar.g; + fvar.g = fvar.f; + fvar.f = fvar.e; + fvar.e = fvar.d + T1; + fvar.d = fvar.c; + fvar.c = fvar.b; + fvar.b = fvar.a; + fvar.a = T1 + T2; + } + + H[0] = H[0] + fvar.a; + H[1] = H[1] + fvar.b; + H[2] = H[2] + fvar.c; + H[3] = H[3] + fvar.d; + H[4] = H[4] + fvar.e; + H[5] = H[5] + fvar.f; + H[6] = H[6] + fvar.g; + H[7] = H[7] + fvar.h; + } + } + + return H; + } +} diff --git a/contracts/evmx/helpers/solana-utils/SolanaPda.sol b/contracts/evmx/helpers/solana-utils/SolanaPda.sol new file mode 100644 index 00000000..741f2b36 --- /dev/null +++ b/contracts/evmx/helpers/solana-utils/SolanaPda.sol @@ -0,0 +1,270 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.21; + +import "./Ed25519_pow.sol"; + +// TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA +bytes32 constant TOKEN_PROGRAM_ID = 0x06ddf6e1d765a193d9cbe146ceeb79ac1cb485ed5f5b37913a8cf5857eff00a9; +// TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb +bytes32 constant TOKEN_2022_PROGRAM_ID = 0x06ddf6e1ee758fde18425dbce46ccddab61afc4d83b90d27febdf928d8a18bfc; +// ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL +bytes32 constant ASSOCIATED_TOKEN_PROGRAM_ID = 0x8c97258f4e2489f1bb3d1029148e0d830b5a1399daff1084048e7bd8dbe9f859; +// 11111111111111111111111111111111 +bytes32 constant SYSTEM_PROGRAM_ID = 0x0000000000000000000000000000000000000000000000000000000000000000; + +/* + * - programId and PDAs are passed as raw 32 bytes (same order as Solana's Pubkey.to_bytes()). + * - Seeds: <= 16, each <= 32 bytes. The bump is the final one-byte seed. + * - PDA derivation: sha256( seeds || bump || programId || "ProgramDerivedAddress" ), + * and the result MUST be OFF the Ed25519 curve (i.e., the 32B value does NOT decode + * to a valid Ed25519 point). + */ + +library Ed25519CurveUtils { + // p = 2^255 - 19 + uint256 internal constant P = + 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed; + + // d = -121665/121666 mod p (RFC 8032 / Edwards25519) + uint256 internal constant D = + 0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3; + + // (p-1)/2 for Legendre symbol (quadratic residue test) + uint256 internal constant P_MINUS_1_OVER_2 = + 0x3fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6e; + + // p-2 for modular inverse via Fermat + uint256 internal constant P_MINUS_2 = + 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeb; + + function _toBeBytes(uint256 x) private pure returns (bytes32 b) { + b = bytes32(x); + } + + function _fromBeBytes(bytes memory b) private pure returns (uint256 x) { + require(b.length == 32, "bad size"); + assembly { + x := mload(add(b, 0x20)) + } + } + + /// @dev modular exponentiation via precompile 0x05 + function _modexp(uint256 base, uint256 exp, uint256 modn) private view returns (uint256 r) { + bytes memory input = abi.encodePacked( + uint256(32), + uint256(32), + uint256(32), + _toBeBytes(base), + _toBeBytes(exp), + _toBeBytes(modn) + ); + bytes memory output = new bytes(32); + bool ok; + assembly { + ok := staticcall(gas(), 0x05, add(input, 0x20), mload(input), add(output, 0x20), 32) + } + require(ok, "modexp failed"); + r = _fromBeBytes(output); + } + + // based on Farcaster code + function decodesToValidPoint(bytes32 k) internal pure returns (bool) { + unchecked { + // Byte-swap to little-endian (your code) + k = bytes32( + ((uint256(k) & + 0xff00ff_00ff00ff_00ff00ff_00ff00ff_00ff00ff_00ff00ff_00ff00ff_00ff00ff) << 8) | + ((uint256(k) & + 0xff00ff00_ff00ff00_ff00ff00_ff00ff00_ff00ff00_ff00ff00_ff00ff00_ff00ff00) >> + 8) + ); + k = bytes32( + ((uint256(k) & + 0xffff_0000ffff_0000ffff_0000ffff_0000ffff_0000ffff_0000ffff_0000ffff) << 16) | + ((uint256(k) & + 0xffff0000_ffff0000_ffff0000_ffff0000_ffff0000_ffff0000_ffff0000_ffff0000) >> + 16) + ); + k = bytes32( + ((uint256(k) & 0xffffffff_00000000_ffffffff_00000000_ffffffff_00000000_ffffffff) << + 32) | + ((uint256(k) & + 0xffffffff_00000000_ffffffff_00000000_ffffffff_00000000_ffffffff_00000000) >> + 32) + ); + k = bytes32( + ((uint256(k) & 0xffffffff_ffffffff_00000000_00000000_ffffffff_ffffffff) << 64) | + ((uint256(k) & + 0xffffffff_ffffffff_00000000_00000000_ffffffff_ffffffff_00000000_00000000) >> + 64) + ); + k = bytes32((uint256(k) << 128) | (uint256(k) >> 128)); + + // Extract y (clear sign bit) + uint256 ky = uint256(k) & + 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff; + + // --- IMPORTANT: Canonical check (reject non-canonical y) --- + if (ky >= 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed) { + return false; + } + + // Curve math + uint256 p = 0x7fffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffff_ffffffed; + uint256 d = 0x52036cee_2b6ffe73_8cc74079_7779e898_00700a4d_4141d8ab_75eb4dca_135978a3; + uint256 iSqrtM1 = 0x2b832480_4fc1df0b_2b4d0099_3dfbd7a7_2f431806_ad2fe478_c4ee1b27_4a0ea0b0; + + uint256 ky2 = mulmod(ky, ky, p); + uint256 u = addmod(ky2, p - 1, p); + uint256 v = addmod(mulmod(d, ky2, p), 1, p); + + uint256 t = mulmod(u, v, p); + (uint256 kx, ) = Ed25519_pow.pow22501(t); // addition chain sqrt helper + kx = mulmod(kx, kx, p); + kx = mulmod(u, mulmod(mulmod(kx, kx, p), t, p), p); + + t = mulmod(mulmod(kx, kx, p), v, p); + + // Check curve equation (two roots case) + if (t != u) { + if (t != p - u) return false; + kx = mulmod(kx, iSqrtM1, p); + } + + // Sign parity enforcement (not needed for PDA, but harmless) + if ((kx & 1) != (uint256(k) >> 255)) { + kx = p - kx; + } + + return true; + } + } +} + +library SolanaPDA { + bytes constant DOMAIN = "ProgramDerivedAddress"; + + /// Reproduces Solana's sha256(seeds || bump || programId || DOMAIN) + function _compute( + bytes32 programId, + bytes[] memory seeds, + uint8 bump + ) internal pure returns (bytes32) { + require(seeds.length <= 16, "too many seeds"); + uint256 total; + for (uint256 i; i < seeds.length; ++i) { + require(seeds[i].length <= 32, "seed too long"); + total += seeds[i].length; + } + + bytes memory buf = new bytes(total + 1 + 32 + DOMAIN.length); + uint256 p; + + // seeds + for (uint256 i; i < seeds.length; ++i) { + bytes memory s = seeds[i]; + for (uint256 j; j < s.length; ++j) { + buf[p++] = s[j]; + } + } + + // bump (as a single byte) + buf[p++] = bytes1(bump); + + // programId raw 32 bytes (as provided) + bytes32 pid = programId; + for (uint256 k; k < 32; ++k) { + buf[p++] = pid[k]; + } + + // domain separator + for (uint256 d; d < DOMAIN.length; ++d) { + buf[p++] = DOMAIN[d]; + } + + return sha256(buf); + } + + /// @notice Validate PDA like Solana create_program_address (explicit bump). + function validatePDA( + bytes32 programId, + bytes[] memory seeds, + uint8 bump, + bytes32 expectedPDA + ) internal pure returns (bool) { + bytes32 derived = _compute(programId, seeds, bump); + + // Must be OFF-curve + bool onCurve = Ed25519CurveUtils.decodesToValidPoint(derived); + require(!onCurve, "derived is on-curve"); + + require(derived == expectedPDA, "PDA mismatch"); + return true; + } + + /// Returns the canonical (pda, bump) like Solana's findProgramAddressSync: + /// finds the first OFF-curve result scanning from b=255 down to 0. + function findProgramAddress( + bytes32 programId, + bytes[] memory seeds + ) internal pure returns (bytes32 pda, uint8 bump) { + for (uint256 b = 255; ; ) { + bytes32 d = _compute(programId, seeds, uint8(b)); + if (!Ed25519CurveUtils.decodesToValidPoint(d)) { + return (d, uint8(b)); // off-curve => valid PDA + } + if (b == 0) revert("no valid PDA"); + unchecked { + --b; + } + } + } + + function deriveTokenAtaAddress( + bytes32 solanaAddress, + bytes32 mint + ) internal pure returns (bytes32) { + bytes[] memory seeds = new bytes[](3); + // user solanaAddress + seeds[0] = abi.encodePacked(solanaAddress); + // token programId + seeds[1] = abi.encodePacked(TOKEN_PROGRAM_ID); + // token mint + seeds[2] = abi.encodePacked(mint); + + (bytes32 pda /*uint8 bump*/, ) = SolanaPDA.findProgramAddress( + ASSOCIATED_TOKEN_PROGRAM_ID, + seeds + ); + return pda; + } + + /// Proves that (expectedPDA, bump) is the *canonical* PDA: + /// - derived(bump) equals expectedPDA and is OFF-curve + /// - for all b in (bump+1 .. 255): derived(b) is ON-curve (so no higher valid PDA exists) + function validatePDAWithCanonicalBump( + bytes32 programId, + bytes[] memory seeds, + uint8 bump, + bytes32 expectedPDA + ) internal pure returns (bool) { + // Must match create_program_address result and be OFF-curve + require(validatePDA(programId, seeds, bump, expectedPDA), "invalid PDA/bump"); + + // Prove canonicality: no valid PDA at any higher bump + if (bump < 255) { + for (uint256 b = 255; b > bump; ) { + bytes32 d = _compute(programId, seeds, uint8(b)); + // Each higher bump must decode as a valid point => ON-curve (invalid PDA) + require( + Ed25519CurveUtils.decodesToValidPoint(d), + "non-canonical: higher bump is off-curve" + ); + unchecked { + --b; + } + } + } + return true; + } +} diff --git a/contracts/evmx/helpers/solana-utils/SolanaSignature.sol b/contracts/evmx/helpers/solana-utils/SolanaSignature.sol new file mode 100644 index 00000000..882f1dc3 --- /dev/null +++ b/contracts/evmx/helpers/solana-utils/SolanaSignature.sol @@ -0,0 +1,17 @@ +// SPDX-License-Identifier: GPL-3.0 +pragma solidity ^0.8.21; + +import {Ed25519} from "./Ed25519.sol"; + +contract SolanaSignature { + function verifyMessage( + bytes32 public_key, + bytes32 signature_r, + bytes32 signature_s, + bytes memory message + ) public pure returns (bool) { + bool valid = Ed25519.verify(public_key, signature_r, signature_s, message); + + return valid; + } +} diff --git a/contracts/evmx/helpers/solana-utils/program-pda/FeesPlugPdas.sol b/contracts/evmx/helpers/solana-utils/program-pda/FeesPlugPdas.sol new file mode 100644 index 00000000..439a3884 --- /dev/null +++ b/contracts/evmx/helpers/solana-utils/program-pda/FeesPlugPdas.sol @@ -0,0 +1,47 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.21; + +import {SolanaPDA} from "../SolanaPda.sol"; + +library FeesPlugProgramPda { + // string: "config:" + bytes constant PROGRAM_CONFIG_SEED_PREFIX_HEX = hex"636f6e6669673a"; + // string: "vault_config:" + bytes constant VAULT_CONFIG_SEED_PREFIX_HEX = hex"7661756c745f636f6e6669673a"; + // string: "tmp_data:" + bytes constant TMP_DATA_SEED_PREFIX_HEX = hex"746d705f646174613a"; + // string: "whitelisted_token:" + bytes constant WHITELISTED_TOKEN_SEED_PREFIX_HEX = hex"77686974656c69737465645f746f6b656e3a"; + + function deriveProgramConfigPda(bytes32 programId) internal pure returns (bytes32, uint8) { + bytes[] memory seeds = new bytes[](1); + seeds[0] = PROGRAM_CONFIG_SEED_PREFIX_HEX; + + return SolanaPDA.findProgramAddress(programId, seeds); + } + + function deriveTmpReturnStoragePda(bytes32 programId) internal pure returns (bytes32, uint8) { + bytes[] memory seeds = new bytes[](1); + seeds[0] = TMP_DATA_SEED_PREFIX_HEX; + + return SolanaPDA.findProgramAddress(programId, seeds); + } + + function deriveWhitelistedTokenPda( + bytes32 programId, + bytes32 tokenMint + ) internal pure returns (bytes32, uint8) { + bytes[] memory seeds = new bytes[](2); + seeds[0] = WHITELISTED_TOKEN_SEED_PREFIX_HEX; + seeds[1] = abi.encodePacked(tokenMint); + + return SolanaPDA.findProgramAddress(programId, seeds); + } + + function deriveVaultConfigPda(bytes32 programId) internal pure returns (bytes32, uint8) { + bytes[] memory seeds = new bytes[](1); + seeds[0] = VAULT_CONFIG_SEED_PREFIX_HEX; + + return SolanaPDA.findProgramAddress(programId, seeds); + } +} diff --git a/contracts/evmx/helpers/solana-utils/program-pda/SUSDCPdas.sol b/contracts/evmx/helpers/solana-utils/program-pda/SUSDCPdas.sol new file mode 100644 index 00000000..a347c0d4 --- /dev/null +++ b/contracts/evmx/helpers/solana-utils/program-pda/SUSDCPdas.sol @@ -0,0 +1,25 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.21; + +import {SolanaPDA} from "../SolanaPda.sol"; + +library SusdcProgramPda { + // string: "config:" + bytes constant PROGRAM_CONFIG_SEED_PREFIX_HEX = hex"636f6e6669673a"; + // string: "tmp_data:" + bytes constant TMP_DATA_SEED_PREFIX_HEX = hex"746d705f646174613a"; + + function deriveProgramConfigPda(bytes32 programId) internal pure returns (bytes32, uint8) { + bytes[] memory seeds = new bytes[](1); + seeds[0] = PROGRAM_CONFIG_SEED_PREFIX_HEX; + + return SolanaPDA.findProgramAddress(programId, seeds); + } + + function deriveTmpReturnStoragePda(bytes32 programId) internal pure returns (bytes32, uint8) { + bytes[] memory seeds = new bytes[](1); + seeds[0] = TMP_DATA_SEED_PREFIX_HEX; + + return SolanaPDA.findProgramAddress(programId, seeds); + } +} diff --git a/contracts/evmx/interfaces/IConfigurations.sol b/contracts/evmx/interfaces/IConfigurations.sol index 49cc0bbf..a1c2b619 100644 --- a/contracts/evmx/interfaces/IConfigurations.sol +++ b/contracts/evmx/interfaces/IConfigurations.sol @@ -13,7 +13,7 @@ interface IConfigurations { bytes32 target_, address appGateway_, bytes32 switchboardType_ - ) external view; + ) external; /// @notice Maps app gateway, chain slug and plug to validity function isValidPlug( diff --git a/contracts/evmx/interfaces/IFeesManager.sol b/contracts/evmx/interfaces/IFeesManager.sol index 01555b26..efebba37 100644 --- a/contracts/evmx/interfaces/IFeesManager.sol +++ b/contracts/evmx/interfaces/IFeesManager.sol @@ -5,8 +5,8 @@ import {WriteFinality, AppGatewayApprovals, OverrideParams, Transaction, QueuePa interface IFeesManager { function deposit( uint32 chainSlug_, - address token_, - address depositTo_, + bytes32 token_, + address depositToEvmxAddress_, uint256 nativeAmount_, uint256 creditAmount_, bytes memory data_ @@ -35,7 +35,15 @@ interface IFeesManager { address token_, uint256 credits_, uint256 maxFees_, - address receiver_ + address onchainReceiver_ + ) external; + + function withdrawCreditsSolana( + uint32 chainSlug_, + bytes32 token_, + uint256 credits_, + uint256 maxFees_, + bytes32 onchainReceiver_ ) external; function blockCredits(uint40 requestCount_, address consumeFrom_, uint256 credits_) external; @@ -48,6 +56,13 @@ interface IFeesManager { function burn(uint32 chainSlug_, address receiver_, uint256 amount_) external; + function burnSolana( + uint32 chainSlug_, + bytes32 receiver_, + uint256 amount_, + bytes32 burnTokenMint_ + ) external; + function mint(address to, uint256 amount, bytes memory data_) external; function setMaxFees(uint256 fees_) external; diff --git a/contracts/evmx/interfaces/IPrecompile.sol b/contracts/evmx/interfaces/IPrecompile.sol index 6241434c..997f691d 100644 --- a/contracts/evmx/interfaces/IPrecompile.sol +++ b/contracts/evmx/interfaces/IPrecompile.sol @@ -18,7 +18,7 @@ interface IPrecompile { function validateAndGetPrecompileData( QueueParams calldata queueParams_, address appGateway_ - ) external view returns (bytes memory precompileData, uint256 estimatedFees); + ) external returns (bytes memory precompileData, uint256 estimatedFees); /// @notice Handles payload processing and returns fees /// @param transmitter The address of the transmitter diff --git a/contracts/evmx/watcher/Configurations.sol b/contracts/evmx/watcher/Configurations.sol index ddeee64c..492e88a2 100644 --- a/contracts/evmx/watcher/Configurations.sol +++ b/contracts/evmx/watcher/Configurations.sol @@ -45,7 +45,7 @@ abstract contract ConfigurationsStorage is IConfigurations { /// @dev Handles the mapping between networks, plugs, and app gateways for payload execution contract Configurations is ConfigurationsStorage, Initializable, Ownable, WatcherBase { // TODO:GW: remove after testing Solana - event VerifyConnectionsSB(bytes32 switchboard, bytes32 switchboardExpected); + event VerifyGateway(uint32 chainSlug, bytes32 plug, address appGateway, bytes32 appGatewayId); /// @notice Emitted when a new plug is configured for an app gateway /// @param appGatewayId The id of the app gateway @@ -161,8 +161,10 @@ contract Configurations is ConfigurationsStorage, Initializable, Ownable, Watche bytes32 target_, address appGateway_, bytes32 switchboardType_ - ) external view { + ) external { (bytes32 appGatewayId, uint64 switchboardId) = getPlugConfigs(chainSlug_, target_); + // TODO:GW: remove after testing Solana + emit VerifyGateway(chainSlug_, target_, appGateway_, appGatewayId); if (appGatewayId != toBytes32Format(appGateway_)) revert InvalidGateway(); if (switchboardId != switchboards[chainSlug_][switchboardType_]) revert InvalidSwitchboard(); diff --git a/contracts/evmx/watcher/RequestHandler.sol b/contracts/evmx/watcher/RequestHandler.sol index a5d793e0..8b0361ee 100644 --- a/contracts/evmx/watcher/RequestHandler.sol +++ b/contracts/evmx/watcher/RequestHandler.sol @@ -138,7 +138,7 @@ contract RequestHandler is RequestHandlerStorage, Initializable, Ownable, Addres function submitRequest( uint256 maxFees_, address auctionManager_, - address consumeFrom_, + address consumeFrom_, // who is paying credits for this request address appGateway_, QueueParams[] calldata queueParams_, bytes memory onCompleteData_ @@ -284,7 +284,7 @@ contract RequestHandler is RequestHandlerStorage, Initializable, Ownable, Addres QueueParams calldata payloadParams_, address appGateway_, bytes4 callType_ - ) internal view returns (bytes memory precompileData, uint256 estimatedFees) { + ) internal returns (bytes memory precompileData, uint256 estimatedFees) { if (address(precompiles[callType_]) == address(0)) revert InvalidCallType(); return IPrecompile(precompiles[callType_]).validateAndGetPrecompileData( diff --git a/contracts/evmx/watcher/borsh-serde/BorshDecoder.sol b/contracts/evmx/watcher/borsh-serde/BorshDecoder.sol index 014c80ee..cb22bb57 100644 --- a/contracts/evmx/watcher/borsh-serde/BorshDecoder.sol +++ b/contracts/evmx/watcher/borsh-serde/BorshDecoder.sol @@ -7,20 +7,20 @@ import "./BorshUtils.sol"; library BorshDecoder { /// Decodes the borsh schema into abi.encode(value) list of params - /// Handles decoding of: + /// Handles decoding of: /// 1. u8/u16/u32/u64 Rust types /// 2. "String" Rust type /// 3. array/Vec and String numeric Rust types (mentioned in 1) and 2)) function decodeGenericSchema( GenericSchema memory schema, - bytes memory encodedData + bytes memory encodedData ) internal pure returns (bytes[] memory) { bytes[] memory decodedParams = new bytes[](schema.valuesTypeNames.length); Data memory data = from(encodedData); - + for (uint256 i = 0; i < schema.valuesTypeNames.length; i++) { string memory typeName = schema.valuesTypeNames[i]; - + if (keccak256(bytes(typeName)) == keccak256(bytes("u8"))) { uint8 value = data.decodeU8(); decodedParams[i] = abi.encode(value); @@ -101,7 +101,7 @@ library BorshDecoder { revert("Unsupported type"); } } - + return decodedParams; } @@ -214,128 +214,146 @@ library BorshDecoder { function decodeUint8Vec(Data memory data) internal pure returns (uint32, uint8[] memory) { uint32 length = data.decodeU32(); uint8[] memory values = new uint8[](length); - + for (uint256 i = 0; i < length; i++) { values[i] = data.decodeU8(); } - + return (length, values); } function decodeUint16Vec(Data memory data) internal pure returns (uint32, uint16[] memory) { uint32 length = data.decodeU32(); uint16[] memory values = new uint16[](length); - + for (uint256 i = 0; i < length; i++) { values[i] = data.decodeU16(); } - + return (length, values); } function decodeUint32Vec(Data memory data) internal pure returns (uint32, uint32[] memory) { uint32 length = data.decodeU32(); uint32[] memory values = new uint32[](length); - + for (uint256 i = 0; i < length; i++) { values[i] = data.decodeU32(); } - + return (length, values); } function decodeUint64Vec(Data memory data) internal pure returns (uint32, uint64[] memory) { uint32 length = data.decodeU32(); uint64[] memory values = new uint64[](length); - + for (uint256 i = 0; i < length; i++) { values[i] = data.decodeU64(); } - + return (length, values); } function decodeUint128Vec(Data memory data) internal pure returns (uint32, uint128[] memory) { uint32 length = data.decodeU32(); uint128[] memory values = new uint128[](length); - + for (uint256 i = 0; i < length; i++) { values[i] = data.decodeU128(); } - + return (length, values); } function decodeStringVec(Data memory data) internal pure returns (uint32, string[] memory) { uint32 length = data.decodeU32(); string[] memory values = new string[](length); - + for (uint256 i = 0; i < length; i++) { values[i] = data.decodeString(); } - + return (length, values); } /********* Decode array types with fixed length *********/ - function decodeUint8Array(Data memory data, uint256 length) internal pure returns (uint8[] memory) { + function decodeUint8Array( + Data memory data, + uint256 length + ) internal pure returns (uint8[] memory) { uint8[] memory values = new uint8[](length); - + for (uint256 i = 0; i < length; i++) { values[i] = data.decodeU8(); } - + return values; } - function decodeUint16Array(Data memory data, uint256 length) internal pure returns (uint16[] memory) { + function decodeUint16Array( + Data memory data, + uint256 length + ) internal pure returns (uint16[] memory) { uint16[] memory values = new uint16[](length); - + for (uint256 i = 0; i < length; i++) { values[i] = data.decodeU16(); } - + return values; } - function decodeUint32Array(Data memory data, uint256 length) internal pure returns (uint32[] memory) { + function decodeUint32Array( + Data memory data, + uint256 length + ) internal pure returns (uint32[] memory) { uint32[] memory values = new uint32[](length); - + for (uint256 i = 0; i < length; i++) { values[i] = data.decodeU32(); } - + return values; } - function decodeUint64Array(Data memory data, uint256 length) internal pure returns (uint64[] memory) { + function decodeUint64Array( + Data memory data, + uint256 length + ) internal pure returns (uint64[] memory) { uint64[] memory values = new uint64[](length); - + for (uint256 i = 0; i < length; i++) { values[i] = data.decodeU64(); } - + return values; } - function decodeUint128Array(Data memory data, uint256 length) internal pure returns (uint128[] memory) { + function decodeUint128Array( + Data memory data, + uint256 length + ) internal pure returns (uint128[] memory) { uint128[] memory values = new uint128[](length); - + for (uint256 i = 0; i < length; i++) { values[i] = data.decodeU128(); } - + return values; } - function decodeStringArray(Data memory data, uint256 length) internal pure returns (string[] memory) { + function decodeStringArray( + Data memory data, + uint256 length + ) internal pure returns (string[] memory) { string[] memory values = new string[](length); - + for (uint256 i = 0; i < length; i++) { values[i] = data.decodeString(); } - + return values; - } -} \ No newline at end of file + } +} diff --git a/contracts/evmx/watcher/borsh-serde/BorshEncoder.sol b/contracts/evmx/watcher/borsh-serde/BorshEncoder.sol index e0b0f9cb..131242aa 100644 --- a/contracts/evmx/watcher/borsh-serde/BorshEncoder.sol +++ b/contracts/evmx/watcher/borsh-serde/BorshEncoder.sol @@ -45,7 +45,7 @@ library BorshEncoder { functionArgsPacked = abi.encodePacked(functionArgsPacked, borshEncodedArg); } // Handle array types with fixed length - else if (BorshUtils.startsWith(typeName, "[u8;")) { + else if (BorshUtils.startsWith(typeName, "u8[]")) { uint8[] memory abiDecodedArg = abi.decode(data, (uint8[])); bytes memory borshEncodedArg = encodeUint8Array(abiDecodedArg); functionArgsPacked = abi.encodePacked(functionArgsPacked, borshEncodedArg); @@ -98,9 +98,32 @@ library BorshEncoder { } // Handle array types with fixed length - no length prefix, just the bytes else if (BorshUtils.startsWith(typeName, "[u8;")) { - uint8[] memory abiDecodedArg = abi.decode(data, (uint8[])); - bytes memory borshEncodedArg = encodeUint8Array(abiDecodedArg); - functionArgsPacked = abi.encodePacked(functionArgsPacked, borshEncodedArg); + // Old code to be fixed: + // uint8[] memory abiDecodedArg = abi.decode(data, (uint8[])); + // bytes memory borshEncodedArg = encodeUint8Array(abiDecodedArg); + // functionArgsPacked = abi.encodePacked(functionArgsPacked, borshEncodedArg); + + // TODO: this is a tmp fix, later we must fix this to use GenericSchema for decoding the arrays + // like in test: BorshEncoderTest.testEncodeBytes32Account() + + uint256 expectedLength = BorshUtils.extractArrayLength(typeName); + if (data.length == expectedLength) { + // payload already provided as tightly packed bytes + functionArgsPacked = abi.encodePacked(functionArgsPacked, data); + } else if (data.length == expectedLength * 32) { + // payload encoded as abi.encode(uint8[N]) -> each element padded to 32 bytes + uint8[] memory abiDecodedArg = new uint8[](expectedLength); + for (uint256 j = 0; j < expectedLength; j++) { + abiDecodedArg[j] = uint8(data[j * 32 + 31]); + } + bytes memory borshEncodedArg = encodeUint8Array(abiDecodedArg); + functionArgsPacked = abi.encodePacked(functionArgsPacked, borshEncodedArg); + } else { + uint8[] memory abiDecodedArg = abi.decode(data, (uint8[])); + require(abiDecodedArg.length == expectedLength, "[u8;N] length mismatch"); + bytes memory borshEncodedArg = encodeUint8Array(abiDecodedArg); + functionArgsPacked = abi.encodePacked(functionArgsPacked, borshEncodedArg); + } } else if (BorshUtils.startsWith(typeName, "[u16;")) { uint16[] memory abiDecodedArg = abi.decode(data, (uint16[])); bytes memory borshEncodedArg = encodeUint16Array(abiDecodedArg); diff --git a/contracts/evmx/watcher/borsh-serde/BorshUtils.sol b/contracts/evmx/watcher/borsh-serde/BorshUtils.sol index 06a5d9ad..82f92ff7 100644 --- a/contracts/evmx/watcher/borsh-serde/BorshUtils.sol +++ b/contracts/evmx/watcher/borsh-serde/BorshUtils.sol @@ -2,9 +2,7 @@ // Based on Aurora bridge repo: https://github.com/aurora-is-near/aurora-contracts-sdk/blob/main/aurora-solidity-sdk pragma solidity ^0.8.21; - library BorshUtils { - function readMemory(uint256 ptr) internal pure returns (uint256 res) { assembly { res := mload(ptr) @@ -22,8 +20,13 @@ library BorshUtils { assembly { // 0x40 is the address of free memory pointer. res := mload(0x40) - let end := - add(res, and(add(length, 63), 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0)) + let end := add( + res, + and( + add(length, 63), + 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0 + ) + ) // end = res + 32 + 32 * ceil(length / 32). mstore(0x40, end) mstore(res, length) @@ -100,26 +103,30 @@ library BorshUtils { uint256 length = 0; bool foundSemicolon = false; bool foundDigit = false; - + // Parse patterns like "[u8; 32]" for (uint256 i = 0; i < typeBytes.length; i++) { bytes1 char = typeBytes[i]; - - if (char == 0x3B) { // ';' + + if (char == 0x3B) { + // ';' foundSemicolon = true; - } else if (foundSemicolon && char >= 0x30 && char <= 0x39) { // '0' to '9' + } else if (foundSemicolon && char >= 0x30 && char <= 0x39) { + // '0' to '9' foundDigit = true; length = length * 10 + uint256(uint8(char)) - 48; // Convert ASCII to number - } else if (foundSemicolon && foundDigit && char == 0x5D) { // ']' + } else if (foundSemicolon && foundDigit && char == 0x5D) { + // ']' break; // End of array type declaration - } else if (foundSemicolon && foundDigit && char != 0x20) { // Not a space + } else if (foundSemicolon && foundDigit && char != 0x20) { + // Not a space // If we found digits but hit a non-digit non-space, invalid format revert("Invalid array length format"); } // Skip spaces and other characters before semicolon } - + require(foundSemicolon && foundDigit && length > 0, "Could not extract array length"); return length; } -} \ No newline at end of file +} diff --git a/contracts/evmx/watcher/precompiles/WritePrecompile.sol b/contracts/evmx/watcher/precompiles/WritePrecompile.sol index d51bceca..454fc3b1 100644 --- a/contracts/evmx/watcher/precompiles/WritePrecompile.sol +++ b/contracts/evmx/watcher/precompiles/WritePrecompile.sol @@ -67,6 +67,11 @@ contract WritePrecompile is WritePrecompileStorage, Initializable, Ownable, Watc event WriteProofUploaded(bytes32 indexed payloadId, bytes proof); event ExpiryTimeSet(uint256 expiryTime); + // TODO: remove after debugging + event SolanaInstructionInput(bytes payload); + event SolanaDecodedInstruction(SolanaInstruction instruction); + event SolanaFunctionArgsPacked(bytes functionArgsPacked); + constructor() { _disableInitializers(); // disable for implementation } @@ -94,7 +99,7 @@ contract WritePrecompile is WritePrecompileStorage, Initializable, Ownable, Watc function validateAndGetPrecompileData( QueueParams memory queueParams_, address appGateway_ - ) external view override returns (bytes memory precompileData, uint256 estimatedFees) { + ) external override returns (bytes memory precompileData, uint256 estimatedFees) { if ( queueParams_.overrideParams.value > chainMaxMsgValueLimit[queueParams_.transaction.chainSlug] @@ -144,7 +149,7 @@ contract WritePrecompile is WritePrecompileStorage, Initializable, Ownable, Watc queueParams_.overrideParams.writeFinality, queueParams_.overrideParams.gasLimit, queueParams_.overrideParams.value, - configurations__().switchboards( // switchboardId + configurations__().switchboards( // switchboardId queueParams_.transaction.chainSlug, queueParams_.switchboardType ) @@ -170,8 +175,8 @@ contract WritePrecompile is WritePrecompileStorage, Initializable, Ownable, Watc Transaction memory transaction, , uint256 gasLimit, - uint256 value - ,// switchboardId + uint256 value, // switchboardId + ) = abi.decode( payloadParams.precompileData, (address, Transaction, WriteFinality, uint256, uint256, uint64) @@ -302,18 +307,25 @@ contract WritePrecompile is WritePrecompileStorage, Initializable, Ownable, Watc PayloadParams memory payloadParams_, Transaction memory transaction_, address appGateway_, - address transmitter_, + address /*transmitter_*/, bytes32 prevBatchDigestHash_, uint256 deadline_, uint256 gasLimit_, uint256 value_ - ) internal view returns (DigestParams memory) { + ) internal returns (DigestParams memory) { + emit SolanaInstructionInput(transaction_.payload); + SolanaInstruction memory instruction = abi.decode( transaction_.payload, (SolanaInstruction) ); + + emit SolanaDecodedInstruction(instruction); + bytes memory functionArgsPacked = BorshEncoder.encodeFunctionArgs(instruction); + emit SolanaFunctionArgsPacked(functionArgsPacked); + bytes memory payloadPacked = abi.encodePacked( instruction.data.programId, instruction.data.accounts, @@ -321,13 +333,19 @@ contract WritePrecompile is WritePrecompileStorage, Initializable, Ownable, Watc functionArgsPacked ); + // TODO: this is temporary, must be injected from function arguments // bytes32 of Solana Socket address : 9vFEQ5e3xf4eo17WttfqmXmnqN3gUicrhFGppmmNwyqV bytes32 hardcodedSocket = 0x84815e8ca2f6dad7e12902c39a51bc72e13c48139b4fb10025d94e7abea2969c; + // bytes32 of Solana transmitter address : pFCBP4bhqdSsrWUVTgqhPsLrfEdChBK17vgFM7TxjxQ - local testing + // bytes32 transmitterSolana = 0x0c1a5886fe1093df9fc438c296f9f7275b7718b6bc0e156d8d336c58f083996d; + // bytes32 of Solana transmitter address : 8cg7rkZn8M5WKZohbvgYTp4nMaYAyGt4qZeftewGeHU2 - stage testing + bytes32 transmitterSolana = 0x71255e30f1493eea868d431b2aa93f65f439afe739a6cf123dd5cf1096564a97; return DigestParams( // watcherPrecompileConfig__.sockets(params_.payloadHeader.getChainSlug()), // TODO: this does not work, for some reason it returns 0x000.... address hardcodedSocket, - toBytes32Format(transmitter_), + // toBytes32Format(transmitter_), + transmitterSolana, payloadParams_.payloadId, deadline_, payloadParams_.callType, diff --git a/contracts/utils/common/Structs.sol b/contracts/utils/common/Structs.sol index c10b953a..9513525b 100644 --- a/contracts/utils/common/Structs.sol +++ b/contracts/utils/common/Structs.sol @@ -259,4 +259,4 @@ struct SolanaReadRequest { struct GenericSchema { // list of types recognizable by BorshEncoder that we expect to read from Solana account (data model) string[] valuesTypeNames; -} \ No newline at end of file +} diff --git a/deployments/dev_addresses.json b/deployments/dev_addresses.json index 53fbdc36..5ebd4993 100644 --- a/deployments/dev_addresses.json +++ b/deployments/dev_addresses.json @@ -1,315 +1,56 @@ { - "1": { - "ContractFactoryPlug": "0xfE34ACE07836F7F05f485EAc7122D0CD58BAC047", - "FastSwitchboard": "0xee1Aef0b06f63Aa1c881838794Dd0876462c2B0d", - "FastSwitchboardId": "1", - "FeesPlug": "0x9EDfb162b725CF6d628D68af200cAe8b624111eD", - "Socket": "0xbDE0D2da12F703Ccd275d721214745BccDCAD124", - "SocketBatcher": "0x5F77550E3072c913A20B2fbdAb14026fe0E8B450", - "startBlock": 23368199, - "SUSDC": "0xa33ACE59E4b0d9a45Cd4a3F0DBAB86D87BDd67e2", - "SwitchboardIdToAddressMap": { - "1": "0xee1Aef0b06f63Aa1c881838794Dd0876462c2B0d" - } - }, - "56": { - "ContractFactoryPlug": "0xa33ACE59E4b0d9a45Cd4a3F0DBAB86D87BDd67e2", - "FastSwitchboard": "0xbDE0D2da12F703Ccd275d721214745BccDCAD124", - "FastSwitchboardId": "1", - "FeesPlug": "0xee1Aef0b06f63Aa1c881838794Dd0876462c2B0d", - "Socket": "0x5e1641B190B71ECCc85b1ECe934F31cD9b3dcF7a", - "SocketBatcher": "0xaC61f5696e0E2636dA7bD69827380f2Ab41A3C38", - "startBlock": 60248517, - "SUSDC": "0x9EDfb162b725CF6d628D68af200cAe8b624111eD", - "SwitchboardIdToAddressMap": { - "1": "0xbDE0D2da12F703Ccd275d721214745BccDCAD124" - } - }, - "100": { - "ContractFactoryPlug": "0xa33ACE59E4b0d9a45Cd4a3F0DBAB86D87BDd67e2", - "FastSwitchboard": "0xbDE0D2da12F703Ccd275d721214745BccDCAD124", - "FastSwitchboardId": "1", - "FeesPlug": "0xee1Aef0b06f63Aa1c881838794Dd0876462c2B0d", - "Socket": "0x5e1641B190B71ECCc85b1ECe934F31cD9b3dcF7a", - "SocketBatcher": "0xaC61f5696e0E2636dA7bD69827380f2Ab41A3C38", - "startBlock": 41989627, - "SUSDC": "0x9EDfb162b725CF6d628D68af200cAe8b624111eD", - "SwitchboardIdToAddressMap": { - "1": "0xbDE0D2da12F703Ccd275d721214745BccDCAD124" - } - }, - "130": { - "ContractFactoryPlug": "0xa33ACE59E4b0d9a45Cd4a3F0DBAB86D87BDd67e2", - "FastSwitchboard": "0x5F77550E3072c913A20B2fbdAb14026fe0E8B450", - "FastSwitchboardId": "1", - "FeesPlug": "0xee1Aef0b06f63Aa1c881838794Dd0876462c2B0d", - "Socket": "0xaC61f5696e0E2636dA7bD69827380f2Ab41A3C38", - "SocketBatcher": "0xbDE0D2da12F703Ccd275d721214745BccDCAD124", - "startBlock": 27026358, - "SUSDC": "0x9EDfb162b725CF6d628D68af200cAe8b624111eD", - "SwitchboardIdToAddressMap": { - "1": "0x5F77550E3072c913A20B2fbdAb14026fe0E8B450" - } - }, - "137": { - "ContractFactoryPlug": "0xa33ACE59E4b0d9a45Cd4a3F0DBAB86D87BDd67e2", - "FastSwitchboard": "0x5F77550E3072c913A20B2fbdAb14026fe0E8B450", - "FastSwitchboardId": "1", - "FeesPlug": "0xee1Aef0b06f63Aa1c881838794Dd0876462c2B0d", - "Socket": "0xaC61f5696e0E2636dA7bD69827380f2Ab41A3C38", - "SocketBatcher": "0xbDE0D2da12F703Ccd275d721214745BccDCAD124", - "startBlock": 76135057, - "SUSDC": "0x9EDfb162b725CF6d628D68af200cAe8b624111eD", - "SwitchboardIdToAddressMap": { - "1": "0x5F77550E3072c913A20B2fbdAb14026fe0E8B450" - } - }, - "146": { - "ContractFactoryPlug": "0xa33ACE59E4b0d9a45Cd4a3F0DBAB86D87BDd67e2", - "FastSwitchboard": "0xbDE0D2da12F703Ccd275d721214745BccDCAD124", - "FastSwitchboardId": "1", - "FeesPlug": "0xee1Aef0b06f63Aa1c881838794Dd0876462c2B0d", - "Socket": "0x5e1641B190B71ECCc85b1ECe934F31cD9b3dcF7a", - "SocketBatcher": "0xaC61f5696e0E2636dA7bD69827380f2Ab41A3C38", - "startBlock": 45976634, - "SUSDC": "0x9EDfb162b725CF6d628D68af200cAe8b624111eD", - "SwitchboardIdToAddressMap": { - "1": "0xbDE0D2da12F703Ccd275d721214745BccDCAD124" - } - }, - "169": { - "ContractFactoryPlug": "0xa33ACE59E4b0d9a45Cd4a3F0DBAB86D87BDd67e2", - "FastSwitchboard": "0x5F77550E3072c913A20B2fbdAb14026fe0E8B450", - "FastSwitchboardId": "1", - "FeesPlug": "0xee1Aef0b06f63Aa1c881838794Dd0876462c2B0d", - "Socket": "0xaC61f5696e0E2636dA7bD69827380f2Ab41A3C38", - "SocketBatcher": "0xbDE0D2da12F703Ccd275d721214745BccDCAD124", - "startBlock": 6381187, - "SUSDC": "0x9EDfb162b725CF6d628D68af200cAe8b624111eD", - "SwitchboardIdToAddressMap": { - "1": "0x5F77550E3072c913A20B2fbdAb14026fe0E8B450" - } - }, - "484": { - "ContractFactoryPlug": "0xfE34ACE07836F7F05f485EAc7122D0CD58BAC047", - "FastSwitchboard": "0xee1Aef0b06f63Aa1c881838794Dd0876462c2B0d", - "FastSwitchboardId": "1", - "FeesPlug": "0x9EDfb162b725CF6d628D68af200cAe8b624111eD", - "Socket": "0xbDE0D2da12F703Ccd275d721214745BccDCAD124", - "SocketBatcher": "0x5F77550E3072c913A20B2fbdAb14026fe0E8B450", - "startBlock": 6540991, - "SUSDC": "0xa33ACE59E4b0d9a45Cd4a3F0DBAB86D87BDd67e2", - "SwitchboardIdToAddressMap": { - "1": "0xee1Aef0b06f63Aa1c881838794Dd0876462c2B0d" - } - }, - "747": { - "ContractFactoryPlug": "0xfE34ACE07836F7F05f485EAc7122D0CD58BAC047", - "FastSwitchboard": "0xee1Aef0b06f63Aa1c881838794Dd0876462c2B0d", - "FastSwitchboardId": "1", - "FeesPlug": "0x9EDfb162b725CF6d628D68af200cAe8b624111eD", - "Socket": "0xbDE0D2da12F703Ccd275d721214745BccDCAD124", - "SocketBatcher": "0x5F77550E3072c913A20B2fbdAb14026fe0E8B450", - "startBlock": 40319172, - "SUSDC": "0xa33ACE59E4b0d9a45Cd4a3F0DBAB86D87BDd67e2", - "SwitchboardIdToAddressMap": { - "1": "0xee1Aef0b06f63Aa1c881838794Dd0876462c2B0d" - } - }, - "999": { - "ContractFactoryPlug": "0xa33ACE59E4b0d9a45Cd4a3F0DBAB86D87BDd67e2", - "FastSwitchboard": "0x5F77550E3072c913A20B2fbdAb14026fe0E8B450", - "FastSwitchboardId": "1", - "FeesPlug": "0xee1Aef0b06f63Aa1c881838794Dd0876462c2B0d", - "Socket": "0xaC61f5696e0E2636dA7bD69827380f2Ab41A3C38", - "SocketBatcher": "0xbDE0D2da12F703Ccd275d721214745BccDCAD124", - "startBlock": 13754196, - "SUSDC": "0x9EDfb162b725CF6d628D68af200cAe8b624111eD", - "SwitchboardIdToAddressMap": { - "1": "0x5F77550E3072c913A20B2fbdAb14026fe0E8B450" - } - }, - "1329": { - "ContractFactoryPlug": "0xa33ACE59E4b0d9a45Cd4a3F0DBAB86D87BDd67e2", - "FastSwitchboard": "0x5F77550E3072c913A20B2fbdAb14026fe0E8B450", - "FastSwitchboardId": "1", - "FeesPlug": "0xee1Aef0b06f63Aa1c881838794Dd0876462c2B0d", - "Socket": "0xaC61f5696e0E2636dA7bD69827380f2Ab41A3C38", - "SocketBatcher": "0xbDE0D2da12F703Ccd275d721214745BccDCAD124", - "startBlock": 167855363, - "SUSDC": "0x9EDfb162b725CF6d628D68af200cAe8b624111eD", - "SwitchboardIdToAddressMap": { - "1": "0x5F77550E3072c913A20B2fbdAb14026fe0E8B450" - } - }, - "5000": { - "ContractFactoryPlug": "0xcFb68baF734daA2b5df3eE18F1fb45c99230A2A5", - "FastSwitchboard": "0x72e8aba972EEe812d6a5C6Ab13197e884C7D8FA9", - "FastSwitchboardId": "1", - "FeesPlug": "0x0D85b9835bD1E82baeFcdb12C4D171294c64Afd2", - "Socket": "0xd8afBbB32706E7544f075151D4666D5B0B1F22CA", - "SocketBatcher": "0xb5763dC91FD626786E17b43E8808062a87b037aF", - "startBlock": 84961430, - "SUSDC": "0x6C1d46856dc8e1Fe16B1A8d0caEc720F9A58A193", - "SwitchboardIdToAddressMap": { - "1": "0x72e8aba972EEe812d6a5C6Ab13197e884C7D8FA9" - } - }, - "8453": { - "CCTPSwitchboard": "0xae59BA0Bd0D92232B3B6304185448C9Fe5445f4d", - "ContractFactoryPlug": "0xfE555AD869ac24305471F0755976c556425E8D23", - "FastSwitchboard": "0x0c17822dcC44F8202F176a4960EAC8da8FDbfCA5", - "FastSwitchboardId": "1", - "FeesPlug": "0x1eFD3AF2317B9E6E7492718878f69De747C9e7c3", - "MessageSwitchboard": "0xdaE4538FbbEf41B2Feb5c79DD2fFC9720AF13d7b", - "Socket": "0x7E33B305e12aD0E73B3aedBE67A53B7818732d7d", - "SocketBatcher": "0xfaf8a3f8f4221398F3eC765836e8BF4A3d975962", - "startBlock": 35196561, - "SUSDC": "0xbcaDE56f86a819994d0F66b98e921C484bE6FE4e", - "SwitchboardIdToAddressMap": { - "1": "0x0c17822dcC44F8202F176a4960EAC8da8FDbfCA5" - } - }, "14323": { - "AddressResolver": "0xcA99D298B5290558660b4D5C1019Be145FaB6020", - "AddressResolverImpl": "0x39b5D3FBBa1BC28438e25955aaB412C7576eCd61", - "AsyncDeployer": "0xd608e1345281dE0675e2Cc1E8D0B31aD167618Ad", - "AsyncDeployerImpl": "0x2F0E83Fcd03A191D280598c33d278AF8A7e9076a", - "AuctionManager": "0xED848E9e0CCA0868484353B529E04861Fd8F04Bd", - "AuctionManagerImpl": "0x2752caa4060bC744216515c247C54Ae5bB873DF2", - "Configurations": "0xf50A9785aef5ADeA0659609e9FF1de8578aF0b4f", - "ConfigurationsImpl": "0xa1780f9F81090737267ccd3A5663E058AfE73A49", - "DeployForwarder": "0xffF606007317cb7a1CC4C701d62C38c7734dfb15", - "DeployForwarderImpl": "0x69e3Dc5667f7413039fE3bFd335660A99DA869A9", - "ERC1967Factory": "0x4f1Cd0CdBc7EA445b8B34Af8844fA4D4B5f48b79", - "FeesManager": "0xbCFf8224d89f0b4e9B14c4356720439111BAC2bC", - "FeesManagerImpl": "0x62FB943442E577901Ad42Da5c64aaf850B43049c", + "AddressResolver": "0x914b7261d3256cDA3203769004b25cB956da8dE7", + "AddressResolverImpl": "0x6AEEf39D71534048e5A5700EE967c3941A96525A", + "AsyncDeployer": "0x40aEF36c4A2b548C03CAdDb409fac3FBAC81B200", + "AsyncDeployerImpl": "0x3b3C0e6980c0F812822C34af1846682D5a87152D", + "AuctionManager": "0x779BF2830549645484D04DDCb84aF019E0D021a2", + "AuctionManagerImpl": "0xbf41e76Ec6918EFF5E3d675A309cbEAC273D7e28", + "Configurations": "0x473732CC360f0958B9BBA18BD66051d8419Ef31c", + "ConfigurationsImpl": "0x9F09f4ccACE5E879E599e4382d00F7adc48f1534", + "DeployForwarder": "0x57e801B8c81c923C3DEDaDaDD48427ecaeF5b70F", + "DeployForwarderImpl": "0x1183261cA9561961e3FE3AD8C394345BDFb93d8c", + "ERC1967Factory": "0x1fF5eb3Eda6008dd18Ea2B7932c5d526200e7414", + "FeesManager": "0x17FfBAab211b98D8F658d41d8cD400448bC37D1b", + "FeesManagerImpl": "0xe65Bcf2fD2547b603318450aE424a9399A4aD785", "FeesPool": "0x13A3018920c7b56B20dd34E29C298121025E6de4", - "PromiseResolver": "0xed318668898303141EA6B9c2a9F97D0622b0a530", - "ReadPrecompile": "0x7C82C3d2aE1bFB4b1D294e5181bCd7489EF554d1", - "RequestHandler": "0xf053AB14323FF52e7e65D6Fb12f86896F0865a36", - "RequestHandlerImpl": "0x4904A0f8E054f2cd6594a0e1BAB4583DF43d2e49", - "SchedulePrecompile": "0x4660c5fF2762E688f8D0def828ad161AE4940F57", - "startBlock": 46937, - "Watcher": "0xCeEc354B7784C667Bd661483Ae30C8d4eBA96e1d", - "WatcherImpl": "0xce594728977675546d5da6152a076179982F1D39", - "WritePrecompile": "0x9a580f1A4AE6A37CCEe73261B796F85EFbE55B15", - "WritePrecompileImpl": "0x41882aff9F7575473e5B6E613B371d04bdCCC728" - }, - "43114": { - "CCTPSwitchboard": "0xa33ACE59E4b0d9a45Cd4a3F0DBAB86D87BDd67e2", - "ContractFactoryPlug": "0x302E258fe375A1da4d6B3F4Dd5208638A29bc409", - "FastSwitchboard": "0x9EDfb162b725CF6d628D68af200cAe8b624111eD", - "FastSwitchboardId": "1", - "FeesPlug": "0x3aac37DC85C522c09A3DDdA44D181E6aCCD2f9F0", - "MessageSwitchboard": "0xfE34ACE07836F7F05f485EAc7122D0CD58BAC047", - "Socket": "0x5F77550E3072c913A20B2fbdAb14026fe0E8B450", - "SocketBatcher": "0xee1Aef0b06f63Aa1c881838794Dd0876462c2B0d", - "startBlock": 68322256, - "SUSDC": "0x313397aE9B6c22AC0e00d039543AE425b1F1c039", - "SwitchboardIdToAddressMap": { - "1": "0x9EDfb162b725CF6d628D68af200cAe8b624111eD" - } - }, - "57073": { - "ContractFactoryPlug": "0xa33ACE59E4b0d9a45Cd4a3F0DBAB86D87BDd67e2", - "FastSwitchboard": "0x5F77550E3072c913A20B2fbdAb14026fe0E8B450", - "FastSwitchboardId": "1", - "FeesPlug": "0xee1Aef0b06f63Aa1c881838794Dd0876462c2B0d", - "Socket": "0xaC61f5696e0E2636dA7bD69827380f2Ab41A3C38", - "SocketBatcher": "0xbDE0D2da12F703Ccd275d721214745BccDCAD124", - "startBlock": 24276129, - "SUSDC": "0x9EDfb162b725CF6d628D68af200cAe8b624111eD", - "SwitchboardIdToAddressMap": { - "1": "0x5F77550E3072c913A20B2fbdAb14026fe0E8B450" - } - }, - "59144": { - "ContractFactoryPlug": "0xa33ACE59E4b0d9a45Cd4a3F0DBAB86D87BDd67e2", - "FastSwitchboard": "0xbDE0D2da12F703Ccd275d721214745BccDCAD124", - "FastSwitchboardId": "1", - "FeesPlug": "0xee1Aef0b06f63Aa1c881838794Dd0876462c2B0d", - "Socket": "0x5e1641B190B71ECCc85b1ECe934F31cD9b3dcF7a", - "SocketBatcher": "0xaC61f5696e0E2636dA7bD69827380f2Ab41A3C38", - "startBlock": 23003201, - "SUSDC": "0x9EDfb162b725CF6d628D68af200cAe8b624111eD", - "SwitchboardIdToAddressMap": { - "1": "0xbDE0D2da12F703Ccd275d721214745BccDCAD124" - } - }, - "80094": { - "ContractFactoryPlug": "0xa33ACE59E4b0d9a45Cd4a3F0DBAB86D87BDd67e2", - "FastSwitchboard": "0x5F77550E3072c913A20B2fbdAb14026fe0E8B450", - "FastSwitchboardId": "1", - "FeesPlug": "0xee1Aef0b06f63Aa1c881838794Dd0876462c2B0d", - "Socket": "0xaC61f5696e0E2636dA7bD69827380f2Ab41A3C38", - "SocketBatcher": "0xbDE0D2da12F703Ccd275d721214745BccDCAD124", - "startBlock": 10433014, - "SUSDC": "0x9EDfb162b725CF6d628D68af200cAe8b624111eD", - "SwitchboardIdToAddressMap": { - "1": "0x5F77550E3072c913A20B2fbdAb14026fe0E8B450" - } - }, - "84532": { - "CCTPSwitchboard": "0x9175d90706a2b17f0aE025ce5A6C76e64850c2f5", - "ContractFactoryPlug": "0xf8a9d637cd6fAf3d4C17277DceadbEE69d7752f0", - "FastSwitchboard": "0xE09CC429e77EE5DBeF68f3796b2A33BBDF39C03C", - "FastSwitchboardId": "1", - "FeesPlug": "0x3D7515519beab77B541497626CFB7E764F6887CD", - "MessageSwitchboard": "0xe7858f1dc202f5E9C9B3ee6db052F45164a88534", - "Socket": "0x22B521c3610D373Ea29698215eB78907Ad98B644", - "SocketBatcher": "0x26565cAeA64c78Dc7cB4158e7612451Db436A0c6", - "startBlock": 30707073, - "SUSDC": "0x01bDCAB43c423D08BaCe87ED716280536dAB3eF3", - "SwitchboardIdToAddressMap": { - "1": "0xE09CC429e77EE5DBeF68f3796b2A33BBDF39C03C" - } + "ForwarderSolana": "0xCDB5fE8572725B20A2C0Db85DDb0D025bCC16f86", + "ForwarderSolanaImpl": "0x1c728354F3452aCc71cB253C21984b50D128f12c", + "PromiseResolver": "0x0eFf5a5b1C76857997D7937A6420AB51e5275EFA", + "ReadPrecompile": "0xb6B70632Bb6b181ce88FEeF18CE653742B53d73A", + "RequestHandler": "0x905650e8b3C659F7Da205B2fA29018928ec4AAf4", + "RequestHandlerImpl": "0x76e2958Cb33485b592FCe1A13fCbF8829bF484fe", + "SchedulePrecompile": "0x667837807c244041ED48C2984Fd8085d498c6a0a", + "startBlock": 57479, + "Watcher": "0xB5c99FDb167500fcb775E870d82B9aABbD15b0E0", + "WatcherImpl": "0x9DaD548bD14f4D7B0b1734C76D6E0534D93A3739", + "WritePrecompile": "0x7B02b1B26AC01689DaC11BD6928b6a1fc42601b4", + "WritePrecompileImpl": "0xb6Cc1B1bF616257eA7594E6A858f9a30ECf619C1" }, "421614": { - "CCTPSwitchboard": "0x0355064bBb553A3765af498004749fB2e19284c0", - "CCTPSwitchboardId": "2", - "ContractFactoryPlug": "0x106A3205827D94d804CF7823B82E6742ED38D863", - "FastSwitchboard": "0x36620137587b544A8235C080067B3c439ae1c7d7", - "FastSwitchboardId": "1", - "FeesPlug": "0x9Fd89116E514142C04aE72824E2A7dC26F311655", - "MessageSwitchboard": "0x060493ac77c630f4d307Df9bb9bF32cE7462eb70", - "MessageSwitchboardId": "3", - "Socket": "0x0da062CDB868A30CbB6314074202d67e4eAaBa51", - "SocketBatcher": "0x18433B14d10Ee05D007e00f897B40696d6fC56f6", - "startBlock": 185630714, - "SUSDC": "0x7F7ad06B15cFe9ebE45b01C694205CdB64e8F56d", - "SwitchboardIdToAddressMap": { - "1": "0x36620137587b544A8235C080067B3c439ae1c7d7" - } - }, - "747474": { - "ContractFactoryPlug": "0xa33ACE59E4b0d9a45Cd4a3F0DBAB86D87BDd67e2", - "FastSwitchboard": "0xbDE0D2da12F703Ccd275d721214745BccDCAD124", + "ContractFactoryPlug": "0xA548678a3299b752A53eF359A491C423eBf030C7", + "FastSwitchboard": "0x4b267eD6Afa767911BB2a6f7d78a8B26BA933E85", "FastSwitchboardId": "1", - "FeesPlug": "0xee1Aef0b06f63Aa1c881838794Dd0876462c2B0d", - "Socket": "0x5e1641B190B71ECCc85b1ECe934F31cD9b3dcF7a", - "SocketBatcher": "0xaC61f5696e0E2636dA7bD69827380f2Ab41A3C38", - "startBlock": 10442238, - "SUSDC": "0x9EDfb162b725CF6d628D68af200cAe8b624111eD", + "FeesPlug": "0xFD2325fd63f3f19353A0F3ECE7F12f10952DEdfa", + "Socket": "0x07Cd4EA8649d29c5D09d0dE802bED4521b29c3eD", + "SocketBatcher": "0x38cFfF94ff9Cfd07A15019aFbCd10fBba4546189", + "startBlock": 201808160, + "SUSDC": "0xFBf91C7C358221c4dEe6FC8d5aF1383de276A93E", "SwitchboardIdToAddressMap": { - "1": "0xbDE0D2da12F703Ccd275d721214745BccDCAD124" + "1": "0x4b267eD6Afa767911BB2a6f7d78a8B26BA933E85" } }, "11155420": { - "CCTPSwitchboard": "0x56EaDAC97B54C0c7979Bd620cad389eC3476dB43", - "CCTPSwitchboardId": "2", - "ContractFactoryPlug": "0x253be2E93EadAD9D2802D83A26eE62E911F1E3fe", - "FastSwitchboard": "0x2cC155961F225AbFF5e64F4a8f9C4f59b2339172", + "ContractFactoryPlug": "0x6AF7fAfdb6eFFC084176cf8e1C840d3e946E2093", + "FastSwitchboard": "0xc4215781752F8F7c543f1e89cd52b140aF2d3e50", "FastSwitchboardId": "1", - "FeesPlug": "0x83Ad3d17493Bdc31C60344021CA93E8dD3666A2A", - "MessageSwitchboard": "0x9efC6D7050eF4F5b12205A32ceE49F456FFB6FA8", - "MessageSwitchboardId": "3", - "Socket": "0x631f1E974442d6d51B626cE27d0D7629F1C0aB38", - "SocketBatcher": "0x4b2942C43579C3a9405887CDFA2F2048a5bE91EE", - "startBlock": 32643803, - "SUSDC": "0x40F2CfE35134141F809582ad121BF23522b5Dd22", + "FeesPlug": "0x5e1BfC8e646b4677D5323E16f925206d2869Beb2", + "Socket": "0xD24d86F573a9dfA2922cCA4A94Cfe77d5755bAfb", + "SocketBatcher": "0xd9e1Bb23D6dB53C0FBE01BC64525009A4F420125", + "startBlock": 33980115, + "SUSDC": "0x9113982c9f497d4561e601013c77e287be1e0dfe", "SwitchboardIdToAddressMap": { - "1": "0x2cC155961F225AbFF5e64F4a8f9C4f59b2339172" + "1": "0xc4215781752F8F7c543f1e89cd52b140aF2d3e50" } } } diff --git a/deployments/dev_verification.json b/deployments/dev_verification.json index fcc8908c..9c95d464 100644 --- a/deployments/dev_verification.json +++ b/deployments/dev_verification.json @@ -1,1211 +1,5 @@ { - "1": [ - [ - "0xfE34ACE07836F7F05f485EAc7122D0CD58BAC047", - "ContractFactoryPlug", - "contracts/evmx/plugs/ContractFactoryPlug.sol", - [ - "0xbDE0D2da12F703Ccd275d721214745BccDCAD124", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" - ] - ], - [ - "0xa33ACE59E4b0d9a45Cd4a3F0DBAB86D87BDd67e2", - "SUSDC", - "contracts/evmx/plugs/SUSDC.sol", - [ - 18, - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "0xbDE0D2da12F703Ccd275d721214745BccDCAD124", - "SUSDC", - "SUSDC" - ] - ], - [ - "0x9EDfb162b725CF6d628D68af200cAe8b624111eD", - "FeesPlug", - "contracts/evmx/plugs/FeesPlug.sol", - [ - "0xbDE0D2da12F703Ccd275d721214745BccDCAD124", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" - ] - ], - [ - "0xee1Aef0b06f63Aa1c881838794Dd0876462c2B0d", - "FastSwitchboard", - "contracts/protocol/switchboard/FastSwitchboard.sol", - [ - 1, - "0xbDE0D2da12F703Ccd275d721214745BccDCAD124", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" - ] - ], - [ - "0x5F77550E3072c913A20B2fbdAb14026fe0E8B450", - "SocketBatcher", - "contracts/protocol/SocketBatcher.sol", - [ - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "0xbDE0D2da12F703Ccd275d721214745BccDCAD124" - ] - ], - [ - "0xbDE0D2da12F703Ccd275d721214745BccDCAD124", - "Socket", - "contracts/protocol/Socket.sol", - [ - 1, - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "EVMX" - ] - ] - ], - "56": [ - [ - "0xa33ACE59E4b0d9a45Cd4a3F0DBAB86D87BDd67e2", - "ContractFactoryPlug", - "contracts/evmx/plugs/ContractFactoryPlug.sol", - [ - "0x5e1641B190B71ECCc85b1ECe934F31cD9b3dcF7a", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" - ] - ], - [ - "0x9EDfb162b725CF6d628D68af200cAe8b624111eD", - "SUSDC", - "contracts/evmx/plugs/SUSDC.sol", - [ - 18, - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "0x5e1641B190B71ECCc85b1ECe934F31cD9b3dcF7a", - "SUSDC", - "SUSDC" - ] - ], - [ - "0xee1Aef0b06f63Aa1c881838794Dd0876462c2B0d", - "FeesPlug", - "contracts/evmx/plugs/FeesPlug.sol", - [ - "0x5e1641B190B71ECCc85b1ECe934F31cD9b3dcF7a", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" - ] - ], - [ - "0xbDE0D2da12F703Ccd275d721214745BccDCAD124", - "FastSwitchboard", - "contracts/protocol/switchboard/FastSwitchboard.sol", - [ - 56, - "0x5e1641B190B71ECCc85b1ECe934F31cD9b3dcF7a", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" - ] - ], - [ - "0xaC61f5696e0E2636dA7bD69827380f2Ab41A3C38", - "SocketBatcher", - "contracts/protocol/SocketBatcher.sol", - [ - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "0x5e1641B190B71ECCc85b1ECe934F31cD9b3dcF7a" - ] - ], - [ - "0x5e1641B190B71ECCc85b1ECe934F31cD9b3dcF7a", - "Socket", - "contracts/protocol/Socket.sol", - [ - 56, - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "EVMX" - ] - ] - ], - "100": [ - [ - "0xa33ACE59E4b0d9a45Cd4a3F0DBAB86D87BDd67e2", - "ContractFactoryPlug", - "contracts/evmx/plugs/ContractFactoryPlug.sol", - [ - "0x5e1641B190B71ECCc85b1ECe934F31cD9b3dcF7a", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" - ] - ], - [ - "0x9EDfb162b725CF6d628D68af200cAe8b624111eD", - "SUSDC", - "contracts/evmx/plugs/SUSDC.sol", - [ - 18, - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "0x5e1641B190B71ECCc85b1ECe934F31cD9b3dcF7a", - "SUSDC", - "SUSDC" - ] - ], - [ - "0xee1Aef0b06f63Aa1c881838794Dd0876462c2B0d", - "FeesPlug", - "contracts/evmx/plugs/FeesPlug.sol", - [ - "0x5e1641B190B71ECCc85b1ECe934F31cD9b3dcF7a", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" - ] - ], - [ - "0xbDE0D2da12F703Ccd275d721214745BccDCAD124", - "FastSwitchboard", - "contracts/protocol/switchboard/FastSwitchboard.sol", - [ - 100, - "0x5e1641B190B71ECCc85b1ECe934F31cD9b3dcF7a", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" - ] - ], - [ - "0xaC61f5696e0E2636dA7bD69827380f2Ab41A3C38", - "SocketBatcher", - "contracts/protocol/SocketBatcher.sol", - [ - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "0x5e1641B190B71ECCc85b1ECe934F31cD9b3dcF7a" - ] - ], - [ - "0x5e1641B190B71ECCc85b1ECe934F31cD9b3dcF7a", - "Socket", - "contracts/protocol/Socket.sol", - [ - 100, - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "EVMX" - ] - ] - ], - "130": [ - [ - "0xa33ACE59E4b0d9a45Cd4a3F0DBAB86D87BDd67e2", - "ContractFactoryPlug", - "contracts/evmx/plugs/ContractFactoryPlug.sol", - [ - "0xaC61f5696e0E2636dA7bD69827380f2Ab41A3C38", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" - ] - ], - [ - "0x9EDfb162b725CF6d628D68af200cAe8b624111eD", - "SUSDC", - "contracts/evmx/plugs/SUSDC.sol", - [ - 18, - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "0xaC61f5696e0E2636dA7bD69827380f2Ab41A3C38", - "SUSDC", - "SUSDC" - ] - ], - [ - "0xee1Aef0b06f63Aa1c881838794Dd0876462c2B0d", - "FeesPlug", - "contracts/evmx/plugs/FeesPlug.sol", - [ - "0xaC61f5696e0E2636dA7bD69827380f2Ab41A3C38", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" - ] - ], - [ - "0x5F77550E3072c913A20B2fbdAb14026fe0E8B450", - "FastSwitchboard", - "contracts/protocol/switchboard/FastSwitchboard.sol", - [ - 130, - "0xaC61f5696e0E2636dA7bD69827380f2Ab41A3C38", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" - ] - ], - [ - "0xbDE0D2da12F703Ccd275d721214745BccDCAD124", - "SocketBatcher", - "contracts/protocol/SocketBatcher.sol", - [ - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "0xaC61f5696e0E2636dA7bD69827380f2Ab41A3C38" - ] - ], - [ - "0xaC61f5696e0E2636dA7bD69827380f2Ab41A3C38", - "Socket", - "contracts/protocol/Socket.sol", - [ - 130, - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "EVMX" - ] - ] - ], - "137": [ - [ - "0xa33ACE59E4b0d9a45Cd4a3F0DBAB86D87BDd67e2", - "ContractFactoryPlug", - "contracts/evmx/plugs/ContractFactoryPlug.sol", - [ - "0xaC61f5696e0E2636dA7bD69827380f2Ab41A3C38", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" - ] - ], - [ - "0x9EDfb162b725CF6d628D68af200cAe8b624111eD", - "SUSDC", - "contracts/evmx/plugs/SUSDC.sol", - [ - 18, - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "0xaC61f5696e0E2636dA7bD69827380f2Ab41A3C38", - "SUSDC", - "SUSDC" - ] - ], - [ - "0xee1Aef0b06f63Aa1c881838794Dd0876462c2B0d", - "FeesPlug", - "contracts/evmx/plugs/FeesPlug.sol", - [ - "0xaC61f5696e0E2636dA7bD69827380f2Ab41A3C38", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" - ] - ], - [ - "0x5F77550E3072c913A20B2fbdAb14026fe0E8B450", - "FastSwitchboard", - "contracts/protocol/switchboard/FastSwitchboard.sol", - [ - 137, - "0xaC61f5696e0E2636dA7bD69827380f2Ab41A3C38", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" - ] - ], - [ - "0xbDE0D2da12F703Ccd275d721214745BccDCAD124", - "SocketBatcher", - "contracts/protocol/SocketBatcher.sol", - [ - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "0xaC61f5696e0E2636dA7bD69827380f2Ab41A3C38" - ] - ], - [ - "0xaC61f5696e0E2636dA7bD69827380f2Ab41A3C38", - "Socket", - "contracts/protocol/Socket.sol", - [ - 137, - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "EVMX" - ] - ] - ], - "146": [ - [ - "0xa33ACE59E4b0d9a45Cd4a3F0DBAB86D87BDd67e2", - "ContractFactoryPlug", - "contracts/evmx/plugs/ContractFactoryPlug.sol", - [ - "0x5e1641B190B71ECCc85b1ECe934F31cD9b3dcF7a", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" - ] - ], - [ - "0x9EDfb162b725CF6d628D68af200cAe8b624111eD", - "SUSDC", - "contracts/evmx/plugs/SUSDC.sol", - [ - 18, - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "0x5e1641B190B71ECCc85b1ECe934F31cD9b3dcF7a", - "SUSDC", - "SUSDC" - ] - ], - [ - "0xee1Aef0b06f63Aa1c881838794Dd0876462c2B0d", - "FeesPlug", - "contracts/evmx/plugs/FeesPlug.sol", - [ - "0x5e1641B190B71ECCc85b1ECe934F31cD9b3dcF7a", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" - ] - ], - [ - "0xbDE0D2da12F703Ccd275d721214745BccDCAD124", - "FastSwitchboard", - "contracts/protocol/switchboard/FastSwitchboard.sol", - [ - 146, - "0x5e1641B190B71ECCc85b1ECe934F31cD9b3dcF7a", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" - ] - ], - [ - "0xaC61f5696e0E2636dA7bD69827380f2Ab41A3C38", - "SocketBatcher", - "contracts/protocol/SocketBatcher.sol", - [ - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "0x5e1641B190B71ECCc85b1ECe934F31cD9b3dcF7a" - ] - ], - [ - "0x5e1641B190B71ECCc85b1ECe934F31cD9b3dcF7a", - "Socket", - "contracts/protocol/Socket.sol", - [ - 146, - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "EVMX" - ] - ] - ], - "169": [ - [ - "0xa33ACE59E4b0d9a45Cd4a3F0DBAB86D87BDd67e2", - "ContractFactoryPlug", - "contracts/evmx/plugs/ContractFactoryPlug.sol", - [ - "0xaC61f5696e0E2636dA7bD69827380f2Ab41A3C38", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" - ] - ], - [ - "0x9EDfb162b725CF6d628D68af200cAe8b624111eD", - "SUSDC", - "contracts/evmx/plugs/SUSDC.sol", - [ - 18, - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "0xaC61f5696e0E2636dA7bD69827380f2Ab41A3C38", - "SUSDC", - "SUSDC" - ] - ], - [ - "0xee1Aef0b06f63Aa1c881838794Dd0876462c2B0d", - "FeesPlug", - "contracts/evmx/plugs/FeesPlug.sol", - [ - "0xaC61f5696e0E2636dA7bD69827380f2Ab41A3C38", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" - ] - ], - [ - "0x5F77550E3072c913A20B2fbdAb14026fe0E8B450", - "FastSwitchboard", - "contracts/protocol/switchboard/FastSwitchboard.sol", - [ - 169, - "0xaC61f5696e0E2636dA7bD69827380f2Ab41A3C38", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" - ] - ], - [ - "0xbDE0D2da12F703Ccd275d721214745BccDCAD124", - "SocketBatcher", - "contracts/protocol/SocketBatcher.sol", - [ - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "0xaC61f5696e0E2636dA7bD69827380f2Ab41A3C38" - ] - ], - [ - "0xaC61f5696e0E2636dA7bD69827380f2Ab41A3C38", - "Socket", - "contracts/protocol/Socket.sol", - [ - 169, - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "EVMX" - ] - ] - ], - "484": [ - [ - "0xfE34ACE07836F7F05f485EAc7122D0CD58BAC047", - "ContractFactoryPlug", - "contracts/evmx/plugs/ContractFactoryPlug.sol", - [ - "0xbDE0D2da12F703Ccd275d721214745BccDCAD124", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" - ] - ], - [ - "0xa33ACE59E4b0d9a45Cd4a3F0DBAB86D87BDd67e2", - "SUSDC", - "contracts/evmx/plugs/SUSDC.sol", - [ - 18, - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "0xbDE0D2da12F703Ccd275d721214745BccDCAD124", - "SUSDC", - "SUSDC" - ] - ], - [ - "0x9EDfb162b725CF6d628D68af200cAe8b624111eD", - "FeesPlug", - "contracts/evmx/plugs/FeesPlug.sol", - [ - "0xbDE0D2da12F703Ccd275d721214745BccDCAD124", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" - ] - ], - [ - "0xee1Aef0b06f63Aa1c881838794Dd0876462c2B0d", - "FastSwitchboard", - "contracts/protocol/switchboard/FastSwitchboard.sol", - [ - 484, - "0xbDE0D2da12F703Ccd275d721214745BccDCAD124", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" - ] - ], - [ - "0x5F77550E3072c913A20B2fbdAb14026fe0E8B450", - "SocketBatcher", - "contracts/protocol/SocketBatcher.sol", - [ - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "0xbDE0D2da12F703Ccd275d721214745BccDCAD124" - ] - ], - [ - "0xbDE0D2da12F703Ccd275d721214745BccDCAD124", - "Socket", - "contracts/protocol/Socket.sol", - [ - 484, - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "EVMX" - ] - ] - ], - "747": [ - [ - "0xfE34ACE07836F7F05f485EAc7122D0CD58BAC047", - "ContractFactoryPlug", - "contracts/evmx/plugs/ContractFactoryPlug.sol", - [ - "0xbDE0D2da12F703Ccd275d721214745BccDCAD124", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" - ] - ], - [ - "0xa33ACE59E4b0d9a45Cd4a3F0DBAB86D87BDd67e2", - "SUSDC", - "contracts/evmx/plugs/SUSDC.sol", - [ - 18, - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "0xbDE0D2da12F703Ccd275d721214745BccDCAD124", - "SUSDC", - "SUSDC" - ] - ], - [ - "0x9EDfb162b725CF6d628D68af200cAe8b624111eD", - "FeesPlug", - "contracts/evmx/plugs/FeesPlug.sol", - [ - "0xbDE0D2da12F703Ccd275d721214745BccDCAD124", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" - ] - ], - [ - "0xee1Aef0b06f63Aa1c881838794Dd0876462c2B0d", - "FastSwitchboard", - "contracts/protocol/switchboard/FastSwitchboard.sol", - [ - 747, - "0xbDE0D2da12F703Ccd275d721214745BccDCAD124", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" - ] - ], - [ - "0x5F77550E3072c913A20B2fbdAb14026fe0E8B450", - "SocketBatcher", - "contracts/protocol/SocketBatcher.sol", - [ - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "0xbDE0D2da12F703Ccd275d721214745BccDCAD124" - ] - ], - [ - "0xbDE0D2da12F703Ccd275d721214745BccDCAD124", - "Socket", - "contracts/protocol/Socket.sol", - [ - 747, - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "EVMX" - ] - ] - ], - "999": [ - [ - "0xa33ACE59E4b0d9a45Cd4a3F0DBAB86D87BDd67e2", - "ContractFactoryPlug", - "contracts/evmx/plugs/ContractFactoryPlug.sol", - [ - "0xaC61f5696e0E2636dA7bD69827380f2Ab41A3C38", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" - ] - ], - [ - "0x9EDfb162b725CF6d628D68af200cAe8b624111eD", - "SUSDC", - "contracts/evmx/plugs/SUSDC.sol", - [ - 18, - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "0xaC61f5696e0E2636dA7bD69827380f2Ab41A3C38", - "SUSDC", - "SUSDC" - ] - ], - [ - "0xee1Aef0b06f63Aa1c881838794Dd0876462c2B0d", - "FeesPlug", - "contracts/evmx/plugs/FeesPlug.sol", - [ - "0xaC61f5696e0E2636dA7bD69827380f2Ab41A3C38", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" - ] - ], - [ - "0x5F77550E3072c913A20B2fbdAb14026fe0E8B450", - "FastSwitchboard", - "contracts/protocol/switchboard/FastSwitchboard.sol", - [ - 999, - "0xaC61f5696e0E2636dA7bD69827380f2Ab41A3C38", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" - ] - ], - [ - "0xbDE0D2da12F703Ccd275d721214745BccDCAD124", - "SocketBatcher", - "contracts/protocol/SocketBatcher.sol", - [ - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "0xaC61f5696e0E2636dA7bD69827380f2Ab41A3C38" - ] - ], - [ - "0xaC61f5696e0E2636dA7bD69827380f2Ab41A3C38", - "Socket", - "contracts/protocol/Socket.sol", - [ - 999, - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "EVMX" - ] - ] - ], - "1329": [ - [ - "0xa33ACE59E4b0d9a45Cd4a3F0DBAB86D87BDd67e2", - "ContractFactoryPlug", - "contracts/evmx/plugs/ContractFactoryPlug.sol", - [ - "0xaC61f5696e0E2636dA7bD69827380f2Ab41A3C38", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" - ] - ], - [ - "0x9EDfb162b725CF6d628D68af200cAe8b624111eD", - "SUSDC", - "contracts/evmx/plugs/SUSDC.sol", - [ - 18, - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "0xaC61f5696e0E2636dA7bD69827380f2Ab41A3C38", - "SUSDC", - "SUSDC" - ] - ], - [ - "0xee1Aef0b06f63Aa1c881838794Dd0876462c2B0d", - "FeesPlug", - "contracts/evmx/plugs/FeesPlug.sol", - [ - "0xaC61f5696e0E2636dA7bD69827380f2Ab41A3C38", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" - ] - ], - [ - "0x5F77550E3072c913A20B2fbdAb14026fe0E8B450", - "FastSwitchboard", - "contracts/protocol/switchboard/FastSwitchboard.sol", - [ - 1329, - "0xaC61f5696e0E2636dA7bD69827380f2Ab41A3C38", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" - ] - ], - [ - "0xbDE0D2da12F703Ccd275d721214745BccDCAD124", - "SocketBatcher", - "contracts/protocol/SocketBatcher.sol", - [ - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "0xaC61f5696e0E2636dA7bD69827380f2Ab41A3C38" - ] - ], - [ - "0xaC61f5696e0E2636dA7bD69827380f2Ab41A3C38", - "Socket", - "contracts/protocol/Socket.sol", - [ - 1329, - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "EVMX" - ] - ] - ], - "5000": [ - [ - "0xcFb68baF734daA2b5df3eE18F1fb45c99230A2A5", - "ContractFactoryPlug", - "contracts/evmx/plugs/ContractFactoryPlug.sol", - [ - "0xd8afBbB32706E7544f075151D4666D5B0B1F22CA", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" - ] - ], - [ - "0x6C1d46856dc8e1Fe16B1A8d0caEc720F9A58A193", - "SUSDC", - "contracts/evmx/plugs/SUSDC.sol", - [ - 18, - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "0xd8afBbB32706E7544f075151D4666D5B0B1F22CA", - "SUSDC", - "SUSDC" - ] - ], - [ - "0x0D85b9835bD1E82baeFcdb12C4D171294c64Afd2", - "FeesPlug", - "contracts/evmx/plugs/FeesPlug.sol", - [ - "0xd8afBbB32706E7544f075151D4666D5B0B1F22CA", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" - ] - ], - [ - "0x72e8aba972EEe812d6a5C6Ab13197e884C7D8FA9", - "FastSwitchboard", - "contracts/protocol/switchboard/FastSwitchboard.sol", - [ - 5000, - "0xd8afBbB32706E7544f075151D4666D5B0B1F22CA", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" - ] - ], - [ - "0xb5763dC91FD626786E17b43E8808062a87b037aF", - "SocketBatcher", - "contracts/protocol/SocketBatcher.sol", - [ - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "0xd8afBbB32706E7544f075151D4666D5B0B1F22CA" - ] - ], - [ - "0xd8afBbB32706E7544f075151D4666D5B0B1F22CA", - "Socket", - "contracts/protocol/Socket.sol", - [ - 5000, - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "EVMX" - ] - ], - [ - "0xeAb2e310A53FD3Fb34C2944690a79DFB2e834F20", - "ContractFactoryPlug", - "contracts/evmx/plugs/ContractFactoryPlug.sol", - [ - "0xaC61f5696e0E2636dA7bD69827380f2Ab41A3C38", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" - ] - ], - [ - "0x9EDfb162b725CF6d628D68af200cAe8b624111eD", - "SUSDC", - "contracts/evmx/plugs/SUSDC.sol", - [ - 18, - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "0xaC61f5696e0E2636dA7bD69827380f2Ab41A3C38", - "SUSDC", - "SUSDC" - ] - ], - [ - "0xee1Aef0b06f63Aa1c881838794Dd0876462c2B0d", - "FeesPlug", - "contracts/evmx/plugs/FeesPlug.sol", - [ - "0xaC61f5696e0E2636dA7bD69827380f2Ab41A3C38", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" - ] - ], - [ - "0x5F77550E3072c913A20B2fbdAb14026fe0E8B450", - "FastSwitchboard", - "contracts/protocol/switchboard/FastSwitchboard.sol", - [ - 5000, - "0xaC61f5696e0E2636dA7bD69827380f2Ab41A3C38", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" - ] - ], - [ - "0xbDE0D2da12F703Ccd275d721214745BccDCAD124", - "SocketBatcher", - "contracts/protocol/SocketBatcher.sol", - [ - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "0xaC61f5696e0E2636dA7bD69827380f2Ab41A3C38" - ] - ], - [ - "0xaC61f5696e0E2636dA7bD69827380f2Ab41A3C38", - "Socket", - "contracts/protocol/Socket.sol", - [ - 5000, - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "EVMX" - ] - ] - ], - "8453": [], - "14323": [ - [ - "0x41882aff9F7575473e5B6E613B371d04bdCCC728", - "WritePrecompile", - "contracts/evmx/watcher/precompiles/WritePrecompile.sol", - [] - ], - [ - "0xdBDA5D873b120f1C5E0966BFA3C588dDBECc9072", - - "WritePrecompile", - "contracts/evmx/watcher/precompiles/WritePrecompile.sol", - [] - ], - [ - - "0x2Bc1E6d31B1eabe4a11286c08aa67eCA29A55cc3", - "WritePrecompile", - "contracts/evmx/watcher/precompiles/WritePrecompile.sol", - [] - ], - [ - "0x751085cA028D2BCfC58Cee2514DeF1ed72c843cd", - "RequestHandler", - "contracts/evmx/watcher/RequestHandler.sol", - "0x2996bD0DCB7C349340715472518E76342AC31b1a", - "Watcher", - "contracts/evmx/watcher/Watcher.sol", - [] - ], - [ - "0xEd2a3cd034D873096E40C7E2EfB0e5BE99bBbF7a", - "PromiseResolver", - "contracts/evmx/watcher/PromiseResolver.sol", - [ - "0xCeEc354B7784C667Bd661483Ae30C8d4eBA96e1d" - ] - ], - [ - "0x2ECF118De0d747980c5d934E78a5746B6b6fD441", - "Watcher", - "contracts/evmx/watcher/Watcher.sol", - [] - ], - [ - "0x751085cA028D2BCfC58Cee2514DeF1ed72c843cd", - "RequestHandler", - "contracts/evmx/watcher/RequestHandler.sol", - [] - ], - [ - "0x9b962E99fbc77aF1733CdE3bC65F1Cd621d4FDEF", - "WritePrecompile", - "contracts/evmx/watcher/precompiles/WritePrecompile.sol", - [] - ], - [ - "0x52fEa0aBEe0CC6CBf46099a9886Ed0C123241fDc", - "Watcher", - "contracts/evmx/watcher/Watcher.sol", - [] - ], - [ - "0x0f832af23F7fc3332396f73caAB2Fa44A6d3aFFC", - "Watcher", - "contracts/evmx/watcher/Watcher.sol", - [] - ] - ], - "43114": [ - [ - "0x302E258fe375A1da4d6B3F4Dd5208638A29bc409", - "ContractFactoryPlug", - "contracts/evmx/plugs/ContractFactoryPlug.sol", - [ - "0x5F77550E3072c913A20B2fbdAb14026fe0E8B450", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" - ] - ], - [ - "0x313397aE9B6c22AC0e00d039543AE425b1F1c039", - "SUSDC", - "contracts/evmx/plugs/SUSDC.sol", - [ - 18, - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "0x5F77550E3072c913A20B2fbdAb14026fe0E8B450", - "SUSDC", - "SUSDC" - ] - ], - [ - "0x3aac37DC85C522c09A3DDdA44D181E6aCCD2f9F0", - "FeesPlug", - "contracts/evmx/plugs/FeesPlug.sol", - [ - "0x5F77550E3072c913A20B2fbdAb14026fe0E8B450", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" - ] - ], - [ - "0xfE34ACE07836F7F05f485EAc7122D0CD58BAC047", - "MessageSwitchboard", - "contracts/protocol/switchboard/MessageSwitchboard.sol", - [ - 43114, - "0x5F77550E3072c913A20B2fbdAb14026fe0E8B450", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" - ] - ], - [ - "0xa33ACE59E4b0d9a45Cd4a3F0DBAB86D87BDd67e2", - "CCTPSwitchboard", - "contracts/protocol/switchboard/CCTPSwitchboard.sol", - [ - 43114, - "0x5F77550E3072c913A20B2fbdAb14026fe0E8B450", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "0x8186359aF5F57FbB40c6b14A588d2A59C0C29880" - ] - ], - [ - "0x9EDfb162b725CF6d628D68af200cAe8b624111eD", - "FastSwitchboard", - "contracts/protocol/switchboard/FastSwitchboard.sol", - [ - 43114, - "0x5F77550E3072c913A20B2fbdAb14026fe0E8B450", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" - ] - ], - [ - "0xee1Aef0b06f63Aa1c881838794Dd0876462c2B0d", - "SocketBatcher", - "contracts/protocol/SocketBatcher.sol", - [ - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "0x5F77550E3072c913A20B2fbdAb14026fe0E8B450" - ] - ], - [ - "0x5F77550E3072c913A20B2fbdAb14026fe0E8B450", - "Socket", - "contracts/protocol/Socket.sol", - [ - 43114, - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "EVMX" - ] - ], - [ - "0xaC61f5696e0E2636dA7bD69827380f2Ab41A3C38", - "SocketBatcher", - "contracts/protocol/SocketBatcher.sol", - [ - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "0x5e1641B190B71ECCc85b1ECe934F31cD9b3dcF7a" - ] - ], - [ - "0x5e1641B190B71ECCc85b1ECe934F31cD9b3dcF7a", - "Socket", - "contracts/protocol/Socket.sol", - [ - 43114, - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "EVMX" - ] - ] - ], - "57073": [ - [ - "0xa33ACE59E4b0d9a45Cd4a3F0DBAB86D87BDd67e2", - "ContractFactoryPlug", - "contracts/evmx/plugs/ContractFactoryPlug.sol", - [ - "0xaC61f5696e0E2636dA7bD69827380f2Ab41A3C38", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" - ] - ], - [ - "0x9EDfb162b725CF6d628D68af200cAe8b624111eD", - "SUSDC", - "contracts/evmx/plugs/SUSDC.sol", - [ - 18, - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "0xaC61f5696e0E2636dA7bD69827380f2Ab41A3C38", - "SUSDC", - "SUSDC" - ] - ], - [ - "0xee1Aef0b06f63Aa1c881838794Dd0876462c2B0d", - "FeesPlug", - "contracts/evmx/plugs/FeesPlug.sol", - [ - "0xaC61f5696e0E2636dA7bD69827380f2Ab41A3C38", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" - ] - ], - [ - "0x5F77550E3072c913A20B2fbdAb14026fe0E8B450", - "FastSwitchboard", - "contracts/protocol/switchboard/FastSwitchboard.sol", - [ - 57073, - "0xaC61f5696e0E2636dA7bD69827380f2Ab41A3C38", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" - ] - ], - [ - "0xbDE0D2da12F703Ccd275d721214745BccDCAD124", - "SocketBatcher", - "contracts/protocol/SocketBatcher.sol", - [ - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "0xaC61f5696e0E2636dA7bD69827380f2Ab41A3C38" - ] - ], - [ - "0xaC61f5696e0E2636dA7bD69827380f2Ab41A3C38", - "Socket", - "contracts/protocol/Socket.sol", - [ - 57073, - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "EVMX" - ] - ] - ], - "59144": [ - [ - "0xa33ACE59E4b0d9a45Cd4a3F0DBAB86D87BDd67e2", - "ContractFactoryPlug", - "contracts/evmx/plugs/ContractFactoryPlug.sol", - [ - "0x5e1641B190B71ECCc85b1ECe934F31cD9b3dcF7a", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" - ] - ], - [ - "0x9EDfb162b725CF6d628D68af200cAe8b624111eD", - "SUSDC", - "contracts/evmx/plugs/SUSDC.sol", - [ - 18, - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "0x5e1641B190B71ECCc85b1ECe934F31cD9b3dcF7a", - "SUSDC", - "SUSDC" - ] - ], - [ - "0xee1Aef0b06f63Aa1c881838794Dd0876462c2B0d", - "FeesPlug", - "contracts/evmx/plugs/FeesPlug.sol", - [ - "0x5e1641B190B71ECCc85b1ECe934F31cD9b3dcF7a", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" - ] - ], - [ - "0xbDE0D2da12F703Ccd275d721214745BccDCAD124", - "FastSwitchboard", - "contracts/protocol/switchboard/FastSwitchboard.sol", - [ - 59144, - "0x5e1641B190B71ECCc85b1ECe934F31cD9b3dcF7a", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" - ] - ], - [ - "0xaC61f5696e0E2636dA7bD69827380f2Ab41A3C38", - "SocketBatcher", - "contracts/protocol/SocketBatcher.sol", - [ - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "0x5e1641B190B71ECCc85b1ECe934F31cD9b3dcF7a" - ] - ], - [ - "0x5e1641B190B71ECCc85b1ECe934F31cD9b3dcF7a", - "Socket", - "contracts/protocol/Socket.sol", - [ - 59144, - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "EVMX" - ] - ] - ], - "80094": [ - [ - "0xa33ACE59E4b0d9a45Cd4a3F0DBAB86D87BDd67e2", - "ContractFactoryPlug", - "contracts/evmx/plugs/ContractFactoryPlug.sol", - [ - "0xaC61f5696e0E2636dA7bD69827380f2Ab41A3C38", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" - ] - ], - [ - "0x9EDfb162b725CF6d628D68af200cAe8b624111eD", - "SUSDC", - "contracts/evmx/plugs/SUSDC.sol", - [ - 18, - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "0xaC61f5696e0E2636dA7bD69827380f2Ab41A3C38", - "SUSDC", - "SUSDC" - ] - ], - [ - "0xee1Aef0b06f63Aa1c881838794Dd0876462c2B0d", - "FeesPlug", - "contracts/evmx/plugs/FeesPlug.sol", - [ - "0xaC61f5696e0E2636dA7bD69827380f2Ab41A3C38", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" - ] - ], - [ - "0x5F77550E3072c913A20B2fbdAb14026fe0E8B450", - "FastSwitchboard", - "contracts/protocol/switchboard/FastSwitchboard.sol", - [ - 80094, - "0xaC61f5696e0E2636dA7bD69827380f2Ab41A3C38", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" - ] - ], - [ - "0xbDE0D2da12F703Ccd275d721214745BccDCAD124", - "SocketBatcher", - "contracts/protocol/SocketBatcher.sol", - [ - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "0xaC61f5696e0E2636dA7bD69827380f2Ab41A3C38" - ] - ], - [ - "0xaC61f5696e0E2636dA7bD69827380f2Ab41A3C38", - "Socket", - "contracts/protocol/Socket.sol", - [ - 80094, - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "EVMX" - ] - ] - ], - "84532": [], + "14323": [], "421614": [], - "747474": [ - [ - "0xa33ACE59E4b0d9a45Cd4a3F0DBAB86D87BDd67e2", - "ContractFactoryPlug", - "contracts/evmx/plugs/ContractFactoryPlug.sol", - [ - "0x5e1641B190B71ECCc85b1ECe934F31cD9b3dcF7a", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" - ] - ], - [ - "0x9EDfb162b725CF6d628D68af200cAe8b624111eD", - "SUSDC", - "contracts/evmx/plugs/SUSDC.sol", - [ - 18, - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "0x5e1641B190B71ECCc85b1ECe934F31cD9b3dcF7a", - "SUSDC", - "SUSDC" - ] - ], - [ - "0xee1Aef0b06f63Aa1c881838794Dd0876462c2B0d", - "FeesPlug", - "contracts/evmx/plugs/FeesPlug.sol", - [ - "0x5e1641B190B71ECCc85b1ECe934F31cD9b3dcF7a", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" - ] - ], - [ - "0xbDE0D2da12F703Ccd275d721214745BccDCAD124", - "FastSwitchboard", - "contracts/protocol/switchboard/FastSwitchboard.sol", - [ - 747474, - "0x5e1641B190B71ECCc85b1ECe934F31cD9b3dcF7a", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" - ] - ], - [ - "0xaC61f5696e0E2636dA7bD69827380f2Ab41A3C38", - "SocketBatcher", - "contracts/protocol/SocketBatcher.sol", - [ - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "0x5e1641B190B71ECCc85b1ECe934F31cD9b3dcF7a" - ] - ], - [ - "0x5e1641B190B71ECCc85b1ECe934F31cD9b3dcF7a", - "Socket", - "contracts/protocol/Socket.sol", - [ - 747474, - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "EVMX" - ] - ] - ], "11155420": [] } diff --git a/deployments/prod_verification.json b/deployments/prod_verification.json index f95b60e8..4e012437 100644 --- a/deployments/prod_verification.json +++ b/deployments/prod_verification.json @@ -128,11 +128,7 @@ "0xb8Bd628646BFfE5632B462F213F97DE038dBD8b2", "Socket", "contracts/protocol/Socket.sol", - [ - 5000, - "0x7BD61c667f869FB21b77626f0Ac0ACEE51e4BE7C", - "EVMX" - ] + [5000, "0x7BD61c667f869FB21b77626f0Ac0ACEE51e4BE7C", "EVMX"] ] ], "8453": [], diff --git a/deployments/stage_addresses.json b/deployments/stage_addresses.json index 48240cc0..5ebd4993 100644 --- a/deployments/stage_addresses.json +++ b/deployments/stage_addresses.json @@ -1,106 +1,56 @@ { - "10": { - "ContractFactoryPlug": "0xC559BABEbcD92278E91a545308190E4761efc347", - "FastSwitchboard": "0xD78f99D62BeaF0918bB0601C68EB537b6703Ce63", - "FastSwitchboardId": "1", - "FeesPlug": "0xA557EBE094F939ae6eE8F18c8F88D06182168786", - "Socket": "0xA944BBe5D4F67a242C9e92d539fF2d55616283a7", - "SocketBatcher": "0x06234dB2D69Ac158793a3ce59c3764422028E964", - "startBlock": 141180188, - "SUSDC": "0x6D54668ba18B425a1DbFC0BD720145c0aeE97f65", - "SwitchboardIdToAddressMap": { - "1": "0xD78f99D62BeaF0918bB0601C68EB537b6703Ce63" - } - }, - "8453": { - "ContractFactoryPlug": "0x2e531e37FdccA3CFd427a593f53f326bd24b8142", - "FastSwitchboard": "0xd3009795fFDc64Ee0d23198772a58ca9e53EEd25", - "FastSwitchboardId": "1", - "FeesPlug": "0xFAF76924169cf58f239d02EC40a2a1eA9eaeb62E", - "Socket": "0x6EF9c18c1A69417625f4Cb3c634124a71025C3A9", - "SocketBatcher": "0x356DBc19C69832010f92c963a8Ded6b5f9deeaCe", - "startBlock": 35584928, - "SUSDC": "0x900Cf1914Adcee43Cb1A69c042ded801Cd5051Ef", - "SwitchboardIdToAddressMap": { - "1": "0xd3009795fFDc64Ee0d23198772a58ca9e53EEd25" - } - }, "14323": { - "AddressResolver": "0xE4C438c46b9dB51e298A1F65151eDe8418be009A", - "AddressResolverImpl": "0x241532190C8b549Ebb4CE7624454A47c1cC97171", - "AsyncDeployer": "0x08c2DFE559288e9fBfB440E68033BE9BB666142E", - "AsyncDeployerImpl": "0x148182E16aaf2Fd6137D0eb335c3f6c8266e0936", - "AuctionManager": "0xa6610D1bFb6F791eDaeBAdFc43e2415f16844929", - "AuctionManagerImpl": "0x4B8B34e439EBAB00116B1b4C642923b6A227AdCa", - "Configurations": "0x6c289e8b8A8Ac6965440Cd23f2Db8C810f2336F9", - "ConfigurationsImpl": "0x30240731147d217Bf228EC68104eb8664A377c33", - "DeployForwarder": "0x015BB35B075FACBED756C9403c4A6BAfF37328D7", - "DeployForwarderImpl": "0xD4DB3AB70EBA19586132686fBD4928809c3e42B4", - "ERC1967Factory": "0x945300e92aA450A9aEf1d9FBA7b7Aee45622a082", - "FeesManager": "0xB3a34AB69B538d48311656a4b5df56A1423C0075", - "FeesManagerImpl": "0xF31EF92126D4f20799dEb3b2F17Cc64B3272DEc8", - "FeesPool": "0xC8d803B7c1719cdF21392405879D1B56398045C4", - "PromiseResolver": "0xD5225A5BC7ef3eAc6eb5255776fF5F007C95D03E", - "ReadPrecompile": "0xD059D6D64B9dbAE2e56F70CBEc9Af03fd41DaE35", - "RequestHandler": "0xEd8f50ddf6ba832c699b019Ed62f86e511b72d53", - "RequestHandlerImpl": "0x4f4655Bf2aDf5Ce1b58205942c77C9549bafbEd7", - "SchedulePrecompile": "0x62Be6a0eabce7Efb1B9BB065e36b85C63B2101c6", - "startBlock": 50623, - "Watcher": "0xdd4B3431472573dB6dB988E8746a118005328589", - "WatcherImpl": "0x8BB97CaF2B6C94d4f3988cdBC2db6e9eeF12D857", - "WritePrecompile": "0xE786f01425718D52F7C0753FbDF743b56704D31f", - "WritePrecompileImpl": "0xD3E77f10D63031111599CB32C957CA703ec479b8" - }, - "42161": { - "ContractFactoryPlug": "0xae59BA0Bd0D92232B3B6304185448C9Fe5445f4d", - "FastSwitchboard": "0x7E33B305e12aD0E73B3aedBE67A53B7818732d7d", - "FastSwitchboardId": "1", - "FeesPlug": "0xfaf8a3f8f4221398F3eC765836e8BF4A3d975962", - "Socket": "0x693bcDb114a57302Cd687b8Af1bD7583ee56748C", - "SocketBatcher": "0x0d7994B4aAc7cbdFAFEAED0B9B51E7de0586ec6f", - "startBlock": 379484006, - "SUSDC": "0x0c17822dcC44F8202F176a4960EAC8da8FDbfCA5", - "SwitchboardIdToAddressMap": { - "1": "0x7E33B305e12aD0E73B3aedBE67A53B7818732d7d" - } - }, - "84532": { - "ContractFactoryPlug": "0x24A6Da9bAa5ba4AE8AF411546429b7eD2B29aA48", - "FastSwitchboard": "0x7442C13842dC293fce94Bf86116068F8FF62Ecf9", - "FastSwitchboardId": "1", - "FeesPlug": "0x5cdcD147A01Fc29C20c2061a89faF01F20363A20", - "Socket": "0x4861c9EB83d8ba745a184E5a11a50B6be25e4dDb", - "SocketBatcher": "0x5132751743cD59DB406A043d9983984E52Ca2cD5", - "startBlock": 31095773, - "SUSDC": "0x99D946bB805adba0233956E475bf70ED09d50d40", - "SwitchboardIdToAddressMap": { - "1": "0x7442C13842dC293fce94Bf86116068F8FF62Ecf9" - } + "AddressResolver": "0x914b7261d3256cDA3203769004b25cB956da8dE7", + "AddressResolverImpl": "0x6AEEf39D71534048e5A5700EE967c3941A96525A", + "AsyncDeployer": "0x40aEF36c4A2b548C03CAdDb409fac3FBAC81B200", + "AsyncDeployerImpl": "0x3b3C0e6980c0F812822C34af1846682D5a87152D", + "AuctionManager": "0x779BF2830549645484D04DDCb84aF019E0D021a2", + "AuctionManagerImpl": "0xbf41e76Ec6918EFF5E3d675A309cbEAC273D7e28", + "Configurations": "0x473732CC360f0958B9BBA18BD66051d8419Ef31c", + "ConfigurationsImpl": "0x9F09f4ccACE5E879E599e4382d00F7adc48f1534", + "DeployForwarder": "0x57e801B8c81c923C3DEDaDaDD48427ecaeF5b70F", + "DeployForwarderImpl": "0x1183261cA9561961e3FE3AD8C394345BDFb93d8c", + "ERC1967Factory": "0x1fF5eb3Eda6008dd18Ea2B7932c5d526200e7414", + "FeesManager": "0x17FfBAab211b98D8F658d41d8cD400448bC37D1b", + "FeesManagerImpl": "0xe65Bcf2fD2547b603318450aE424a9399A4aD785", + "FeesPool": "0x13A3018920c7b56B20dd34E29C298121025E6de4", + "ForwarderSolana": "0xCDB5fE8572725B20A2C0Db85DDb0D025bCC16f86", + "ForwarderSolanaImpl": "0x1c728354F3452aCc71cB253C21984b50D128f12c", + "PromiseResolver": "0x0eFf5a5b1C76857997D7937A6420AB51e5275EFA", + "ReadPrecompile": "0xb6B70632Bb6b181ce88FEeF18CE653742B53d73A", + "RequestHandler": "0x905650e8b3C659F7Da205B2fA29018928ec4AAf4", + "RequestHandlerImpl": "0x76e2958Cb33485b592FCe1A13fCbF8829bF484fe", + "SchedulePrecompile": "0x667837807c244041ED48C2984Fd8085d498c6a0a", + "startBlock": 57479, + "Watcher": "0xB5c99FDb167500fcb775E870d82B9aABbD15b0E0", + "WatcherImpl": "0x9DaD548bD14f4D7B0b1734C76D6E0534D93A3739", + "WritePrecompile": "0x7B02b1B26AC01689DaC11BD6928b6a1fc42601b4", + "WritePrecompileImpl": "0xb6Cc1B1bF616257eA7594E6A858f9a30ECf619C1" }, "421614": { - "ContractFactoryPlug": "0x5B6ed8Aaa52643d1d2d3409398e30b4eAdC767f2", - "FastSwitchboard": "0xE6be06b48c66BEbBa2114948a94cbE7eC7220a7e", + "ContractFactoryPlug": "0xA548678a3299b752A53eF359A491C423eBf030C7", + "FastSwitchboard": "0x4b267eD6Afa767911BB2a6f7d78a8B26BA933E85", "FastSwitchboardId": "1", - "FeesPlug": "0x946f1113f19CD1d20465e62D8F5480C49253EbA3", - "Socket": "0x7aA47Ed012c185127edA67f533D91f44391bfC7C", - "SocketBatcher": "0x163272Ec38a16193a22400799D242e381fecEB42", - "startBlock": 194622586, - "SUSDC": "0xb5DbadA4f0F84420F0803089cD52Ef39876A061d", + "FeesPlug": "0xFD2325fd63f3f19353A0F3ECE7F12f10952DEdfa", + "Socket": "0x07Cd4EA8649d29c5D09d0dE802bED4521b29c3eD", + "SocketBatcher": "0x38cFfF94ff9Cfd07A15019aFbCd10fBba4546189", + "startBlock": 201808160, + "SUSDC": "0xFBf91C7C358221c4dEe6FC8d5aF1383de276A93E", "SwitchboardIdToAddressMap": { - "1": "0xE6be06b48c66BEbBa2114948a94cbE7eC7220a7e" + "1": "0x4b267eD6Afa767911BB2a6f7d78a8B26BA933E85" } }, "11155420": { - "ContractFactoryPlug": "0xfC6E8e1aC27b5d61A03a64f383F51d3669F82165", - "FastSwitchboard": "0xbE5CB1cf4e049F124B868DebF15d9B04ce0817b3", + "ContractFactoryPlug": "0x6AF7fAfdb6eFFC084176cf8e1C840d3e946E2093", + "FastSwitchboard": "0xc4215781752F8F7c543f1e89cd52b140aF2d3e50", "FastSwitchboardId": "1", - "FeesPlug": "0xf0A01453C34759588e2Ebd42183F4FF122cc73ee", - "Socket": "0x26292db660fbeB0271E11aa4f1d2a2d0c57dc378", - "SocketBatcher": "0xaA02a6FdA809cF11c4e26a82AcfE7666204736A0", - "startBlock": 33078325, - "SUSDC": "0x3039AC5cC80C531c682045278f92439D740fa62B", + "FeesPlug": "0x5e1BfC8e646b4677D5323E16f925206d2869Beb2", + "Socket": "0xD24d86F573a9dfA2922cCA4A94Cfe77d5755bAfb", + "SocketBatcher": "0xd9e1Bb23D6dB53C0FBE01BC64525009A4F420125", + "startBlock": 33980115, + "SUSDC": "0x9113982c9f497d4561e601013c77e287be1e0dfe", "SwitchboardIdToAddressMap": { - "1": "0xbE5CB1cf4e049F124B868DebF15d9B04ce0817b3" + "1": "0xc4215781752F8F7c543f1e89cd52b140aF2d3e50" } } } diff --git a/deployments/stage_verification.json b/deployments/stage_verification.json index 757bd77d..d0c0f9ae 100644 --- a/deployments/stage_verification.json +++ b/deployments/stage_verification.json @@ -1,157 +1,86 @@ { - "10": [ - [ - "0xC559BABEbcD92278E91a545308190E4761efc347", - "ContractFactoryPlug", - "contracts/evmx/plugs/ContractFactoryPlug.sol", - [ - "0xA944BBe5D4F67a242C9e92d539fF2d55616283a7", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" - ] - ], - [ - "0x6D54668ba18B425a1DbFC0BD720145c0aeE97f65", - "SUSDC", - "contracts/evmx/plugs/SUSDC.sol", - [ - 18, - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "0xA944BBe5D4F67a242C9e92d539fF2d55616283a7", - "SUSDC", - "SUSDC" - ] - ], - [ - "0xA557EBE094F939ae6eE8F18c8F88D06182168786", - "FeesPlug", - "contracts/evmx/plugs/FeesPlug.sol", - [ - "0xA944BBe5D4F67a242C9e92d539fF2d55616283a7", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" - ] - ], - [ - "0xD78f99D62BeaF0918bB0601C68EB537b6703Ce63", - "FastSwitchboard", - "contracts/protocol/switchboard/FastSwitchboard.sol", - [ - 10, - "0xA944BBe5D4F67a242C9e92d539fF2d55616283a7", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" - ] - ], - [ - "0x06234dB2D69Ac158793a3ce59c3764422028E964", - "SocketBatcher", - "contracts/protocol/SocketBatcher.sol", - [ - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "0xA944BBe5D4F67a242C9e92d539fF2d55616283a7" - ] - ], - [ - "0xA944BBe5D4F67a242C9e92d539fF2d55616283a7", - "Socket", - "contracts/protocol/Socket.sol", - [ - 10, - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "EVMX" - ] - ] - ], "8453": [ [ - "0x2e531e37FdccA3CFd427a593f53f326bd24b8142", + "0x9d9A4941E1ECa8B330ef72aC0C8Dc8DF6E631122", "ContractFactoryPlug", "contracts/evmx/plugs/ContractFactoryPlug.sol", [ - "0x6EF9c18c1A69417625f4Cb3c634124a71025C3A9", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" + "0xe3e0DCE31a0612E2eb80294b717ae0dE1BF38Dc3", + "0x09ce244745923f250A1E53e95fEd51E9De01a129" ] ], [ - "0x900Cf1914Adcee43Cb1A69c042ded801Cd5051Ef", + "0x76fB8Bb47669eadDaDFB66A71603e542036d9D98", "SUSDC", "contracts/evmx/plugs/SUSDC.sol", [ 18, - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "0x6EF9c18c1A69417625f4Cb3c634124a71025C3A9", + "0x09ce244745923f250A1E53e95fEd51E9De01a129", + "0xe3e0DCE31a0612E2eb80294b717ae0dE1BF38Dc3", "SUSDC", "SUSDC" ] ], [ - "0xFAF76924169cf58f239d02EC40a2a1eA9eaeb62E", + "0x5FcC8e076C06Ac7e001EB291b5605E5c32D2064D", "FeesPlug", "contracts/evmx/plugs/FeesPlug.sol", [ - "0x6EF9c18c1A69417625f4Cb3c634124a71025C3A9", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" + "0xe3e0DCE31a0612E2eb80294b717ae0dE1BF38Dc3", + "0x09ce244745923f250A1E53e95fEd51E9De01a129" ] ], [ - "0xd3009795fFDc64Ee0d23198772a58ca9e53EEd25", + "0x19c81821ea6186953D3e80d93e92A8Cc6EE7D1A7", "FastSwitchboard", "contracts/protocol/switchboard/FastSwitchboard.sol", [ 8453, - "0x6EF9c18c1A69417625f4Cb3c634124a71025C3A9", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" + "0xe3e0DCE31a0612E2eb80294b717ae0dE1BF38Dc3", + "0x09ce244745923f250A1E53e95fEd51E9De01a129" ] ], [ - "0x356DBc19C69832010f92c963a8Ded6b5f9deeaCe", + "0x0918ab654044D51fBAa1B8F93c648a848D177B08", "SocketBatcher", "contracts/protocol/SocketBatcher.sol", [ - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "0x6EF9c18c1A69417625f4Cb3c634124a71025C3A9" + "0x09ce244745923f250A1E53e95fEd51E9De01a129", + "0xe3e0DCE31a0612E2eb80294b717ae0dE1BF38Dc3" ] ], [ - "0x6EF9c18c1A69417625f4Cb3c634124a71025C3A9", + "0xe3e0DCE31a0612E2eb80294b717ae0dE1BF38Dc3", "Socket", "contracts/protocol/Socket.sol", [ 8453, - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", + "0x09ce244745923f250A1E53e95fEd51E9De01a129", "EVMX" ] ] ], "14323": [ [ - "0x8BB97CaF2B6C94d4f3988cdBC2db6e9eeF12D857", - "Watcher", - "contracts/evmx/watcher/Watcher.sol", - [] - ], - [ - "0xD3E77f10D63031111599CB32C957CA703ec479b8", + "0xCC91EC2E15E5406b47627dA8B956035A6f9b6484", "WritePrecompile", "contracts/evmx/watcher/precompiles/WritePrecompile.sol", [] ], [ - "0x4f4655Bf2aDf5Ce1b58205942c77C9549bafbEd7", - "RequestHandler", - "contracts/evmx/watcher/RequestHandler.sol", - [] - ], - [ - "0xF31EF92126D4f20799dEb3b2F17Cc64B3272DEc8", - "FeesManager", - "contracts/evmx/fees/FeesManager.sol", - [] + "0x4f3322415BDF6c07107186d0015aEdCA9F4f1Ca9", + "FeesPool", + "contracts/evmx/fees/FeesPool.sol", + [ + "0x09ce244745923f250A1E53e95fEd51E9De01a129" + ] ], [ - "0x62Be6a0eabce7Efb1B9BB065e36b85C63B2101c6", + "0x97216489DB5C67669f6e0DD0D3cbBde7f3bF8F7d", "SchedulePrecompile", "contracts/evmx/watcher/precompiles/SchedulePrecompile.sol", [ - "0xdd4B3431472573dB6dB988E8746a118005328589", + "0xa7Aa670e034D3744D8a76219a8d83E3224c40606", 86400, { "type": "BigNumber", @@ -165,11 +94,11 @@ ] ], [ - "0xD059D6D64B9dbAE2e56F70CBEc9Af03fd41DaE35", + "0x8e21Ae55c4f6Daf454b15c4ce70Fb727Ab142a11", "ReadPrecompile", "contracts/evmx/watcher/precompiles/ReadPrecompile.sol", [ - "0xdd4B3431472573dB6dB988E8746a118005328589", + "0xa7Aa670e034D3744D8a76219a8d83E3224c40606", { "type": "BigNumber", "hex": "0xe8d4a51000" @@ -178,69 +107,75 @@ ] ], [ - "0x01aDAb65E88b931860E63928096B16dA717b0f99", + "0x3a3834b948579E95e12196205346a3792F9B2138", "WritePrecompile", "contracts/evmx/watcher/precompiles/WritePrecompile.sol", [] ], [ - "0xD5225A5BC7ef3eAc6eb5255776fF5F007C95D03E", + "0xF9Ab9fF05a160c2376A4dFD2b83d07B05971b657", "PromiseResolver", "contracts/evmx/watcher/PromiseResolver.sol", [ - "0xdd4B3431472573dB6dB988E8746a118005328589" + "0xa7Aa670e034D3744D8a76219a8d83E3224c40606" ] ], [ - "0x994DA55f4295B073f1D60B5074cc7f6cD7b11753", + "0x7D92D06029D8Ed5EB980FD8630afa99996D1B33f", "RequestHandler", "contracts/evmx/watcher/RequestHandler.sol", [] ], [ - "0x30240731147d217Bf228EC68104eb8664A377c33", + "0x0e5872d14021829DfF589E12A88dd966A6C66480", "Configurations", "contracts/evmx/watcher/Configurations.sol", [] ], [ - "0xD4DB3AB70EBA19586132686fBD4928809c3e42B4", + "0x79eaab68e56BfdEE248A18E27b27eA18673C53EA", "DeployForwarder", "contracts/evmx/helpers/DeployForwarder.sol", [] ], [ - "0x4B8B34e439EBAB00116B1b4C642923b6A227AdCa", + "0x595587d61775898f297362D48F613d3187058570", "AuctionManager", "contracts/evmx/AuctionManager.sol", [] ], [ - "0x529d72181F1FFDA70aD62737f348d4913D5826F6", + "0xa931Dfa8c0372ae767a8f3a9878Fc001D12863bA", "Watcher", "contracts/evmx/watcher/Watcher.sol", [] ], [ - "0x148182E16aaf2Fd6137D0eb335c3f6c8266e0936", + "0x4F78Ca6582565D000aB341f8a9927ff22FFe187C", "AsyncDeployer", "contracts/evmx/helpers/AsyncDeployer.sol", [] ], [ - "0xBe2153E78cc02F87a2652390Bd49481dBc1ccd2E", + "0x0962d6a5e98F0E8516E56F147653a91F3dA18346", "FeesManager", "contracts/evmx/fees/FeesManager.sol", [] ], [ - "0x241532190C8b549Ebb4CE7624454A47c1cC97171", + "0xa75db4a2c602d567b0414B6893cFfcD4C903a1dF", + "ForwarderSolana", + "contracts/evmx/helpers/ForwarderSolana.sol", + [] + ], + [ + "0x94cc6e9a5eB62047e8D93377bE94C96bbF365D20", "AddressResolver", "contracts/evmx/helpers/AddressResolver.sol", [] ], [ - "0x945300e92aA450A9aEf1d9FBA7b7Aee45622a082", + "0xAF8B8B501BBE5365770db879b325bA4F67da0607", "ERC1967Factory", "lib/solady/src/utils/ERC1967Factory.sol", [] @@ -248,244 +183,61 @@ ], "42161": [ [ - "0xae59BA0Bd0D92232B3B6304185448C9Fe5445f4d", + "0x9d9A4941E1ECa8B330ef72aC0C8Dc8DF6E631122", "ContractFactoryPlug", "contracts/evmx/plugs/ContractFactoryPlug.sol", [ - "0x693bcDb114a57302Cd687b8Af1bD7583ee56748C", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" + "0xe3e0DCE31a0612E2eb80294b717ae0dE1BF38Dc3", + "0x09ce244745923f250A1E53e95fEd51E9De01a129" ] ], [ - "0x0c17822dcC44F8202F176a4960EAC8da8FDbfCA5", + "0x76fB8Bb47669eadDaDFB66A71603e542036d9D98", "SUSDC", "contracts/evmx/plugs/SUSDC.sol", [ 18, - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "0x693bcDb114a57302Cd687b8Af1bD7583ee56748C", + "0x09ce244745923f250A1E53e95fEd51E9De01a129", + "0xe3e0DCE31a0612E2eb80294b717ae0dE1BF38Dc3", "SUSDC", "SUSDC" ] ], [ - "0xfaf8a3f8f4221398F3eC765836e8BF4A3d975962", + "0x5FcC8e076C06Ac7e001EB291b5605E5c32D2064D", "FeesPlug", "contracts/evmx/plugs/FeesPlug.sol", [ - "0x693bcDb114a57302Cd687b8Af1bD7583ee56748C", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" + "0xe3e0DCE31a0612E2eb80294b717ae0dE1BF38Dc3", + "0x09ce244745923f250A1E53e95fEd51E9De01a129" ] ], [ - "0x7E33B305e12aD0E73B3aedBE67A53B7818732d7d", + "0x19c81821ea6186953D3e80d93e92A8Cc6EE7D1A7", "FastSwitchboard", "contracts/protocol/switchboard/FastSwitchboard.sol", [ 42161, - "0x693bcDb114a57302Cd687b8Af1bD7583ee56748C", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" + "0xe3e0DCE31a0612E2eb80294b717ae0dE1BF38Dc3", + "0x09ce244745923f250A1E53e95fEd51E9De01a129" ] ], [ - "0x0d7994B4aAc7cbdFAFEAED0B9B51E7de0586ec6f", + "0x0918ab654044D51fBAa1B8F93c648a848D177B08", "SocketBatcher", "contracts/protocol/SocketBatcher.sol", [ - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "0x693bcDb114a57302Cd687b8Af1bD7583ee56748C" + "0x09ce244745923f250A1E53e95fEd51E9De01a129", + "0xe3e0DCE31a0612E2eb80294b717ae0dE1BF38Dc3" ] ], [ - "0x693bcDb114a57302Cd687b8Af1bD7583ee56748C", + "0xe3e0DCE31a0612E2eb80294b717ae0dE1BF38Dc3", "Socket", "contracts/protocol/Socket.sol", [ 42161, - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "EVMX" - ] - ] - ], - "84532": [ - [ - "0x99D946bB805adba0233956E475bf70ED09d50d40", - "SUSDC", - "contracts/evmx/plugs/SUSDC.sol", - [ - 18, - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "0x4861c9EB83d8ba745a184E5a11a50B6be25e4dDb", - "SUSDC", - "SUSDC" - ] - ], - [ - "0x5cdcD147A01Fc29C20c2061a89faF01F20363A20", - "FeesPlug", - "contracts/evmx/plugs/FeesPlug.sol", - [ - "0x4861c9EB83d8ba745a184E5a11a50B6be25e4dDb", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" - ] - ], - [ - "0x24A6Da9bAa5ba4AE8AF411546429b7eD2B29aA48", - "ContractFactoryPlug", - "contracts/evmx/plugs/ContractFactoryPlug.sol", - [ - "0x4861c9EB83d8ba745a184E5a11a50B6be25e4dDb", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" - ] - ], - [ - "0x7442C13842dC293fce94Bf86116068F8FF62Ecf9", - "FastSwitchboard", - "contracts/protocol/switchboard/FastSwitchboard.sol", - [ - 84532, - "0x4861c9EB83d8ba745a184E5a11a50B6be25e4dDb", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" - ] - ], - [ - "0x5132751743cD59DB406A043d9983984E52Ca2cD5", - "SocketBatcher", - "contracts/protocol/SocketBatcher.sol", - [ - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "0x4861c9EB83d8ba745a184E5a11a50B6be25e4dDb" - ] - ], - [ - "0x4861c9EB83d8ba745a184E5a11a50B6be25e4dDb", - "Socket", - "contracts/protocol/Socket.sol", - [ - 84532, - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "EVMX" - ] - ] - ], - "421614": [ - [ - "0xb5DbadA4f0F84420F0803089cD52Ef39876A061d", - "SUSDC", - "contracts/evmx/plugs/SUSDC.sol", - [ - 18, - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "0x7aA47Ed012c185127edA67f533D91f44391bfC7C", - "SUSDC", - "SUSDC" - ] - ], - [ - "0x946f1113f19CD1d20465e62D8F5480C49253EbA3", - "FeesPlug", - "contracts/evmx/plugs/FeesPlug.sol", - [ - "0x7aA47Ed012c185127edA67f533D91f44391bfC7C", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" - ] - ], - [ - "0x5B6ed8Aaa52643d1d2d3409398e30b4eAdC767f2", - "ContractFactoryPlug", - "contracts/evmx/plugs/ContractFactoryPlug.sol", - [ - "0x7aA47Ed012c185127edA67f533D91f44391bfC7C", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" - ] - ], - [ - "0xE6be06b48c66BEbBa2114948a94cbE7eC7220a7e", - "FastSwitchboard", - "contracts/protocol/switchboard/FastSwitchboard.sol", - [ - 421614, - "0x7aA47Ed012c185127edA67f533D91f44391bfC7C", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" - ] - ], - [ - "0x163272Ec38a16193a22400799D242e381fecEB42", - "SocketBatcher", - "contracts/protocol/SocketBatcher.sol", - [ - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "0x7aA47Ed012c185127edA67f533D91f44391bfC7C" - ] - ], - [ - "0x7aA47Ed012c185127edA67f533D91f44391bfC7C", - "Socket", - "contracts/protocol/Socket.sol", - [ - 421614, - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "EVMX" - ] - ] - ], - "11155420": [ - [ - "0x3039AC5cC80C531c682045278f92439D740fa62B", - "SUSDC", - "contracts/evmx/plugs/SUSDC.sol", - [ - 18, - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "0x26292db660fbeB0271E11aa4f1d2a2d0c57dc378", - "SUSDC", - "SUSDC" - ] - ], - [ - "0xf0A01453C34759588e2Ebd42183F4FF122cc73ee", - "FeesPlug", - "contracts/evmx/plugs/FeesPlug.sol", - [ - "0x26292db660fbeB0271E11aa4f1d2a2d0c57dc378", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" - ] - ], - [ - "0xfC6E8e1aC27b5d61A03a64f383F51d3669F82165", - "ContractFactoryPlug", - "contracts/evmx/plugs/ContractFactoryPlug.sol", - [ - "0x26292db660fbeB0271E11aa4f1d2a2d0c57dc378", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" - ] - ], - [ - "0xbE5CB1cf4e049F124B868DebF15d9B04ce0817b3", - "FastSwitchboard", - "contracts/protocol/switchboard/FastSwitchboard.sol", - [ - 11155420, - "0x26292db660fbeB0271E11aa4f1d2a2d0c57dc378", - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" - ] - ], - [ - "0xaA02a6FdA809cF11c4e26a82AcfE7666204736A0", - "SocketBatcher", - "contracts/protocol/SocketBatcher.sol", - [ - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "0x26292db660fbeB0271E11aa4f1d2a2d0c57dc378" - ] - ], - [ - "0x26292db660fbeB0271E11aa4f1d2a2d0c57dc378", - "Socket", - "contracts/protocol/Socket.sol", - [ - 11155420, - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", + "0x09ce244745923f250A1E53e95fEd51E9De01a129", "EVMX" ] ] diff --git a/foundry.toml b/foundry.toml index 9ac8bc70..d2712765 100644 --- a/foundry.toml +++ b/foundry.toml @@ -1,36 +1,45 @@ [profile.default] -solc_version = "0.8.22" +solc_version = "0.8.29" src = "contracts" out = "out" libs = ["lib"] ffi = true optimizer = true -optimizer_runs = 200 evm_version = 'paris' -via_ir = false +optimizer_runs = 1 +via_ir = true + +[profile.default.optimizer_details] +yul = true + +[profile.default.optimizer_details.yulDetails] +stackAllocation = true +optimizerSteps = "u" [labels] -0xcA99D298B5290558660b4D5C1019Be145FaB6020 = "AddressResolver" -0x39b5D3FBBa1BC28438e25955aaB412C7576eCd61 = "AddressResolverImpl" -0xd608e1345281dE0675e2Cc1E8D0B31aD167618Ad = "AsyncDeployer" -0x2F0E83Fcd03A191D280598c33d278AF8A7e9076a = "AsyncDeployerImpl" -0xED848E9e0CCA0868484353B529E04861Fd8F04Bd = "AuctionManager" -0x2752caa4060bC744216515c247C54Ae5bB873DF2 = "AuctionManagerImpl" -0xf50A9785aef5ADeA0659609e9FF1de8578aF0b4f = "Configurations" -0xa1780f9F81090737267ccd3A5663E058AfE73A49 = "ConfigurationsImpl" -0xffF606007317cb7a1CC4C701d62C38c7734dfb15 = "DeployForwarder" -0x69e3Dc5667f7413039fE3bFd335660A99DA869A9 = "DeployForwarderImpl" -0x4f1Cd0CdBc7EA445b8B34Af8844fA4D4B5f48b79 = "ERC1967Factory" -0xbCFf8224d89f0b4e9B14c4356720439111BAC2bC = "FeesManager" -0x5E0dF9484D5ACd94028459fA7E90F4c3280147CA = "FeesManagerImpl" -0x13A3018920c7b56B20dd34E29C298121025E6de4 = "FeesPool" -0xed318668898303141EA6B9c2a9F97D0622b0a530 = "PromiseResolver" -0x7C82C3d2aE1bFB4b1D294e5181bCd7489EF554d1 = "ReadPrecompile" -0xf053AB14323FF52e7e65D6Fb12f86896F0865a36 = "RequestHandler" -0x751085cA028D2BCfC58Cee2514DeF1ed72c843cd = "RequestHandlerImpl" -0x4660c5fF2762E688f8D0def828ad161AE4940F57 = "SchedulePrecompile" -0xCeEc354B7784C667Bd661483Ae30C8d4eBA96e1d = "Watcher" -0x2996bD0DCB7C349340715472518E76342AC31b1a = "WatcherImpl" -0x9a580f1A4AE6A37CCEe73261B796F85EFbE55B15 = "WritePrecompile" -0xd50ca68c3d0f8341CC19B7eFE7e564971ba52A1D = "WritePrecompileImpl" -0x075A9bD30ce5E0Bb08994774bD55Afcadd96950A = "APP_GATEWAY" +0xF7cBa32E0E2B05d05c043526954E609108e766eB = "AddressResolver" +0x94cc6e9a5eB62047e8D93377bE94C96bbF365D20 = "AddressResolverImpl" +0xdA074fF1e1D72a75ba0A1Ac72F3B9DE18bC0dcC4 = "AsyncDeployer" +0x4F78Ca6582565D000aB341f8a9927ff22FFe187C = "AsyncDeployerImpl" +0xf04212e1c45C5B825F4ab0B6aC9139D2289d9508 = "AuctionManager" +0x595587d61775898f297362D48F613d3187058570 = "AuctionManagerImpl" +0x2215ffDe62737DaD79622A20B2e394B9e98891dE = "Configurations" +0x0e5872d14021829DfF589E12A88dd966A6C66480 = "ConfigurationsImpl" +0xc620725D4A9d9dA501E78568AEbed9EE01b6d019 = "DeployForwarder" +0x79eaab68e56BfdEE248A18E27b27eA18673C53EA = "DeployForwarderImpl" +0xAF8B8B501BBE5365770db879b325bA4F67da0607 = "ERC1967Factory" +0xa2D849c9461461C0BCBD62377606BE6877d0290C = "FeesManager" +0x0962d6a5e98F0E8516E56F147653a91F3dA18346 = "FeesManagerImpl" +0x4f3322415BDF6c07107186d0015aEdCA9F4f1Ca9 = "FeesPool" +0x9B266CAf342e7497Ad4B2ef245885ea49B766468 = "ForwarderSolana" +0xa75db4a2c602d567b0414B6893cFfcD4C903a1dF = "ForwarderSolanaImpl" +0xF9Ab9fF05a160c2376A4dFD2b83d07B05971b657 = "PromiseResolver" +0x8e21Ae55c4f6Daf454b15c4ce70Fb727Ab142a11 = "ReadPrecompile" +0x97B57e5b5E9561dEEfe159192050b42689426728 = "RequestHandler" +0x7D92D06029D8Ed5EB980FD8630afa99996D1B33f = "RequestHandlerImpl" +0x97216489DB5C67669f6e0DD0D3cbBde7f3bF8F7d = "SchedulePrecompile" +0xa7Aa670e034D3744D8a76219a8d83E3224c40606 = "Watcher" +0xa931Dfa8c0372ae767a8f3a9878Fc001D12863bA = "WatcherImpl" +0xAc5a7D59bD4Dc35936c9A2eb64015523C9f6323f = "WritePrecompile" +0xCC91EC2E15E5406b47627dA8B956035A6f9b6484 = "WritePrecompileImpl" +0x038f98246E027dc623BD60045Db333cE6DF558Bc = "APP_GATEWAY" diff --git a/hardhat-scripts/config/config.ts b/hardhat-scripts/config/config.ts index f6eb1e45..82fe9731 100644 --- a/hardhat-scripts/config/config.ts +++ b/hardhat-scripts/config/config.ts @@ -25,82 +25,113 @@ interface ModeConfig { // Configuration for each deployment mode const MODE_CONFIGS: Record = { + // [DeploymentMode.LOCAL]: { + // chains: [ + // ChainSlug.ARBITRUM_SEPOLIA, + // ChainSlug.OPTIMISM_SEPOLIA, + // // ChainSlug.BASE_SEPOLIA, + // ], + // feesPlugChains: [], // Will use chains by default + // evmChainId: 14323, + // addresses: { + // watcher: "0xb62505feacC486e809392c65614Ce4d7b051923b", + // transmitter: "0x138e9840861C983DC0BB9b3e941FB7C0e9Ade320", + // socketOwner: "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", + // }, + // }, [DeploymentMode.LOCAL]: { chains: [ - ChainSlug.ARBITRUM_SEPOLIA, - ChainSlug.OPTIMISM_SEPOLIA, - // ChainSlug.BASE_SEPOLIA, - ], - feesPlugChains: [], // Will use chains by default - evmChainId: 7625382, - addresses: { - watcher: "0xb62505feacC486e809392c65614Ce4d7b051923b", - transmitter: "0x138e9840861C983DC0BB9b3e941FB7C0e9Ade320", - socketOwner: "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - }, - }, - [DeploymentMode.DEV]: { - chains: [ - // ChainSlug.ARBITRUM_SEPOLIA, - // ChainSlug.OPTIMISM_SEPOLIA, - // ChainSlug.BASE_SEPOLIA, - ChainSlug.BSC, + ChainSlug.ARBITRUM, ChainSlug.BASE, - ChainSlug.POLYGON_MAINNET, - ChainSlug.AVALANCHE, - ChainSlug.GNOSIS, - ChainSlug.LINEA, - ChainSlug.SONIC, - ChainSlug.KATANA, - ChainSlug.INK, - ChainSlug.HYPEREVM, - ChainSlug.BERA, - ChainSlug.UNICHAIN, - ChainSlug.SEI, - ChainSlug.MANTLE, - ChainSlug.CAMP, - ChainSlug.FLOW, - ChainSlug.MANTA_PACIFIC, - ChainSlug.MAINNET, - // ChainSlug.PLUME, ], - feesPlugChains: [], // Will use chains by default + feesPlugChains: [], evmChainId: 14323, addresses: { - watcher: "0xb62505feacC486e809392c65614Ce4d7b051923b", + // watcher: "0xb62505feacC486e809392c65614Ce4d7b051923b", + watcher: "0x09ce244745923f250A1E53e95fEd51E9De01a129", transmitter: "0x138e9840861C983DC0BB9b3e941FB7C0e9Ade320", - socketOwner: "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", + // socketOwner: "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", + socketOwner: "0x09ce244745923f250A1E53e95fEd51E9De01a129", }, }, - [DeploymentMode.STAGE]: { + [DeploymentMode.DEV]: { chains: [ - // ChainSlug.MAINNET, - ChainSlug.ARBITRUM, ChainSlug.ARBITRUM_SEPOLIA, - ChainSlug.OPTIMISM, ChainSlug.OPTIMISM_SEPOLIA, - ChainSlug.BASE, - ChainSlug.BASE_SEPOLIA, + // ChainSlug.BASE_SEPOLIA, // ChainSlug.BSC, + // ChainSlug.BASE, // ChainSlug.POLYGON_MAINNET, // ChainSlug.AVALANCHE, // ChainSlug.GNOSIS, // ChainSlug.LINEA, // ChainSlug.SONIC, // ChainSlug.KATANA, - // ChainSlug.CAMP, // ChainSlug.INK, // ChainSlug.HYPEREVM, // ChainSlug.BERA, // ChainSlug.UNICHAIN, // ChainSlug.SEI, // ChainSlug.MANTLE, + // ChainSlug.CAMP, // ChainSlug.FLOW, - // ChainSlug.RISE_TESTNET, + // ChainSlug.MANTA_PACIFIC, + // ChainSlug.MAINNET, + // ChainSlug.PLUME, ], feesPlugChains: [], // Will use chains by default - evmChainId: 14323, // dummy stage - // evmChainId: 12921, + evmChainId: 14323, + addresses: { + watcher: "0xb62505feacC486e809392c65614Ce4d7b051923b", + transmitter: "0x138e9840861C983DC0BB9b3e941FB7C0e9Ade320", + socketOwner: "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", + }, + }, + // [DeploymentMode.STAGE]: { + // chains: [ + // // ChainSlug.MAINNET, + // ChainSlug.ARBITRUM, + // // ChainSlug.ARBITRUM_SEPOLIA, + // // ChainSlug.OPTIMISM, + // // ChainSlug.OPTIMISM_SEPOLIA, + // ChainSlug.BASE, + // // ChainSlug.BASE_SEPOLIA, + // // ChainSlug.BSC, + // // ChainSlug.POLYGON_MAINNET, + // // ChainSlug.AVALANCHE, + // // ChainSlug.GNOSIS, + // // ChainSlug.LINEA, + // // ChainSlug.SONIC, + // // ChainSlug.KATANA, + // // ChainSlug.CAMP, + // // ChainSlug.INK, + // // ChainSlug.HYPEREVM, + // // ChainSlug.BERA, + // // ChainSlug.UNICHAIN, + // // ChainSlug.SEI, + // // ChainSlug.MANTLE, + // // ChainSlug.FLOW, + // // ChainSlug.RISE_TESTNET, + // ], + // feesPlugChains: [], // Will use chains by default + // evmChainId: 14323, // dummy stage + // // evmChainId: 12921, + // addresses: { + // // watcher: "0xb62505feacC486e809392c65614Ce4d7b051923b", + // watcher: "0x09ce244745923f250A1E53e95fEd51E9De01a129", + // transmitter: "0x138e9840861C983DC0BB9b3e941FB7C0e9Ade320", + // // socketOwner: "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", + // socketOwner: "0x09ce244745923f250A1E53e95fEd51E9De01a129", + // }, + // }, + [DeploymentMode.STAGE]: { + chains: [ + ChainSlug.ARBITRUM_SEPOLIA, + ChainSlug.OPTIMISM_SEPOLIA, + // ChainSlug.BASE_SEPOLIA, + ], + feesPlugChains: [], // Will use chains by default + evmChainId: 14323, addresses: { watcher: "0xb62505feacC486e809392c65614Ce4d7b051923b", transmitter: "0x138e9840861C983DC0BB9b3e941FB7C0e9Ade320", diff --git a/hardhat-scripts/constants/feeConstants.ts b/hardhat-scripts/constants/feeConstants.ts index b570ddc5..f6e80038 100644 --- a/hardhat-scripts/constants/feeConstants.ts +++ b/hardhat-scripts/constants/feeConstants.ts @@ -342,9 +342,9 @@ export const tokens: TokenMap = { }; export const feePools: { [key: string]: string } = { - [DeploymentMode.LOCAL]: "0x9De353dD1131aB4e502590D3a1832652FA316268", + [DeploymentMode.LOCAL]: "0x13A3018920c7b56B20dd34E29C298121025E6de4", [DeploymentMode.DEV]: "0x13A3018920c7b56B20dd34E29C298121025E6de4", - [DeploymentMode.STAGE]: "0xC8d803B7c1719cdF21392405879D1B56398045C4", + [DeploymentMode.STAGE]: "0x4f3322415BDF6c07107186d0015aEdCA9F4f1Ca9", [DeploymentMode.PROD]: "0x3B1f4ABA1667EeB992B623E7c6d119728cEd3b15", }; diff --git a/hardhat-scripts/deploy/1.deploy.ts b/hardhat-scripts/deploy/1.deploy.ts index db8fa465..4944aa1d 100644 --- a/hardhat-scripts/deploy/1.deploy.ts +++ b/hardhat-scripts/deploy/1.deploy.ts @@ -48,7 +48,7 @@ config(); let EVMxOwner: string; // cT9tVQf8NAwHk849ctDqeLhbN2B6JJi3LfR6GfuN751 - super-token test program id -export const mockForwarderSolanaOnChainAddress32Bytes = Buffer.from( +export const superTokenSolanaAddress32Bytes = Buffer.from( "0914e65e59622aeeefb7f007aef36df62d4c380895553b0643fcc4383c7c2448", "hex" ); @@ -126,7 +126,9 @@ const deployEVMxContracts = async () => { deployUtils.addresses[contractName] = proxyFactory.address; const feePool = getFeePool(); - if (feePool?.length == 0) { + console.log("XXX feePool:", feePool); + + if (feePool === undefined || feePool?.length == 0) { const feesPool = await getOrDeploy( Contracts.FeesPool, Contracts.FeesPool, @@ -152,6 +154,26 @@ const deployEVMxContracts = async () => { deployUtils.addresses[Contracts.AddressResolver] ); + let forwarderSolanaAddress = "0x0"; + try { + deployUtils = await deployContractWithProxy( + Contracts.ForwarderSolana, + `contracts/evmx/helpers/ForwarderSolana.sol`, + [ + ChainId.SOLANA_MAINNET, + superTokenSolanaAddress32Bytes, + addressResolver.address, + ], + proxyFactory, + deployUtils + ); + forwarderSolanaAddress = + deployUtils.addresses[Contracts.ForwarderSolana]; + console.log("ForwarderSolana Proxy:", forwarderSolanaAddress); + } catch (error) { + console.log("Error deploying ForwarderSolana:", error); + } + deployUtils = await deployContractWithProxy( Contracts.FeesManager, `contracts/evmx/fees/FeesManager.sol`, @@ -162,6 +184,7 @@ const deployEVMxContracts = async () => { EVMxOwner, FEE_MANAGER_WRITE_MAX_FEES, FAST_SWITCHBOARD_TYPE, + forwarderSolanaAddress, ], proxyFactory, deployUtils @@ -270,27 +293,6 @@ const deployEVMxContracts = async () => { deployUtils.addresses[Contracts.SchedulePrecompile] = schedulePrecompile.address; - try { - console.log("AddressResolver address:", addressResolver.address); - - deployUtils = await deployContractWithProxy( - Contracts.ForwarderSolana, - `contracts/evmx/helpers/ForwarderSolana.sol`, - [ - ChainId.SOLANA_DEVNET, - mockForwarderSolanaOnChainAddress32Bytes, - addressResolver.address, - ], - proxyFactory, - deployUtils - ); - const forwarderSolanaAddress = - deployUtils.addresses[Contracts.ForwarderSolana]; - console.log("ForwarderSolana Proxy:", forwarderSolanaAddress); - } catch (error) { - console.log("Error deploying ForwarderSolana:", error); - } - deployUtils.addresses.startBlock = (deployUtils.addresses.startBlock ? deployUtils.addresses.startBlock diff --git a/hardhat-scripts/deploy/3.configureChains.ts b/hardhat-scripts/deploy/3.configureChains.ts index 4cc22acd..3c1e7c71 100644 --- a/hardhat-scripts/deploy/3.configureChains.ts +++ b/hardhat-scripts/deploy/3.configureChains.ts @@ -11,6 +11,7 @@ import { mode, } from "../config"; import { + CCTP_SWITCHBOARD_TYPE, DeploymentAddresses, FAST_SWITCHBOARD_TYPE, getFeeTokens, @@ -24,6 +25,7 @@ import { getWatcherSigner, overrides, storeAddresses, + toBytes32Format, toBytes32FormatHexString, updateContractSettings, } from "../utils"; @@ -125,6 +127,27 @@ export const configureChains = async (addresses: DeploymentAddresses) => { await storeAddresses(deployUtils.addresses, chain, mode); } + + // set SUSDC Solana contract as valid plug for FeesManager (so that it can trigger mint() in FeesManager) + const susdcProgramId = process.env.SOLANA_SUSDC_PROGRAM_ID!; + console.log( + `Setting SUSDC Solana contract ${susdcProgramId} as valid plug for FeesManager: + ${addresses[EVMX_CHAIN_ID]?.[Contracts.FeesManager]!}` + ); + await setSUSDCToken( + ChainSlug.SOLANA_MAINNET, + addresses[EVMX_CHAIN_ID]?.[Contracts.FeesManager]!, + susdcProgramId + ); + const feesPlugSolanaProgramId = process.env.SOLANA_FEES_PLUG_PROGRAM_ID!; + console.log( + `Setting FeesPlug Solana contract ${feesPlugSolanaProgramId} as valid plug for FeesManager: + ${addresses[EVMX_CHAIN_ID]?.[Contracts.FeesManager]!}` + ); + await setFeesPlugSolana( + addresses[EVMX_CHAIN_ID]?.[Contracts.FeesManager]!, + feesPlugSolanaProgramId + ); }; export const setMaxMsgValueLimit = async (chain: number) => { @@ -168,16 +191,15 @@ async function setOnchainContracts( signer ); - // TODO: this was commented out if fee-deposit-hook but it is in old solana deployment scheme await updateContractSettings( EVMX_CHAIN_ID, Contracts.Configurations, "switchboards", [chain, CCTP_SWITCHBOARD_TYPE], - cctpSwitchboardId, + cctpSwitchboardId ?? "0", "setSwitchboard", - [chain, CCTP_SWITCHBOARD_TYPE, cctpSwitchboardId], + [chain, CCTP_SWITCHBOARD_TYPE, cctpSwitchboardId ?? "0"], signer ); console.log("XXX Setting solana switchboard"); @@ -185,20 +207,24 @@ async function setOnchainContracts( const solanaSwitchboard = process.env.SWITCHBOARD_SOLANA; if (!solanaSwitchboard) throw new Error("SWITCHBOARD_SOLANA is not set"); console.log( - "solanaSwitchboard as bytes32 reversed: ", + "solanaSwitchboard as bytes32: ", Buffer.from(toBytes32Format(solanaSwitchboard)).toString("hex") ); + // TODO: this ia a hardcode for solana switchboardId, it is one as it is a counter starting from 1 and we just have one solana switchboard + const solanaSwitchboardId = 1; + await updateContractSettings( EVMX_CHAIN_ID, Contracts.Configurations, "switchboards", - [ChainSlug.SOLANA_DEVNET, FAST_SWITCHBOARD_TYPE], + [ChainSlug.SOLANA_MAINNET, FAST_SWITCHBOARD_TYPE], solanaSwitchboard, "setSwitchboard", [ - ChainSlug.SOLANA_DEVNET, + ChainSlug.SOLANA_MAINNET, FAST_SWITCHBOARD_TYPE, - toBytes32Format(solanaSwitchboard), + // toBytes32Format(solanaSwitchboard), + solanaSwitchboardId, ], signer ); @@ -386,7 +412,9 @@ const registerSb = async ( ): Promise => { let switchboardId: string = "0"; try { - console.log("Registering switchboard"); + console.log( + `Registering switchboard: chain ${chain}, sbAddress ${sbAddress}, socket ${socket.address}` + ); // used fast switchboard here as all have same function signature const switchboard = ( await getInstance(Contracts.FastSwitchboard, sbAddress) @@ -471,7 +499,7 @@ export const setSUSDCToken = async ( ); contractInstance = await contractInstance.connect(getWatcherSigner()); - const susdcToken = contractInstance.susdcToken(); + const susdcToken = contractInstance.susdcContractId(); const forwarderAddress = await contractInstance.forwarderAddresses( susdcToken, chain @@ -500,7 +528,26 @@ export const setSUSDCToken = async ( chain, toBytes32FormatHexString(susdcAddress) ); - console.log(`Setting SUSDC token to ${susdcAddress}, txHash: ${tx.hash}`); + console.log( + `Setting SUSDC token to ${susdcAddress} on chain ${chain}, txHash: ${tx.hash}` + ); + await tx.wait(); +}; + +export const setFeesPlugSolana = async ( + feesManagerAddress: string, + feesPlugSolanaProgramId: string +) => { + let contractInstance = await getInstance( + Contracts.FeesManager, + feesManagerAddress + ); + contractInstance = await contractInstance.connect(getWatcherSigner()); + + const tx = await contractInstance.setFeesPlugSolana(toBytes32FormatHexString(feesPlugSolanaProgramId)); + console.log( + `Setting FeesPlug Solana program id to ${feesPlugSolanaProgramId}, txHash: ${tx.hash}` + ); await tx.wait(); }; diff --git a/hardhat-scripts/deploy/6.connect.ts b/hardhat-scripts/deploy/6.connect.ts index af8db267..9e07484d 100644 --- a/hardhat-scripts/deploy/6.connect.ts +++ b/hardhat-scripts/deploy/6.connect.ts @@ -1,4 +1,4 @@ -import { Wallet } from "ethers"; +import { ethers, Wallet } from "ethers"; import { ChainAddressesObj, ChainSlug, Contracts } from "../../src"; import { chains, CONCURRENCY_LIMIT, EVMX_CHAIN_ID, mode } from "../config"; import { AppGatewayConfig, DeploymentAddresses } from "../constants"; @@ -14,7 +14,8 @@ import { import { getWatcherSigner, sendWatcherMultiCallWithNonce } from "../utils/sign"; import { isConfigSetOnEVMx, isConfigSetOnSocket } from "../utils"; import pLimit from "p-limit"; -import { mockForwarderSolanaOnChainAddress32Bytes } from "./1.deploy"; +import { superTokenSolanaAddress32Bytes } from "./1.deploy"; +import dotenv from "dotenv"; const plugs = [ Contracts.ContractFactoryPlug, @@ -22,6 +23,8 @@ const plugs = [ Contracts.SUSDC, ]; +dotenv.config(); + // Main function to connect plugs on all chains export const main = async () => { try { @@ -177,33 +180,23 @@ export const updateConfigEVMx = async () => { //--- const appGatewayAddress = process.env.APP_GATEWAY; if (!appGatewayAddress) throw new Error("APP_GATEWAY is not set"); - const solanaSwitchboard = process.env.SWITCHBOARD_SOLANA!.slice(2); // remove 0x prefix for Buffer from conversion - if (!solanaSwitchboard) throw new Error("SWITCHBOARD_SOLANA is not set"); - - const solanaSwitchboardBytes32 = Buffer.from(solanaSwitchboard, "hex"); const solanaAppGatewayId = ethers.utils.hexZeroPad(appGatewayAddress, 32); - console.log("SolanaAppGatewayId: ", solanaAppGatewayId); - console.log( - "SolanaSwitchboardBytes32: ", - solanaSwitchboardBytes32.toString("hex") - ); + + // On Solana there is just one switchboard, and Id indexing starts from 1 + const solanaSwitchboardId = 1; appConfigs.push({ plugConfig: { appGatewayId: solanaAppGatewayId, - switchboard: "0x" + solanaSwitchboardBytes32.toString("hex"), + switchboardId: solanaSwitchboardId.toString(), }, - plug: "0x" + mockForwarderSolanaOnChainAddress32Bytes.toString("hex"), - chainSlug: ChainSlug.SOLANA_DEVNET, + plug: "0x" + superTokenSolanaAddress32Bytes.toString("hex"), + chainSlug: ChainSlug.SOLANA_MAINNET, }); - // appConfigs.push({ - // plug: "0x" + mockForwarderSolanaOnChainAddress32Bytes.toString("hex"), - // appGatewayId: solanaAppGatewayId, - // switchboard: "0x" + solanaSwitchboardBytes32.toString("hex"), - // chainSlug: ChainSlug.SOLANA_DEVNET, - // }); - //--- + + // TODO: This is only for game testing purposes + ifAllowedAddSolanaGamePlugs(appConfigs, solanaSwitchboardId); // Update configs if any changes needed if (appConfigs.length > 0) { @@ -224,6 +217,75 @@ export const updateConfigEVMx = async () => { } }; +function ifAllowedAddSolanaGamePlugs( + appConfigs: AppGatewayConfig[], + solanaSwitchboardId: number +) { + const addresses = getAddresses(mode) as unknown as DeploymentAddresses; + const EVMxAddresses = addresses[EVMX_CHAIN_ID]!; + const shouldRegisterSolanGamePlugs = + process.env.IS_GAME_PLUG_REGISTRATION_ALLOWED === "true"; + + if (shouldRegisterSolanGamePlugs) { + const userVaultGameGatewayId = ethers.utils.hexZeroPad( + process.env.USER_VAULT_GATEWAY_SOLANA!, + 32 + ); + const vaultPlugSolanaAddress = process.env.VAULT_PLUG_SOLANA!; + appConfigs.push({ + plugConfig: { + appGatewayId: userVaultGameGatewayId, + switchboardId: solanaSwitchboardId.toString(), + }, + plug: vaultPlugSolanaAddress, + chainSlug: ChainSlug.SOLANA_MAINNET, + }); + + const gameGameGatewayId = ethers.utils.hexZeroPad( + process.env.GAME_GATEWAY_SOLANA!, + 32 + ); + const gamePlugSolanaAddress = process.env.GAME_PLUG_SOLANA!; + appConfigs.push({ + plugConfig: { + appGatewayId: gameGameGatewayId, + switchboardId: solanaSwitchboardId.toString(), + }, + plug: gamePlugSolanaAddress, + chainSlug: ChainSlug.SOLANA_MAINNET, + }); + + const feesManagerId = ethers.utils.hexZeroPad( + EVMxAddresses[Contracts.FeesManager], + 32 + ); + const feesPlugSolanaAddress = process.env.SOLANA_FEES_PLUG_PROGRAM_ID!; + appConfigs.push({ + plugConfig: { + appGatewayId: feesManagerId, + switchboardId: solanaSwitchboardId.toString(), + }, + plug: feesPlugSolanaAddress, + chainSlug: ChainSlug.SOLANA_MAINNET, + }); + console.log("XXX FeesManagerId: ", feesManagerId); + console.log("XXX FeesManager: ", EVMxAddresses[Contracts.FeesManager]); + console.log("XXX feesPlugSolanaAddress: ", feesPlugSolanaAddress); + + // set SUSDC Solana contract as plug for FeesManager so that FeeManager can use forwarder to call mint() on SUSDC Solana contract + const susdcSolanaAddress = process.env.SOLANA_SUSDC_PROGRAM_ID!; + appConfigs.push({ + plugConfig: { + appGatewayId: feesManagerId, + switchboardId: solanaSwitchboardId.toString(), + }, + plug: susdcSolanaAddress, + chainSlug: ChainSlug.SOLANA_MAINNET, + }); + console.log("XXX susdcSolanaAddress: ", susdcSolanaAddress); + } +} + main() .then(() => process.exit(0)) .catch((error: Error) => { diff --git a/hardhat-scripts/deploy/8.setupEnv.ts b/hardhat-scripts/deploy/8.setupEnv.ts index a348422e..c7c1fe1d 100644 --- a/hardhat-scripts/deploy/8.setupEnv.ts +++ b/hardhat-scripts/deploy/8.setupEnv.ts @@ -22,9 +22,10 @@ const lines = envContent.split("\n"); // Get the latest addresses const latestAddresses = getAddresses(mode); const latestEVMxAddresses = latestAddresses[EVMX_CHAIN_ID] as EVMxAddressesObj; -const arbSepoliaAddresses = latestAddresses[ - ChainSlug.ARBITRUM_SEPOLIA -] as ChainAddressesObj; +// const arbSepoliaAddresses = latestAddresses[ +// ChainSlug.ARBITRUM_SEPOLIA +// ] as ChainAddressesObj; +const arbAddresses = latestAddresses[ChainSlug.ARBITRUM] as ChainAddressesObj; // Create a new array to hold the updated lines const updatedLines = lines.map((line) => { if (line.startsWith("ADDRESS_RESOLVER=")) { @@ -36,13 +37,16 @@ const updatedLines = lines.map((line) => { } else if (line.startsWith("FEES_MANAGER=")) { return `FEES_MANAGER=${latestEVMxAddresses[Contracts.FeesManager]}`; } else if (line.startsWith("ARBITRUM_SOCKET=")) { - return `ARBITRUM_SOCKET=${arbSepoliaAddresses[Contracts.Socket]}`; + // return `ARBITRUM_SOCKET=${arbSepoliaAddresses[Contracts.Socket]}`; + return `ARBITRUM_SOCKET=${arbAddresses[Contracts.Socket]}`; } else if (line.startsWith("ARBITRUM_SWITCHBOARD=")) { return `ARBITRUM_SWITCHBOARD=${ - arbSepoliaAddresses[Contracts.FastSwitchboard] + // arbSepoliaAddresses[Contracts.FastSwitchboard] + arbAddresses[Contracts.FastSwitchboard] }`; } else if (line.startsWith("ARBITRUM_FEES_PLUG=")) { - const feesPlug = arbSepoliaAddresses[Contracts.FeesPlug]; + // const feesPlug = arbSepoliaAddresses[Contracts.FeesPlug]; + const feesPlug = arbAddresses[Contracts.FeesPlug]; if (feesPlug) { return `ARBITRUM_FEES_PLUG=${feesPlug}`; } else { diff --git a/hardhat-scripts/deploy/9.setupTransmitter.ts b/hardhat-scripts/deploy/9.setupTransmitter.ts index 4bbe3431..c0a75b48 100644 --- a/hardhat-scripts/deploy/9.setupTransmitter.ts +++ b/hardhat-scripts/deploy/9.setupTransmitter.ts @@ -23,6 +23,8 @@ export const main = async () => { await checkAndDepositCredits(transmitterAddress); await checkAndDepositNative(transmitterAddress); await approveAuctionManager(); + console.log("feesManagerContract.address: ", feesManagerContract.address); + await checkAndDepositCredits(feesManagerContract.address); console.log("Transmitter setup complete!"); }; diff --git a/hardhat-scripts/deploy/WhitelistFeesReceiver.ts b/hardhat-scripts/deploy/WhitelistFeesReceiver.ts index 1d7e3aed..9eac7fe3 100644 --- a/hardhat-scripts/deploy/WhitelistFeesReceiver.ts +++ b/hardhat-scripts/deploy/WhitelistFeesReceiver.ts @@ -7,7 +7,8 @@ import { EVMX_CHAIN_ID, mode } from "../config"; import { DeploymentAddresses } from "../constants"; import { getAddresses, getInstance, getWatcherSigner } from "../utils"; -const ADDRESS_TO_WHITELIST = "0xbC4D50311708FFAFC1A26882fdab17cBfE55CBB9"; +// This must run each time we deploy new AG with Socket protocol (tmp change just for game testing) +const ADDRESS_TO_WHITELIST = "0x45d810BA4071429278958bBbd3AA68bFCDA37b00"; export const main = async () => { let addresses: DeploymentAddresses; diff --git a/hardhat-scripts/test/chainTest.ts b/hardhat-scripts/test/chainTest.ts index a243c257..2fefb392 100644 --- a/hardhat-scripts/test/chainTest.ts +++ b/hardhat-scripts/test/chainTest.ts @@ -7,22 +7,24 @@ import { ChainSlug, chainSlugToHardhatChainName } from "../../src"; // Chain IDs to test const TEST_CHAINS = [ + ChainSlug.ARBITRUM_SEPOLIA, + ChainSlug.OPTIMISM_SEPOLIA, // ChainSlug.ARBITRUM, // ChainSlug.AVALANCHE, - ChainSlug.BASE, + // ChainSlug.BASE, // ChainSlug.BERA, // ChainSlug.BSC, - ChainSlug.CAMP, - ChainSlug.MAINNET, - ChainSlug.FLOW, - ChainSlug.HYPEREVM, - ChainSlug.INK, + // ChainSlug.CAMP, + // ChainSlug.MAINNET, + // ChainSlug.FLOW, + // ChainSlug.HYPEREVM, + // ChainSlug.INK, // ChainSlug.KATANA, - ChainSlug.MANTA_PACIFIC, - ChainSlug.MANTLE, - ChainSlug.OPTIMISM, - ChainSlug.POLYGON_MAINNET, - ChainSlug.SEI, + // ChainSlug.MANTA_PACIFIC, + // ChainSlug.MANTLE, + // ChainSlug.OPTIMISM, + // ChainSlug.POLYGON_MAINNET, + // ChainSlug.SEI, // ChainSlug.SONIC, // ChainSlug.UNICHAIN ]; diff --git a/hardhat-scripts/utils/deployUtils.ts b/hardhat-scripts/utils/deployUtils.ts index f96cc872..ec50427a 100644 --- a/hardhat-scripts/utils/deployUtils.ts +++ b/hardhat-scripts/utils/deployUtils.ts @@ -113,12 +113,15 @@ export const verify = async ( await run("verify:verify", { address, contract: `${path}:${contractName}`, - constructorArguments: args + constructorArguments: args, }); return true; } catch (error) { console.log("Error during verification", error.toString()); - if (error.toString().includes("Contract source code already verified") || error.toString().includes("already verified")) + if ( + error.toString().includes("Contract source code already verified") || + error.toString().includes("already verified") + ) return true; } @@ -136,13 +139,15 @@ export const getChainSlug = async (): Promise => { if (network.config.chainId !== undefined) { return Number(network.config.chainId); } - + // If network config doesn't have chainId, try to get it from the provider try { const provider = network.provider; - if (provider && 'url' in network.config && network.config.url) { + if (provider && "url" in network.config && network.config.url) { // Try to get chain ID using ethers provider - const ethersProvider = new ethers.providers.JsonRpcProvider(network.config.url); + const ethersProvider = new ethers.providers.JsonRpcProvider( + network.config.url + ); const networkDetails = await ethersProvider.getNetwork(); if (networkDetails && networkDetails.chainId) { return Number(networkDetails.chainId); @@ -151,7 +156,7 @@ export const getChainSlug = async (): Promise => { } catch (error) { console.warn("Could not get chain ID from provider:", error); } - + throw new Error("chain id not found in network config or provider"); }; diff --git a/hardhat-scripts/utils/overrides.ts b/hardhat-scripts/utils/overrides.ts index dc4c17d2..59734640 100644 --- a/hardhat-scripts/utils/overrides.ts +++ b/hardhat-scripts/utils/overrides.ts @@ -53,7 +53,7 @@ export const chainOverrides: { // gasPrice: 212_000_000_000, }, [ChainSlug.BASE]: { - gasLimit: 2_000_000, + gasLimit: 5_000_000, }, [ChainSlug.BERA]: { gasPrice: parseUnits("3", "gwei"), diff --git a/hardhat-scripts/verify/verify.ts b/hardhat-scripts/verify/verify.ts index 211a69d8..e228e8ac 100644 --- a/hardhat-scripts/verify/verify.ts +++ b/hardhat-scripts/verify/verify.ts @@ -84,18 +84,24 @@ export const verifyChain = async ( return; } console.log("Changing network to", chainName); - + try { hre.changeNetwork(chainName); // Wait a bit for network change to complete - await new Promise(resolve => setTimeout(resolve, 1000)); - + await new Promise((resolve) => setTimeout(resolve, 1000)); + // Verify the network change was successful try { - if ('url' in hre.network.config && hre.network.config.url) { - const ethersProvider = new ethers.providers.JsonRpcProvider(hre.network.config.url); - const currentChainId = await ethersProvider.getNetwork().then(n => n.chainId); - console.log(`Successfully changed to network ${chainName} with chain ID ${currentChainId}`); + if ("url" in hre.network.config && hre.network.config.url) { + const ethersProvider = new ethers.providers.JsonRpcProvider( + hre.network.config.url + ); + const currentChainId = await ethersProvider + .getNetwork() + .then((n) => n.chainId); + console.log( + `Successfully changed to network ${chainName} with chain ID ${currentChainId}` + ); } else { console.log(`Successfully changed to network ${chainName}`); } diff --git a/hardhat.config.ts b/hardhat.config.ts index 516882f1..42f3af21 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -71,7 +71,7 @@ let liveNetworks = { [HardhatChainName.GNOSIS]: getChainConfig(ChainSlug.GNOSIS), [HardhatChainName.POLYGON_MAINNET]: getChainConfig(ChainSlug.POLYGON_MAINNET), [HardhatChainName.MAINNET]: getChainConfig(ChainSlug.MAINNET), - [HardhatChainName.HYPEREVM]: getChainConfig(ChainSlug.HYPEREVM), + [HardhatChainName.HYPEREVM]: getChainConfig(ChainSlug.HYPEREVM), [HardhatChainName.FLOW]: getChainConfig(ChainSlug.FLOW), [HardhatChainName.MANTA_PACIFIC]: getChainConfig(ChainSlug.MANTA_PACIFIC), [HardhatChainName.MANTLE]: getChainConfig(ChainSlug.MANTLE), @@ -127,10 +127,14 @@ const config: HardhatUserConfig = { zkSync: process.env.ETHERSCAN_API_KEY || "", scroll: process.env.ETHERSCAN_API_KEY || "", // Blockscout-based explorers - mantle: process.env.BLOCKSCOUT_API_KEY || process.env.ETHERSCAN_API_KEY || "", - camp: process.env.BLOCKSCOUT_API_KEY || process.env.ETHERSCAN_API_KEY || "", - flow: process.env.BLOCKSCOUT_API_KEY || process.env.ETHERSCAN_API_KEY || "", - manta_pacific: process.env.BLOCKSCOUT_API_KEY || process.env.ETHERSCAN_API_KEY || "", + mantle: + process.env.BLOCKSCOUT_API_KEY || process.env.ETHERSCAN_API_KEY || "", + camp: + process.env.BLOCKSCOUT_API_KEY || process.env.ETHERSCAN_API_KEY || "", + flow: + process.env.BLOCKSCOUT_API_KEY || process.env.ETHERSCAN_API_KEY || "", + manta_pacific: + process.env.BLOCKSCOUT_API_KEY || process.env.ETHERSCAN_API_KEY || "", // Other custom explorers sonic: process.env.ETHERSCAN_API_KEY || "", @@ -152,7 +156,7 @@ const config: HardhatUserConfig = { }, customChains: [ { - network:HardhatChainName.BSC, + network: HardhatChainName.BSC, chainId: ChainSlugToId[ChainSlug.BSC], urls: { apiURL: "https://api.etherscan.io/v2/api?chainid=56", @@ -160,7 +164,7 @@ const config: HardhatUserConfig = { }, }, { - network:HardhatChainName.MANTLE, + network: HardhatChainName.MANTLE, chainId: ChainSlugToId[ChainSlug.MANTLE], urls: { apiURL: "https://api.etherscan.io/v2/api?chainid=5000", @@ -168,7 +172,7 @@ const config: HardhatUserConfig = { }, }, { - network:HardhatChainName.UNICHAIN, + network: HardhatChainName.UNICHAIN, chainId: ChainSlugToId[ChainSlug.UNICHAIN], urls: { apiURL: "https://api.etherscan.io/v2/api?chainid=130", @@ -176,52 +180,52 @@ const config: HardhatUserConfig = { }, }, { - network:HardhatChainName.SONIC, + network: HardhatChainName.SONIC, chainId: ChainId.SONIC, urls: { apiURL: "https://api.etherscan.io/v2/api?chainid=146", - browserURL: "https://sonicscan.org" - } + browserURL: "https://sonicscan.org", + }, }, { - network:HardhatChainName.BERA, + network: HardhatChainName.BERA, chainId: ChainId.BERA, urls: { apiURL: "https://api.etherscan.io/v2/api?chainid=80094", - browserURL: "https://berascan.com/" - } + browserURL: "https://berascan.com/", + }, }, { - network:HardhatChainName.KATANA, + network: HardhatChainName.KATANA, chainId: ChainId.KATANA, urls: { apiURL: "https://api.etherscan.io/v2/api?chainid=747474", - browserURL: "https://katanascan.com/" - } + browserURL: "https://katanascan.com/", + }, }, { - network:HardhatChainName.INK, + network: HardhatChainName.INK, chainId: ChainId.INK, urls: { apiURL: "https://explorer.inkonchain.com/api", - browserURL: "https://explorer.inkonchain.com/" - } + browserURL: "https://explorer.inkonchain.com/", + }, }, { network: "hyperevm", chainId: ChainId.HYPEREVM, urls: { apiURL: "https://api.etherscan.io/v2/api?chainid=999", - browserURL: "https://hyperevmscan.io/" - } + browserURL: "https://hyperevmscan.io/", + }, }, { - network:HardhatChainName.SEI, + network: HardhatChainName.SEI, chainId: ChainId.SEI, urls: { apiURL: "https://api.etherscan.io/v2/api?chainid=1329", - browserURL: "https://seiscan.io/" - } + browserURL: "https://seiscan.io/", + }, }, { network: "EVMX", @@ -236,8 +240,8 @@ const config: HardhatUserConfig = { chainId: ChainId.CAMP, urls: { apiURL: "https://camp.cloud.blockscout.com/api", - browserURL: "https://camp.cloud.blockscout.com/" - } + browserURL: "https://camp.cloud.blockscout.com/", + }, }, { network: HardhatChainName.MANTA_PACIFIC, @@ -245,19 +249,16 @@ const config: HardhatUserConfig = { urls: { apiURL: "https://pacific-explorer.manta.network/api", browserURL: "https://pacific-explorer.manta.network/", - } + }, }, { network: HardhatChainName.FLOW, chainId: ChainId.FLOW, urls: { apiURL: "https://evm.flowscan.io/api", - browserURL: "https://evm.flowscan.io/" - } + browserURL: "https://evm.flowscan.io/", + }, }, - - - ], }, // This fully resolves paths for imports in the ./lib directory for Hardhat diff --git a/lib/forge-std b/lib/forge-std index 1eea5bae..f9062359 160000 --- a/lib/forge-std +++ b/lib/forge-std @@ -1 +1 @@ -Subproject commit 1eea5bae12ae557d589f9f0f0edae2faa47cb262 +Subproject commit f90623596aecbf678c41d4d45ca81ce0e43c8219 diff --git a/lib/solady b/lib/solady index 6c2d0da6..836c169f 160000 --- a/lib/solady +++ b/lib/solady @@ -1 +1 @@ -Subproject commit 6c2d0da6397e3c016aabc3f298de1b92c6ce7405 +Subproject commit 836c169fe357b3c23ad5d5755a9b4fbbfad7a99b diff --git a/package.json b/package.json index 6732c0a5..373571d8 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "publishConfig": { "access": "public" }, - "version": "1.1.48", + "version": "1.1.50", "description": "socket protocol", "scripts": { "build": "yarn abi && tsc --project lib.tsconfig.json", @@ -32,7 +32,7 @@ "@aws-sdk/client-s3": "^3.670.0", "@nomicfoundation/hardhat-verify": "^2.0.14", "@nomiclabs/hardhat-ethers": "2.2.3", - "@socket.tech/socket-protocol-common": "1.1.44", + "@socket.tech/socket-protocol-common": "1.1.46", "@typechain/ethers-v5": "^10.0.0", "@typechain/hardhat": "6.0.0", "@types/node": "^22.13.9", diff --git a/script/helpers/DepositCredit.s.sol b/script/helpers/DepositCredit.s.sol index 49e94fe0..2e238600 100644 --- a/script/helpers/DepositCredit.s.sol +++ b/script/helpers/DepositCredit.s.sol @@ -10,17 +10,20 @@ import {TestUSDC} from "../../contracts/evmx/mocks/TestUSDC.sol"; contract DepositCredit is Script { function run() external { uint256 feesAmount = 2000000; // 2 USDC - vm.createSelectFork(vm.envString("ARBITRUM_SEPOLIA_RPC")); + vm.createSelectFork(vm.envString("BASE_SEPOLIA_RPC")); uint256 privateKey = vm.envUint("PRIVATE_KEY"); vm.startBroadcast(privateKey); - FeesPlug feesPlug = FeesPlug(payable(vm.envAddress("ARBITRUM_FEES_PLUG"))); + FeesPlug feesPlug = FeesPlug(payable(vm.envAddress("BASE_FEES_PLUG"))); address appGateway = vm.envAddress("APP_GATEWAY"); - TestUSDC testUSDCContract = TestUSDC(vm.envAddress("ARBITRUM_TEST_USDC")); + console.log("appGateway", appGateway); + TestUSDC testUSDCContract = TestUSDC(vm.envAddress("BASE_TEST_USDC")); + console.log("testUSDCContract.mint"); // mint test USDC to sender testUSDCContract.mint(vm.addr(privateKey), feesAmount); // approve fees plug to spend test USDC + console.log("testUSDCContract.approve"); testUSDCContract.approve(address(feesPlug), feesAmount); address sender = vm.addr(privateKey); diff --git a/script/super-token-solana/EvmSolanaOnchainCalls.s.sol b/script/super-token-solana/EvmSolanaOnchainCalls.s.sol index 6bc06955..242ef345 100644 --- a/script/super-token-solana/EvmSolanaOnchainCalls.s.sol +++ b/script/super-token-solana/EvmSolanaOnchainCalls.s.sol @@ -3,22 +3,9 @@ pragma solidity ^0.8.21; import {Script} from "forge-std/Script.sol"; import {console} from "forge-std/console.sol"; -import { - ETH_ADDRESS, - TOKEN_ACCOUNT, - MINT_ACCOUNT, - CHAIN_SLUG_SOLANA_DEVNET -} from "../../contracts/utils/common/Constants.sol"; +import {ETH_ADDRESS, TOKEN_ACCOUNT, MINT_ACCOUNT, CHAIN_SLUG_SOLANA_MAINNET} from "../../contracts/utils/common/Constants.sol"; import {EvmSolanaAppGateway} from "../../test/apps/app-gateways/super-token/EvmSolanaAppGateway.sol"; -import { - SolanaInstruction, - SolanaInstructionData, - SolanaInstructionDataDescription, - SolanaReadRequest, - SolanaReadSchemaType, - GenericSchema -} from "../../contracts/utils/common/Structs.sol"; - +import {SolanaInstruction, SolanaInstructionData, SolanaInstructionDataDescription, SolanaReadRequest, SolanaReadSchemaType, GenericSchema} from "../../contracts/utils/common/Structs.sol"; // source .env && forge script script/counter/EvmSolanaOnchainCalls.s.sol --broadcast --skip-simulation --legacy --gas-price 0 contract EvmSolanaOnchainCalls is Script { @@ -43,10 +30,10 @@ contract EvmSolanaOnchainCalls is Script { // TODO:GW: fix this so that we can directly use the plug address (changes needed in socket/super-token) // plug signer pda : aprk6EUeRofYzyABHXLKG8hqJ3GHGV7Uhzbu612UMBD bytes32 solana_plug_signer = 0x08aa478d7031ac31e2a406e25f1e4dbd00bce5cbd428b7bf5e5b01abfd4b7da8; - // appGateway.setIsValidPlug(CHAIN_SLUG_SOLANA_DEVNET, solanaTargetProgramId); - appGateway.setIsValidPlugForSolana(true, CHAIN_SLUG_SOLANA_DEVNET, solana_plug_signer); + // appGateway.setIsValidPlug(CHAIN_SLUG_SOLANA_MAINNET, solanaTargetProgramId); + appGateway.setIsValidPlugForSolana(true, CHAIN_SLUG_SOLANA_MAINNET, solana_plug_signer); // allow super-token to trigger AppGateway - // appGateway.setIsValidPlug(CHAIN_SLUG_SOLANA_DEVNET, solana_plug_signer); + // appGateway.setIsValidPlug(CHAIN_SLUG_SOLANA_MAINNET, solana_plug_signer); uint256 srcAmount = 1000000; // mintOnEvm(srcAmount, userEvmAddress, appGateway); @@ -149,7 +136,10 @@ contract EvmSolanaOnchainCalls is Script { bytes32 accountToRead = 0x04feb6778939c89983aac734e237dc22f49d7b4418d378a516df15a255d084cb; bytes32 schemaNameHash = TOKEN_ACCOUNT; - SolanaReadRequest memory readRequest = buildSolanaReadRequestPredefined(accountToRead, schemaNameHash); + SolanaReadRequest memory readRequest = buildSolanaReadRequestPredefined( + accountToRead, + schemaNameHash + ); appGateway.readTokenAccount(readRequest); } @@ -159,27 +149,23 @@ contract EvmSolanaOnchainCalls is Script { // superTokenConfigPda : GfNcT3X72r8Cmy2itGCNPUrigsoPvTLH4vy3qaYkSqHx bytes32 accountToRead = 0xe8b3cf7c50f0b707dba43ef8042a34802d4f1768c72798bafa24d741c89f9ccf; - + // TODO:GW: All types recognizable by BorshEncoder must be placed in the constants to avoid hardcoding and confusion with lower/upper case string[] memory valuesTypeNames = new string[](5); - valuesTypeNames[0] = "[u8;8]"; // account discriminator - valuesTypeNames[1] = "[u8;32]"; // owner - valuesTypeNames[2] = "[u8;32]"; // socket - valuesTypeNames[3] = "[u8;32]"; // mint - valuesTypeNames[4] = "u8"; // bump - - GenericSchema memory genericSchema = GenericSchema({ - valuesTypeNames: valuesTypeNames - }); + valuesTypeNames[0] = "[u8;8]"; // account discriminator + valuesTypeNames[1] = "[u8;32]"; // owner + valuesTypeNames[2] = "[u8;32]"; // socket + valuesTypeNames[3] = "[u8;32]"; // mint + valuesTypeNames[4] = "u8"; // bump + + GenericSchema memory genericSchema = GenericSchema({valuesTypeNames: valuesTypeNames}); SolanaReadRequest memory readRequest = buildSolanaReadRequestGeneric(accountToRead); appGateway.readSuperTokenConfigAccount(readRequest, genericSchema); } - function invokeTrigger( - EvmSolanaAppGateway appGateway - ) public { + function invokeTrigger(EvmSolanaAppGateway appGateway) public { console.log("Invoke on Solana"); SolanaInstruction memory solanaInstruction = buildTriggerTestSolanaInstruction(); @@ -196,7 +182,6 @@ contract EvmSolanaOnchainCalls is Script { // May be subject to change bytes32[] memory accounts = new bytes32[](6); - // -- start here we are missing tmp_data account // accounts 0 - tmpData pda : EgDiv7JoLPY6CJgfkFKjxsDB6cxC7k9sdS9Baehp1c6L accounts[0] = 0xcb33f7992e094d6c65e0e95cf54e70c3470840e69d739dfcfcf2e1805fc913d1; // accounts 1 - superTokenConfigPda : GfNcT3X72r8Cmy2itGCNPUrigsoPvTLH4vy3qaYkSqHx @@ -227,7 +212,7 @@ contract EvmSolanaOnchainCalls is Script { // mint instruction discriminator bytes8 instructionDiscriminator = 0x3339e12fb69289a6; - bytes[] memory functionArguments = new bytes[](1); + bytes[] memory functionArguments = new bytes[](1); // TODO:GW: in watcher and transmitter we might need to convert this value if on Solana mint has different decimals, for now we assume that both are the same functionArguments[0] = abi.encode(order.srcAmount); @@ -256,13 +241,13 @@ contract EvmSolanaOnchainCalls is Script { bytes32[] memory accounts = new bytes32[](4); // accounts 0 - plug signer pda : aprk6EUeRofYzyABHXLKG8hqJ3GHGV7Uhzbu612UMBD accounts[0] = 0x08aa478d7031ac31e2a406e25f1e4dbd00bce5cbd428b7bf5e5b01abfd4b7da8; - // accounts 1 - trigger counter pda : 4EYucSHVdCt5BK9N95peyVCi7weQTBoW5Tf3a2nQbRbf + // accounts 1 - trigger counter pda : 4EYucSHVdCt5BK9N95peyVCi7weQTBoW5Tf3a2nQbRbf accounts[1] = 0x300bb0522a1ad67d5c5d8fe3102e0ac9b05f04436d4831609d158067b5bd4cda; // accounts 2 - socket programId: 9vFEQ5e3xf4eo17WttfqmXmnqN3gUicrhFGppmmNwyqV accounts[2] = 0x84815e8ca2f6dad7e12902c39a51bc72e13c48139b4fb10025d94e7abea2969c; // accounts 3 - system programId: 11111111111111111111111111111111 accounts[3] = 0x0000000000000000000000000000000000000000000000000000000000000000; - + bytes1[] memory accountFlags = new bytes1[](4); // plug signer is not writable accountFlags[0] = bytes1(0x00); // false @@ -295,7 +280,10 @@ contract EvmSolanaOnchainCalls is Script { }); } - function buildSolanaReadRequestPredefined(bytes32 accountToRead, bytes32 schemaNameHash) internal pure returns (SolanaReadRequest memory) { + function buildSolanaReadRequestPredefined( + bytes32 accountToRead, + bytes32 schemaNameHash + ) internal pure returns (SolanaReadRequest memory) { SolanaReadRequest memory readRequest = SolanaReadRequest({ schemaType: SolanaReadSchemaType.PREDEFINED, accountToRead: accountToRead, @@ -304,7 +292,9 @@ contract EvmSolanaOnchainCalls is Script { return readRequest; } - function buildSolanaReadRequestGeneric(bytes32 accountToRead) internal pure returns (SolanaReadRequest memory) { + function buildSolanaReadRequestGeneric( + bytes32 accountToRead + ) internal pure returns (SolanaReadRequest memory) { SolanaReadRequest memory readRequest = SolanaReadRequest({ schemaType: SolanaReadSchemaType.GENERIC, accountToRead: accountToRead, @@ -313,7 +303,6 @@ contract EvmSolanaOnchainCalls is Script { return readRequest; } - /*************** experimental / testing ***************/ function buildSolanaInstructionTest( @@ -349,8 +338,9 @@ contract EvmSolanaOnchainCalls is Script { string[] memory functionArgumentTypeNames = new string[](3); functionArgumentTypeNames[0] = "u64"; functionArgumentTypeNames[1] = "[u64;100]"; - functionArgumentTypeNames[2] = - '{"ComplexTestStruct": {"name": "string","addr": "[u8;32]","isActive": "boolean","value": "u64"}}'; + functionArgumentTypeNames[ + 2 + ] = '{"ComplexTestStruct": {"name": "string","addr": "[u8;32]","isActive": "boolean","value": "u64"}}'; bytes1[] memory accountFlags = new bytes1[](5); // superTokenConfigPda is not writable diff --git a/setupInfraContracts.sh b/setupInfraContracts.sh index 9ccfe59b..102a4762 100644 --- a/setupInfraContracts.sh +++ b/setupInfraContracts.sh @@ -4,8 +4,8 @@ else time npx hardhat run hardhat-scripts/deploy/1.deploy.ts fi time npx hardhat run hardhat-scripts/deploy/2.roles.ts --no-compile -time npx hardhat run hardhat-scripts/deploy/3.configureChains.ts --no-compile time npx hardhat run hardhat-scripts/deploy/4.configureEVMx.ts --no-compile +time npx hardhat run hardhat-scripts/deploy/3.configureChains.ts --no-compile time npx hardhat run hardhat-scripts/deploy/5.fundTransfers.ts --no-compile time npx hardhat run hardhat-scripts/deploy/6.connect.ts --no-compile time npx ts-node hardhat-scripts/deploy/7.upload.ts @@ -18,4 +18,5 @@ time npx ts-node hardhat-scripts/misc-scripts/createLabels.ts yarn lint time npx hardhat run hardhat-scripts/verify/verify.ts --no-compile -time npx hardhat run hardhat-scripts/deploy/deployTestUSDC.ts --no-compile +# only needed in special cases now setting some stuff for Manta Pacific chain +#time npx hardhat run hardhat-scripts/deploy/deployTestUSDC.ts --no-compile \ No newline at end of file diff --git a/src/enums.ts b/src/enums.ts index 1cb5a746..cdee8128 100644 --- a/src/enums.ts +++ b/src/enums.ts @@ -78,6 +78,7 @@ export enum Contracts { DeployForwarder = "DeployForwarder", Forwarder = "Forwarder", ForwarderSolana = "ForwarderSolana", + ForwarderSolanaImpl = "ForwarderSolanaImpl", } export enum CallTypeNames { diff --git a/test/BorshDecoderTest.t.sol b/test/BorshDecoderTest.t.sol index 3b7e01ad..255f5c06 100644 --- a/test/BorshDecoderTest.t.sol +++ b/test/BorshDecoderTest.t.sol @@ -11,7 +11,6 @@ import "forge-std/console.sol"; contract BorshDecoderTest is Test { using BorshDecoder for BorshDecoder.Data; - function testPredefinedSchemaHash() public pure { console.log("TOKEN_ACCOUNT"); console.logBytes32(TOKEN_ACCOUNT); @@ -24,70 +23,70 @@ contract BorshDecoderTest is Test { function testDecodeU8() public pure { uint8 originalValue = 42; bytes1 encoded = BorshEncoder.encodeU8(originalValue); - + BorshDecoder.Data memory data = BorshDecoder.from(abi.encodePacked(encoded)); uint8 decoded = data.decodeU8(); - + assertEq(decoded, originalValue); } function testDecodeU16() public pure { uint16 originalValue = 0x1234; bytes2 encoded = BorshEncoder.encodeU16(originalValue); - + BorshDecoder.Data memory data = BorshDecoder.from(abi.encodePacked(encoded)); uint16 decoded = data.decodeU16(); - + assertEq(decoded, originalValue); } function testDecodeU32() public pure { uint32 originalValue = 0x12345678; bytes4 encoded = BorshEncoder.encodeU32(originalValue); - + BorshDecoder.Data memory data = BorshDecoder.from(abi.encodePacked(encoded)); uint32 decoded = data.decodeU32(); - + assertEq(decoded, originalValue); } function testDecodeU64() public pure { uint64 originalValue = 0x123456789abcdef0; bytes8 encoded = BorshEncoder.encodeU64(originalValue); - + BorshDecoder.Data memory data = BorshDecoder.from(abi.encodePacked(encoded)); uint64 decoded = data.decodeU64(); - + assertEq(decoded, originalValue); } function testDecodeU128() public pure { uint128 originalValue = 0x123456789abcdef0fedcba9876543210; bytes16 encoded = BorshEncoder.encodeU128(originalValue); - + BorshDecoder.Data memory data = BorshDecoder.from(abi.encodePacked(encoded)); uint128 decoded = data.decodeU128(); - + assertEq(decoded, originalValue); } function testDecodeString() public pure { string memory originalValue = "hello world"; bytes memory encoded = BorshEncoder.encodeString(originalValue); - + BorshDecoder.Data memory data = BorshDecoder.from(encoded); string memory decoded = data.decodeString(); - + assertEq(decoded, originalValue); } function testDecodeStringEmpty() public pure { string memory originalValue = ""; bytes memory encoded = BorshEncoder.encodeString(originalValue); - + BorshDecoder.Data memory data = BorshDecoder.from(encoded); string memory decoded = data.decodeString(); - + assertEq(decoded, originalValue); } @@ -97,10 +96,10 @@ contract BorshDecoderTest is Test { console.log("encoded 0.1.0"); console.logBytes(encoded); - + BorshDecoder.Data memory data = BorshDecoder.from(encoded); string memory decoded = data.decodeString(); - + assertEq(decoded, originalValue); } @@ -111,11 +110,11 @@ contract BorshDecoderTest is Test { originalValues[0] = 1; originalValues[1] = 2; originalValues[2] = 3; - + bytes memory encoded = BorshEncoder.encodeUint8Vec(originalValues); BorshDecoder.Data memory data = BorshDecoder.from(encoded); (uint32 length, uint8[] memory decoded) = data.decodeUint8Vec(); - + assertEq(length, originalValues.length); assertEq(decoded.length, originalValues.length); for (uint256 i = 0; i < decoded.length; i++) { @@ -125,11 +124,11 @@ contract BorshDecoderTest is Test { function testDecodeUint8VecEmpty() public pure { uint8[] memory originalValues = new uint8[](0); - + bytes memory encoded = BorshEncoder.encodeUint8Vec(originalValues); BorshDecoder.Data memory data = BorshDecoder.from(encoded); (uint32 length, uint8[] memory decoded) = data.decodeUint8Vec(); - + assertEq(length, 0); assertEq(decoded.length, 0); } @@ -139,11 +138,11 @@ contract BorshDecoderTest is Test { for (uint256 i = 0; i < 255; i++) { originalValues[i] = uint8(i); } - + bytes memory encoded = BorshEncoder.encodeUint8Vec(originalValues); BorshDecoder.Data memory data = BorshDecoder.from(encoded); (uint32 length, uint8[] memory decoded) = data.decodeUint8Vec(); - + assertEq(length, originalValues.length); assertEq(decoded.length, originalValues.length); for (uint256 i = 0; i < decoded.length; i++) { @@ -156,11 +155,11 @@ contract BorshDecoderTest is Test { originalValues[0] = 1; originalValues[1] = 2; originalValues[2] = 3; - + bytes memory encoded = BorshEncoder.encodeUint16Vec(originalValues); BorshDecoder.Data memory data = BorshDecoder.from(encoded); (uint32 length, uint16[] memory decoded) = data.decodeUint16Vec(); - + assertEq(length, originalValues.length); assertEq(decoded.length, originalValues.length); for (uint256 i = 0; i < decoded.length; i++) { @@ -173,11 +172,11 @@ contract BorshDecoderTest is Test { originalValues[0] = 1; originalValues[1] = 2; originalValues[2] = 3; - + bytes memory encoded = BorshEncoder.encodeUint32Vec(originalValues); BorshDecoder.Data memory data = BorshDecoder.from(encoded); (uint32 length, uint32[] memory decoded) = data.decodeUint32Vec(); - + assertEq(length, originalValues.length); assertEq(decoded.length, originalValues.length); for (uint256 i = 0; i < decoded.length; i++) { @@ -190,11 +189,11 @@ contract BorshDecoderTest is Test { originalValues[0] = 1; originalValues[1] = 2; originalValues[2] = 3; - + bytes memory encoded = BorshEncoder.encodeUint64Vec(originalValues); BorshDecoder.Data memory data = BorshDecoder.from(encoded); (uint32 length, uint64[] memory decoded) = data.decodeUint64Vec(); - + assertEq(length, originalValues.length); assertEq(decoded.length, originalValues.length); for (uint256 i = 0; i < decoded.length; i++) { @@ -207,11 +206,11 @@ contract BorshDecoderTest is Test { originalValues[0] = 1; originalValues[1] = 2; originalValues[2] = 3; - + bytes memory encoded = BorshEncoder.encodeUint128Vec(originalValues); BorshDecoder.Data memory data = BorshDecoder.from(encoded); (uint32 length, uint128[] memory decoded) = data.decodeUint128Vec(); - + assertEq(length, originalValues.length); assertEq(decoded.length, originalValues.length); for (uint256 i = 0; i < decoded.length; i++) { @@ -224,11 +223,11 @@ contract BorshDecoderTest is Test { originalValues[0] = "hello"; originalValues[1] = "world"; originalValues[2] = "test"; - + bytes memory encoded = BorshEncoder.encodeStringVec(originalValues); BorshDecoder.Data memory data = BorshDecoder.from(encoded); (uint32 length, string[] memory decoded) = data.decodeStringVec(); - + assertEq(length, originalValues.length); assertEq(decoded.length, originalValues.length); for (uint256 i = 0; i < decoded.length; i++) { @@ -238,11 +237,11 @@ contract BorshDecoderTest is Test { function testDecodeStringVecEmpty() public pure { string[] memory originalValues = new string[](0); - + bytes memory encoded = BorshEncoder.encodeStringVec(originalValues); BorshDecoder.Data memory data = BorshDecoder.from(encoded); (uint32 length, string[] memory decoded) = data.decodeStringVec(); - + assertEq(length, 0); assertEq(decoded.length, 0); } @@ -252,11 +251,11 @@ contract BorshDecoderTest is Test { originalValues[0] = ""; originalValues[1] = "hello"; originalValues[2] = ""; - + bytes memory encoded = BorshEncoder.encodeStringVec(originalValues); BorshDecoder.Data memory data = BorshDecoder.from(encoded); (uint32 length, string[] memory decoded) = data.decodeStringVec(); - + assertEq(length, originalValues.length); assertEq(decoded.length, originalValues.length); for (uint256 i = 0; i < decoded.length; i++) { @@ -271,11 +270,11 @@ contract BorshDecoderTest is Test { originalValues[0] = 1; originalValues[1] = 2; originalValues[2] = 3; - + bytes memory encoded = BorshEncoder.encodeUint8Array(originalValues); BorshDecoder.Data memory data = BorshDecoder.from(encoded); uint8[] memory decoded = data.decodeUint8Array(3); - + assertEq(decoded.length, originalValues.length); for (uint256 i = 0; i < decoded.length; i++) { assertEq(decoded[i], originalValues[i]); @@ -284,11 +283,11 @@ contract BorshDecoderTest is Test { function testDecodeUint8ArrayEmpty() public pure { uint8[] memory originalValues = new uint8[](0); - + bytes memory encoded = BorshEncoder.encodeUint8Array(originalValues); BorshDecoder.Data memory data = BorshDecoder.from(encoded); uint8[] memory decoded = data.decodeUint8Array(0); - + assertEq(decoded.length, 0); } @@ -297,11 +296,11 @@ contract BorshDecoderTest is Test { for (uint256 i = 0; i < 100; i++) { originalValues[i] = uint8(i % 256); } - + bytes memory encoded = BorshEncoder.encodeUint8Array(originalValues); BorshDecoder.Data memory data = BorshDecoder.from(encoded); uint8[] memory decoded = data.decodeUint8Array(100); - + assertEq(decoded.length, originalValues.length); for (uint256 i = 0; i < decoded.length; i++) { assertEq(decoded[i], originalValues[i]); @@ -313,11 +312,11 @@ contract BorshDecoderTest is Test { originalValues[0] = 1; originalValues[1] = 2; originalValues[2] = 3; - + bytes memory encoded = BorshEncoder.encodeUint16Array(originalValues); BorshDecoder.Data memory data = BorshDecoder.from(encoded); uint16[] memory decoded = data.decodeUint16Array(3); - + assertEq(decoded.length, originalValues.length); for (uint256 i = 0; i < decoded.length; i++) { assertEq(decoded[i], originalValues[i]); @@ -329,11 +328,11 @@ contract BorshDecoderTest is Test { originalValues[0] = 1; originalValues[1] = 2; originalValues[2] = 3; - + bytes memory encoded = BorshEncoder.encodeUint32Array(originalValues); BorshDecoder.Data memory data = BorshDecoder.from(encoded); uint32[] memory decoded = data.decodeUint32Array(3); - + assertEq(decoded.length, originalValues.length); for (uint256 i = 0; i < decoded.length; i++) { assertEq(decoded[i], originalValues[i]); @@ -345,11 +344,11 @@ contract BorshDecoderTest is Test { originalValues[0] = 1; originalValues[1] = 2; originalValues[2] = 3; - + bytes memory encoded = BorshEncoder.encodeUint64Array(originalValues); BorshDecoder.Data memory data = BorshDecoder.from(encoded); uint64[] memory decoded = data.decodeUint64Array(3); - + assertEq(decoded.length, originalValues.length); for (uint256 i = 0; i < decoded.length; i++) { assertEq(decoded[i], originalValues[i]); @@ -361,11 +360,11 @@ contract BorshDecoderTest is Test { originalValues[0] = 1; originalValues[1] = 2; originalValues[2] = 3; - + bytes memory encoded = BorshEncoder.encodeUint128Array(originalValues); BorshDecoder.Data memory data = BorshDecoder.from(encoded); uint128[] memory decoded = data.decodeUint128Array(3); - + assertEq(decoded.length, originalValues.length); for (uint256 i = 0; i < decoded.length; i++) { assertEq(decoded[i], originalValues[i]); @@ -377,11 +376,11 @@ contract BorshDecoderTest is Test { originalValues[0] = "hello"; originalValues[1] = "world"; originalValues[2] = "test"; - + bytes memory encoded = BorshEncoder.encodeStringArray(originalValues); BorshDecoder.Data memory data = BorshDecoder.from(encoded); string[] memory decoded = data.decodeStringArray(3); - + assertEq(decoded.length, originalValues.length); for (uint256 i = 0; i < decoded.length; i++) { assertEq(decoded[i], originalValues[i]); @@ -390,11 +389,11 @@ contract BorshDecoderTest is Test { function testDecodeStringArrayEmpty() public pure { string[] memory originalValues = new string[](0); - + bytes memory encoded = BorshEncoder.encodeStringArray(originalValues); BorshDecoder.Data memory data = BorshDecoder.from(encoded); string[] memory decoded = data.decodeStringArray(0); - + assertEq(decoded.length, 0); } @@ -402,11 +401,11 @@ contract BorshDecoderTest is Test { string[] memory originalValues = new string[](2); originalValues[0] = ""; originalValues[1] = "test"; - + bytes memory encoded = BorshEncoder.encodeStringArray(originalValues); BorshDecoder.Data memory data = BorshDecoder.from(encoded); string[] memory decoded = data.decodeStringArray(2); - + assertEq(decoded.length, originalValues.length); for (uint256 i = 0; i < decoded.length; i++) { assertEq(decoded[i], originalValues[i]); @@ -423,7 +422,7 @@ contract BorshDecoderTest is Test { schema.valuesTypeNames[2] = "u32"; schema.valuesTypeNames[3] = "u64"; schema.valuesTypeNames[4] = "u128"; - + // Encode test data bytes memory encodedData = abi.encodePacked( BorshEncoder.encodeU8(42), @@ -432,24 +431,24 @@ contract BorshDecoderTest is Test { BorshEncoder.encodeU64(0x123456789abcdef0), BorshEncoder.encodeU128(0x123456789abcdef0fedcba9876543210) ); - + bytes[] memory decodedParams = BorshDecoder.decodeGenericSchema(schema, encodedData); - + assertEq(decodedParams.length, 5); - + // Check decoded values uint8 decodedU8 = abi.decode(decodedParams[0], (uint8)); assertEq(decodedU8, 42); - + uint16 decodedU16 = abi.decode(decodedParams[1], (uint16)); assertEq(decodedU16, 1234); - + uint32 decodedU32 = abi.decode(decodedParams[2], (uint32)); assertEq(decodedU32, 0x12345678); - + uint64 decodedU64 = abi.decode(decodedParams[3], (uint64)); assertEq(decodedU64, 0x123456789abcdef0); - + uint128 decodedU128 = abi.decode(decodedParams[4], (uint128)); assertEq(decodedU128, 0x123456789abcdef0fedcba9876543210); } @@ -458,20 +457,20 @@ contract BorshDecoderTest is Test { GenericSchema memory schema; schema.valuesTypeNames = new string[](1); schema.valuesTypeNames[0] = "Vec"; - + // Prepare test data uint8[] memory u8Values = new uint8[](3); u8Values[0] = 1; u8Values[1] = 2; u8Values[2] = 3; - + // Encode test data bytes memory encodedData = BorshEncoder.encodeUint8Vec(u8Values); - + bytes[] memory decodedParams = BorshDecoder.decodeGenericSchema(schema, encodedData); - + assertEq(decodedParams.length, 1); - + // Check decoded u8 vector uint8[] memory decodedU8Vec = abi.decode(decodedParams[0], (uint8[])); assertEq(decodedU8Vec.length, 3); @@ -485,13 +484,13 @@ contract BorshDecoderTest is Test { schema.valuesTypeNames = new string[](2); schema.valuesTypeNames[0] = "[u8; 3]"; schema.valuesTypeNames[1] = "[u16; 2]"; - + // Prepare test data uint8[] memory u8Values = new uint8[](3); u8Values[0] = 1; u8Values[1] = 2; u8Values[2] = 3; - + uint16[] memory u16Values = new uint16[](2); u16Values[0] = 1000; u16Values[1] = 2000; @@ -501,7 +500,7 @@ contract BorshDecoderTest is Test { // console.log("u16Values"); // console.logBytes(BorshEncoder.encodeUint16Array(u16Values)); - + // Encode test data bytes memory encodedData = abi.encodePacked( BorshEncoder.encodeUint8Array(u8Values), @@ -512,14 +511,14 @@ contract BorshDecoderTest is Test { // console.logBytes(encodedData); // console.log("decode data"); - + bytes[] memory decodedParams = BorshDecoder.decodeGenericSchema(schema, encodedData); - + assertEq(decodedParams.length, 2); // console.log("decodedParams[0]"); // console.logBytes(decodedParams[0]); - + // Check decoded u8 array uint8[] memory decodedU8Array = abi.decode(decodedParams[0], (uint8[])); assertEq(decodedU8Array.length, 3); @@ -529,7 +528,7 @@ contract BorshDecoderTest is Test { // console.log("decodedParams[1]"); // console.logBytes(decodedParams[1]); - + // Check decoded u16 array uint16[] memory decodedU16Array = abi.decode(decodedParams[1], (uint16[])); assertEq(decodedU16Array.length, 2); @@ -546,24 +545,24 @@ contract BorshDecoderTest is Test { schema.valuesTypeNames[3] = "u64"; schema.valuesTypeNames[4] = "[u8; 4]"; schema.valuesTypeNames[5] = "[u32; 10]"; - + // Prepare test data uint8 u8Value = 42; uint32 u32Value = 0x12345678; uint64 u64Value1 = 0x123456789abcdef0; uint64 u64Value2 = 0xfedcba9876543210; - + uint8[] memory u8Array = new uint8[](4); u8Array[0] = 10; u8Array[1] = 20; u8Array[2] = 30; u8Array[3] = 40; - + uint32[] memory u32Array = new uint32[](10); for (uint256 i = 0; i < 10; i++) { u32Array[i] = uint32(1000 + i * 100); // 1000, 1100, 1200, ..., 1900 } - + // Encode test data bytes memory encodedData = abi.encodePacked( BorshEncoder.encodeU8(u8Value), @@ -573,28 +572,28 @@ contract BorshDecoderTest is Test { BorshEncoder.encodeUint8Array(u8Array), BorshEncoder.encodeUint32Array(u32Array) ); - + // Decode using GenericSchema bytes[] memory decodedParams = BorshDecoder.decodeGenericSchema(schema, encodedData); - + assertEq(decodedParams.length, 6); - + // Check decoded u8 uint8 decodedU8 = abi.decode(decodedParams[0], (uint8)); assertEq(decodedU8, u8Value); - + // Check decoded u32 uint32 decodedU32 = abi.decode(decodedParams[1], (uint32)); assertEq(decodedU32, u32Value); - + // Check decoded u64 (first) uint64 decodedU64_1 = abi.decode(decodedParams[2], (uint64)); assertEq(decodedU64_1, u64Value1); - + // Check decoded u64 (second) uint64 decodedU64_2 = abi.decode(decodedParams[3], (uint64)); assertEq(decodedU64_2, u64Value2); - + // Check decoded u8 array [u8; 4] uint8[] memory decodedU8Array = abi.decode(decodedParams[4], (uint8[])); assertEq(decodedU8Array.length, 4); @@ -602,7 +601,7 @@ contract BorshDecoderTest is Test { assertEq(decodedU8Array[1], 20); assertEq(decodedU8Array[2], 30); assertEq(decodedU8Array[3], 40); - + // Check decoded u32 array [u32; 10] uint32[] memory decodedU32Array = abi.decode(decodedParams[5], (uint32[])); assertEq(decodedU32Array.length, 10); @@ -618,19 +617,19 @@ contract BorshDecoderTest is Test { schema.valuesTypeNames[1] = "u32"; schema.valuesTypeNames[2] = "Vec"; schema.valuesTypeNames[3] = "[String; 2]"; - + // Prepare test data string memory singleString = "hello world"; uint32 numberValue = 42; - + string[] memory stringVec = new string[](2); stringVec[0] = "vec1"; stringVec[1] = "vec2"; - + string[] memory stringArray = new string[](2); stringArray[0] = "array1"; stringArray[1] = "array2"; - + // Encode test data bytes memory encodedData = abi.encodePacked( BorshEncoder.encodeString(singleString), @@ -638,26 +637,26 @@ contract BorshDecoderTest is Test { BorshEncoder.encodeStringVec(stringVec), BorshEncoder.encodeStringArray(stringArray) ); - + // Decode using GenericSchema bytes[] memory decodedParams = BorshDecoder.decodeGenericSchema(schema, encodedData); - + assertEq(decodedParams.length, 4); - + // Check decoded string string memory decodedString = abi.decode(decodedParams[0], (string)); assertEq(decodedString, singleString); - + // Check decoded u32 uint32 decodedU32 = abi.decode(decodedParams[1], (uint32)); assertEq(decodedU32, numberValue); - + // Check decoded string vector string[] memory decodedStringVec = abi.decode(decodedParams[2], (string[])); assertEq(decodedStringVec.length, 2); assertEq(decodedStringVec[0], "vec1"); assertEq(decodedStringVec[1], "vec2"); - + // Check decoded string array string[] memory decodedStringArray = abi.decode(decodedParams[3], (string[])); assertEq(decodedStringArray.length, 2); @@ -682,7 +681,8 @@ contract BorshDecoderTest is Test { string memory version = "0.1.0"; uint8 bump = 255; - bytes memory solanaEncodedData = hex"9b0caae01efacc820c1a5886fe1093df9fc438c296f9f7275b7718b6bc0e156d8d336c58f083996d8296980005000000302e312e30ff0000000000"; + bytes + memory solanaEncodedData = hex"9b0caae01efacc820c1a5886fe1093df9fc438c296f9f7275b7718b6bc0e156d8d336c58f083996d8296980005000000302e312e30ff0000000000"; bytes[] memory decodedParams = BorshDecoder.decodeGenericSchema(schema, solanaEncodedData); @@ -695,6 +695,7 @@ contract BorshDecoderTest is Test { assertEq(packedUint8Array, abi.encodePacked(discriminator)); console.log("decoded owner"); + console.logBytes(decodedParams[1]); uint8[] memory decodedOwner = abi.decode(decodedParams[1], (uint8[])); packedUint8Array = BorshEncoder.packUint8Array(decodedOwner); assertEq(packedUint8Array, abi.encodePacked(owner)); @@ -717,7 +718,7 @@ contract BorshDecoderTest is Test { function testDecodeSuperTokenConfigGenericSchema() public pure { GenericSchema memory schema; schema.valuesTypeNames = new string[](5); - schema.valuesTypeNames[0] = "[u8;8]"; // account discriminator + schema.valuesTypeNames[0] = "[u8;8]"; // account discriminator schema.valuesTypeNames[1] = "[u8;32]"; schema.valuesTypeNames[2] = "[u8;32]"; schema.valuesTypeNames[3] = "[u8;32]"; @@ -729,7 +730,8 @@ contract BorshDecoderTest is Test { bytes32 mint = 0x9ded6d20f1f5b9c56cb90ef89fc52d355aaaa868c42738eff11f50d1f81f522a; uint8 bump = 255; - bytes memory solanaEncodedData = hex"9b0caae01efacc820c1a5886fe1093df9fc438c296f9f7275b7718b6bc0e156d8d336c58f083996d00000000000000000000000000000000000000000000000000000000000000009ded6d20f1f5b9c56cb90ef89fc52d355aaaa868c42738eff11f50d1f81f522aff"; + bytes + memory solanaEncodedData = hex"9b0caae01efacc820c1a5886fe1093df9fc438c296f9f7275b7718b6bc0e156d8d336c58f083996d00000000000000000000000000000000000000000000000000000000000000009ded6d20f1f5b9c56cb90ef89fc52d355aaaa868c42738eff11f50d1f81f522aff"; bytes[] memory decodedParams = BorshDecoder.decodeGenericSchema(schema, solanaEncodedData); @@ -769,11 +771,120 @@ contract BorshDecoderTest is Test { assertEq(decodedBump, bump); } + /** Decode return data from rugPool**/ + + function testDecodeRugPoolReturnData() public pure { + GenericSchema memory dataSchema; + dataSchema.valuesTypeNames = new string[](5); + dataSchema.valuesTypeNames[0] = "u32"; + dataSchema.valuesTypeNames[1] = "u64"; + dataSchema.valuesTypeNames[2] = "u64"; + dataSchema.valuesTypeNames[3] = "u64"; + dataSchema.valuesTypeNames[4] = "u64"; + + bytes + memory triggerData = hex"8196980067f6495700000000fcfbbbd20000000064273fae00000000f7a303ff00000000"; + + bytes[] memory decodedData = BorshDecoder.decodeGenericSchema(dataSchema, triggerData); + + uint32 chainSlug = abi.decode(decodedData[0], (uint32)); + uint64 lpTokensPulled = abi.decode(decodedData[1], (uint64)); + uint64 lpBalance = abi.decode(decodedData[2], (uint64)); + uint64 susdcInPool = abi.decode(decodedData[3], (uint64)); + uint64 warcoinInPool = abi.decode(decodedData[4], (uint64)); + + console.log("chainSlug: ", chainSlug); + console.log("lpTokensPulled: ", lpTokensPulled); + console.log("lpBalance: ", lpBalance); + console.log("susdcInPool: ", susdcInPool); + console.log("warcoinInPool: ", warcoinInPool); + + // // console.log("decoded data: "); + // uint64 decodedSusdcPoolSupply = abi.decode(decodedData[0], (uint64)); + // assertEq(decodedSusdcPoolSupply, 8927759588); + // // console.log(decodedSusdcPoolSupply); + // uint64 decodedWarCoinPoolSupply = abi.decode(decodedData[1], (uint64)); + // assertEq(decodedWarCoinPoolSupply, 10014755499); + // // console.log(decodedWarCoinPoolSupply); + // uint64 decodedDepositorLpTokensAdded = abi.decode(decodedData[2], (uint64)); + // assertEq(decodedDepositorLpTokensAdded, 518418); + // // console.log(decodedDepositorLpTokensAdded); + } + + /** Decode return data from pumpPool**/ + + function testDecodePumpPoolReturnData() public pure { + GenericSchema memory envelopeSchema; + envelopeSchema.valuesTypeNames = new string[](1); + envelopeSchema.valuesTypeNames[0] = "Vec"; + + GenericSchema memory dataSchema; + dataSchema.valuesTypeNames = new string[](3); + dataSchema.valuesTypeNames[0] = "u64"; + dataSchema.valuesTypeNames[1] = "u64"; + dataSchema.valuesTypeNames[2] = "u64"; + + // first 4 bytes are the length of the Vec == 24 bytes + bytes + memory solanaReturnData = hex"18000000e4cc221402000000ab0aed540200000012e907000000000000000000"; + + bytes[] memory parsedEnvelopeData = BorshDecoder.decodeGenericSchema( + envelopeSchema, + solanaReturnData + ); + console.log("parsedEnvelopeData: "); + uint8[] memory decodedEnvelopeData = abi.decode(parsedEnvelopeData[0], (uint8[])); + bytes memory packedEnvelopeData = BorshEncoder.packUint8Array(decodedEnvelopeData); + console.logBytes(packedEnvelopeData); + + bytes[] memory decodedData = BorshDecoder.decodeGenericSchema( + dataSchema, + packedEnvelopeData + ); + + // console.log("decoded data: "); + uint64 decodedSusdcPoolSupply = abi.decode(decodedData[0], (uint64)); + assertEq(decodedSusdcPoolSupply, 8927759588); + // console.log(decodedSusdcPoolSupply); + uint64 decodedWarCoinPoolSupply = abi.decode(decodedData[1], (uint64)); + assertEq(decodedWarCoinPoolSupply, 10014755499); + // console.log(decodedWarCoinPoolSupply); + uint64 decodedDepositorLpTokensAdded = abi.decode(decodedData[2], (uint64)); + assertEq(decodedDepositorLpTokensAdded, 518418); + // console.log(decodedDepositorLpTokensAdded); + } + + function testDecodeUserSwapReturnData() public pure { + GenericSchema memory envelopeSchema; + envelopeSchema.valuesTypeNames = new string[](1); + envelopeSchema.valuesTypeNames[0] = "Vec"; + + GenericSchema memory dataSchema; + dataSchema.valuesTypeNames = new string[](1); + dataSchema.valuesTypeNames[0] = "u64"; + + bytes memory solanaReturnData = hex"08000000dfb0010000000000"; + + bytes[] memory parsedEnvelopeData = BorshDecoder.decodeGenericSchema( + envelopeSchema, + solanaReturnData + ); + uint8[] memory decodedEnvelopeData = abi.decode(parsedEnvelopeData[0], (uint8[])); + bytes memory packedEnvelopeData = BorshEncoder.packUint8Array(decodedEnvelopeData); + bytes[] memory decodedData = BorshDecoder.decodeGenericSchema( + dataSchema, + packedEnvelopeData + ); + + uint64 amountOut64 = abi.decode(decodedData[0], (uint64)); + console.log("amountOut64: ", amountOut64); + } + /** Test edge cases **/ function testDecodeInsufficientData() public { bytes memory shortData = hex"01"; - + // Should revert when trying to decode u16 from 1-byte data BorshDecoder.Data memory data = BorshDecoder.from(shortData); vm.expectRevert("Parse error: unexpected EOI"); @@ -782,7 +893,7 @@ contract BorshDecoderTest is Test { function testDecodeOutOfBounds() public { bytes memory data = hex"0102"; - + // Should revert when trying to decode u32 from 2-byte data BorshDecoder.Data memory decoderData = BorshDecoder.from(data); vm.expectRevert("Parse error: unexpected EOI"); @@ -792,7 +903,7 @@ contract BorshDecoderTest is Test { function testDecodeVecInsufficientLength() public { // Length says 10 but only 5 bytes follow bytes memory invalidVecData = hex"0a000000010203"; - + BorshDecoder.Data memory data = BorshDecoder.from(invalidVecData); vm.expectRevert("Parse error: unexpected EOI"); data.decodeUint8Vec(); @@ -807,22 +918,22 @@ contract BorshDecoderTest is Test { BorshEncoder.encodeU16(1234), BorshEncoder.encodeUint8Vec(_createU8Array()) ); - + // Decode them one by one BorshDecoder.Data memory decoderData = BorshDecoder.from(data); - + uint8 u8Val = decoderData.decodeU8(); assertEq(u8Val, 42); - + uint16 u16Val = decoderData.decodeU16(); assertEq(u16Val, 1234); - + (uint32 length, uint8[] memory vecVal) = decoderData.decodeUint8Vec(); assertEq(length, 2); assertEq(vecVal.length, 2); assertEq(vecVal[0], 1); assertEq(vecVal[1], 2); - + // Verify all data consumed decoderData.done(); } @@ -833,4 +944,4 @@ contract BorshDecoderTest is Test { arr[1] = 2; return arr; } -} \ No newline at end of file +} diff --git a/test/BorshEncoderTest.t.sol b/test/BorshEncoderTest.t.sol index 57b19be8..372a0be1 100644 --- a/test/BorshEncoderTest.t.sol +++ b/test/BorshEncoderTest.t.sol @@ -4,6 +4,8 @@ pragma solidity ^0.8.21; import "forge-std/Test.sol"; import "forge-std/console.sol"; import {BorshEncoder} from "../contracts/evmx/watcher/borsh-serde/BorshEncoder.sol"; +import {SolanaInstruction, GenericSchema} from "../contracts/utils/common/Structs.sol"; +import {BorshDecoder} from "../contracts/evmx/watcher/borsh-serde/BorshDecoder.sol"; contract BorshEncoderTest is Test { /** Encode primitive types **/ @@ -246,4 +248,49 @@ contract BorshEncoderTest is Test { console.logBytes(encoded); assertEq(encoded, expectedEncoded); } + + function testEncodeBytes32Account() public pure { + GenericSchema memory schema; + schema.valuesTypeNames = new string[](1); + schema.valuesTypeNames[0] = "[u8;32]"; // account + + // TODO: why this does not work and i get : [FAIL: panic: array out-of-bounds access (0x32)] - abi.encode is not makes something wrong + // bytes32 bytes32Account = bytes32(hex"8d744e08d2f5328413504f2f882419fea155705fe74827841f7a3fef51e61b7b"); + // bytes memory encodedBytes32Account =abi.encode(bytes32Account); + // console.logBytes32(bytes32Account); + // console.logBytes(encodedBytes32Account); + // This works + bytes + memory encodedBytes32Account = hex"8d744e08d2f5328413504f2f882419fea155705fe74827841f7a3fef51e61b7b"; + + bytes[] memory decodedParams = BorshDecoder.decodeGenericSchema( + schema, + encodedBytes32Account + ); + + console.logBytes(decodedParams[0]); + uint8[] memory decodedAccount = abi.decode(decodedParams[0], (uint8[])); + bytes memory packedUint8Array = BorshEncoder.packUint8Array(decodedAccount); + + assertEq(packedUint8Array, abi.encodePacked(encodedBytes32Account)); + } + + function testDebugSolanaInstruction() public pure { + bytes + memory payload = hex"0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000003803f938620c4eda1860ffb2527ec4848664cfcd5c8bb3f56f2f6a8b386022bea7500000000000000000000000000000000000000000000000000000000000000802626145ee99dd2c20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000bd75356cfd682165fbd545f724dc14f86c655ef3788a60b3d40559bc8d40817b41133b2cb07c8fee0c53e04bc91689b15ee433a9c5c9a9d688441886d5a56d951966c6e6b9cfa900d55efed59a41ab8da066703ceb5eb1d5e2b6681eace64b2735fc60863a4bc264f2daf0379bdafdedfe619116f4e6370ad1f342d4838769a7c47a7e504a8238cf4462dbfdcf5e589ff60d7dcd88b2a622ee39a89203f2aa5a07115872279fa3b3c4e32ad61771357f72eb86e3f7c714275518e69b3136634ac052fbb01401ede4d7166facbd7867b9da5a2f8ea44023fbf152d30559c21dfbabe53361b503d9fc652eacc045f7ad550a4b45e7a93fee29fbd6c0f3837b1c14006ddf6e1d765a193d9cbe146ceeb79ac1cb485ed5f5b37913a8cf5857eff00a98c97258f4e2489f1bb3d1029148e0d830b5a1399daff1084048e7bd8dbe9f85900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000208d744e08d2f5328413504f2f882419fea155705fe74827841f7a3fef51e61b7b0000000000000000000000000000000000000000000000000000000000000020040288203723cc7ca6f0ea86a538bd9a73486b58f9ddafdc89bec3a55d06810000000000000000000000000000000000000000000000000000000000000000202b6a3839bac5f70b6fd425964c480868fc72fd5b5c938a4382bd895e4a05f659000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000001c0000000000000000000000000000000000000000000000000000000000000000b010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000075b75383b33325d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000075b75383b33325d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000075b75383b33325d00000000000000000000000000000000000000000000000000"; + + SolanaInstruction memory instruction = abi.decode(payload, (SolanaInstruction)); + + console.log("instruction decoded"); + // console.log(instruction); + + // This is decoded instruction: + /* + SolanaInstruction({ data: SolanaInstructionData({ programId: 0x3f938620c4eda1860ffb2527ec4848664cfcd5c8bb3f56f2f6a8b386022bea75, accounts: [0xd75356cfd682165fbd545f724dc14f86c655ef3788a60b3d40559bc8d40817b4, 0x1133b2cb07c8fee0c53e04bc91689b15ee433a9c5c9a9d688441886d5a56d951, 0x966c6e6b9cfa900d55efed59a41ab8da066703ceb5eb1d5e2b6681eace64b273, 0x5fc60863a4bc264f2daf0379bdafdedfe619116f4e6370ad1f342d4838769a7c, 0x47a7e504a8238cf4462dbfdcf5e589ff60d7dcd88b2a622ee39a89203f2aa5a0, 0x7115872279fa3b3c4e32ad61771357f72eb86e3f7c714275518e69b3136634ac, 0x052fbb01401ede4d7166facbd7867b9da5a2f8ea44023fbf152d30559c21dfba, 0xbe53361b503d9fc652eacc045f7ad550a4b45e7a93fee29fbd6c0f3837b1c140, 0x06ddf6e1d765a193d9cbe146ceeb79ac1cb485ed5f5b37913a8cf5857eff00a9, 0x8c97258f4e2489f1bb3d1029148e0d830b5a1399daff1084048e7bd8dbe9f859, 0x0000000000000000000000000000000000000000000000000000000000000000], instructionDiscriminator: 0x2626145ee99dd2c2, functionArguments: [0x8d744e08d2f5328413504f2f882419fea155705fe74827841f7a3fef51e61b7b, 0x040288203723cc7ca6f0ea86a538bd9a73486b58f9ddafdc89bec3a55d068100, 0x2b6a3839bac5f70b6fd425964c480868fc72fd5b5c938a4382bd895e4a05f659] }), description: SolanaInstructionDataDescription({ accountFlags: [0x01, 0x00, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00], functionArgumentTypeNames: ["[u8;32]", "[u8;32]", "[u8;32]"] }) }) + */ + + bytes memory functionArgsPacked = BorshEncoder.encodeFunctionArgs(instruction); + + console.logBytes(functionArgsPacked); + } } diff --git a/test/DigestTest.t.sol b/test/DigestTest.t.sol index 34fe1e1b..1d2644e0 100644 --- a/test/DigestTest.t.sol +++ b/test/DigestTest.t.sol @@ -25,7 +25,7 @@ contract DigestTest is Test { bytes4 selector = bytes4(keccak256("increase(uint256,uint32,uint8[],uint32[],string)")); uint8[] memory array_one = new uint8[](3); array_one[0] = 1; - array_one[1] = 2; + array_one[1] = 2; array_one[2] = 3; uint32[] memory array_two = new uint32[](3); array_two[0] = 666; diff --git a/test/ReturnValueSolanaTest.t.sol b/test/ReturnValueSolanaTest.t.sol index 5c2ed803..f3dd50bf 100644 --- a/test/ReturnValueSolanaTest.t.sol +++ b/test/ReturnValueSolanaTest.t.sol @@ -17,8 +17,9 @@ contract ReturnValueSolanaTest is Test { GenericSchema memory returnDataSchema = GenericSchema({ valuesTypeNames: returnDataValuesTypeNames }); - - bytes memory returnData = hex"0c1a5886fe1093df9fc438c296f9f7275b7718b6bc0e156d8d336c58f083996d0400000001020304"; + + bytes + memory returnData = hex"0c1a5886fe1093df9fc438c296f9f7275b7718b6bc0e156d8d336c58f083996d0400000001020304"; // GenericSchema memory genericSchema = abi.decode(data, (GenericSchema)); bytes[] memory parsedData = BorshDecoder.decodeGenericSchema(returnDataSchema, returnData); @@ -33,8 +34,11 @@ contract ReturnValueSolanaTest is Test { console.logBytes(returnValue); // bytes32 hexadecimal representation of solana transmitter address - assertEq(transmitterSolana, hex"0c1a5886fe1093df9fc438c296f9f7275b7718b6bc0e156d8d336c58f083996d"); + assertEq( + transmitterSolana, + hex"0c1a5886fe1093df9fc438c296f9f7275b7718b6bc0e156d8d336c58f083996d" + ); // 4 bytes with values: 1, 2, 3, 4 assertEq(returnValue, hex"01020304"); } -} \ No newline at end of file +} diff --git a/test/apps/app-gateways/super-token/EvmSolanaAppGateway.sol b/test/apps/app-gateways/super-token/EvmSolanaAppGateway.sol index b295ea78..fddb14eb 100644 --- a/test/apps/app-gateways/super-token/EvmSolanaAppGateway.sol +++ b/test/apps/app-gateways/super-token/EvmSolanaAppGateway.sol @@ -11,7 +11,6 @@ import {BorshDecoder} from "../../../../contracts/evmx/watcher/borsh-serde/Borsh import {BorshEncoder} from "../../../../contracts/evmx/watcher/borsh-serde/BorshEncoder.sol"; contract EvmSolanaAppGateway is AppGatewayBase, Ownable { - event Transferred(uint40 requestCount); struct SuperTokenEvmConstructorParams { @@ -52,7 +51,14 @@ contract EvmSolanaAppGateway is AppGatewayBase, Ownable { event SuperTokenConfigAccountRead(SuperTokenConfigAccount superTokenConfigAccount); event TokenAccountRead(bytes32 tokenAccountAddress, uint64 amount, uint64 decimals); - event TriggerIncrease(uint256 amountU64, uint32 amountU32, uint8[] vecU8, uint32[] vecU32, string myString, uint256 triggerCounter); + event TriggerIncrease( + uint256 amountU64, + uint32 amountU32, + uint8[] vecU8, + uint32[] vecU32, + string myString, + uint256 triggerCounter + ); event MintReturnData(bytes data); /** Contract data **/ @@ -126,7 +132,11 @@ contract EvmSolanaAppGateway is AppGatewayBase, Ownable { ISuperToken(order.srcEvmToken).burn(order.userEvm, order.srcAmount); // we are directly calling the ForwarderSolana - forwarderSolana.callSolana(abi.encode(solanaInstruction), solanaInstruction.data.programId); + forwarderSolana.callSolana( + abi.encode(solanaInstruction), + solanaInstruction.data.programId, + address(this) + ); emit Transferred(_getCurrentRequestCount()); } @@ -139,26 +149,40 @@ contract EvmSolanaAppGateway is AppGatewayBase, Ownable { } function mintSuperTokenSolana( - SolanaInstruction memory solanaInstruction, + SolanaInstruction memory solanaInstruction, GenericSchema memory returnDataSchema ) external async { // we are directly calling the ForwarderSolana - forwarderSolana.callSolana(abi.encode(solanaInstruction), solanaInstruction.data.programId); + forwarderSolana.callSolana( + abi.encode(solanaInstruction), + solanaInstruction.data.programId, + address(this) + ); then(this.storeAndDecodeMintReturnData.selector, abi.encode(returnDataSchema)); emit Transferred(_getCurrentRequestCount()); } - - function triggerTestSuperTokenSolana(SolanaInstruction memory solanaInstruction) external async { + + function triggerTestSuperTokenSolana( + SolanaInstruction memory solanaInstruction + ) external async { // we are directly calling the ForwarderSolana - forwarderSolana.callSolana(abi.encode(solanaInstruction), solanaInstruction.data.programId); + forwarderSolana.callSolana( + abi.encode(solanaInstruction), + solanaInstruction.data.programId, + address(this) + ); emit Transferred(_getCurrentRequestCount()); } // this is only for debugging purposes to mint tokens on Solana function transferForDebug(SolanaInstruction memory solanaInstruction) external async { - forwarderSolana.callSolana(abi.encode(solanaInstruction), solanaInstruction.data.programId); + forwarderSolana.callSolana( + abi.encode(solanaInstruction), + solanaInstruction.data.programId, + address(this) + ); emit Transferred(_getCurrentRequestCount()); } @@ -168,16 +192,25 @@ contract EvmSolanaAppGateway is AppGatewayBase, Ownable { GenericSchema memory genericSchema ) external async { _setOverrides(Read.ON); - forwarderSolana.callSolana(abi.encode(solanaReadRequest), solanaReadRequest.accountToRead); + forwarderSolana.callSolana( + abi.encode(solanaReadRequest), + solanaReadRequest.accountToRead, + address(this) + ); then(this.storeAndDecodeSuperTokenConfigAccount.selector, abi.encode(genericSchema)); } - function storeAndDecodeSuperTokenConfigAccount(bytes memory data, bytes memory returnData) external async { + function storeAndDecodeSuperTokenConfigAccount( + bytes memory data, + bytes memory returnData + ) external async { GenericSchema memory genericSchema = abi.decode(data, (GenericSchema)); bytes[] memory parsedData = BorshDecoder.decodeGenericSchema(genericSchema, returnData); uint8[] memory decodedDiscriminatorArray = abi.decode(parsedData[0], (uint8[])); - bytes8 decodedDiscriminator = bytes8(BorshEncoder.packUint8Array(decodedDiscriminatorArray)); + bytes8 decodedDiscriminator = bytes8( + BorshEncoder.packUint8Array(decodedDiscriminatorArray) + ); uint8[] memory decodedOwnerArray = abi.decode(parsedData[1], (uint8[])); bytes32 decodedOwner = bytes32(BorshEncoder.packUint8Array(decodedOwnerArray)); uint8[] memory decodedSocketArray = abi.decode(parsedData[2], (uint8[])); @@ -199,20 +232,27 @@ contract EvmSolanaAppGateway is AppGatewayBase, Ownable { emit SuperTokenConfigAccountRead(decodedSuperTokenConfigAccount); } - function storeAndDecodeMintReturnData(bytes memory data, bytes memory returnData) external async { + function storeAndDecodeMintReturnData( + bytes memory data, + bytes memory returnData + ) external async { GenericSchema memory genericSchema = abi.decode(data, (GenericSchema)); bytes[] memory parsedData = BorshDecoder.decodeGenericSchema(genericSchema, returnData); uint8[] memory decodedReturnDataArray = abi.decode(parsedData[0], (uint8[])); bytes memory decodedReturnData = BorshEncoder.packUint8Array(decodedReturnDataArray); - emit MintReturnData(decodedReturnData); + emit MintReturnData(decodedReturnData); } function readTokenAccount(SolanaReadRequest memory solanaReadRequest) external async { _setOverrides(Read.ON); - forwarderSolana.callSolana(abi.encode(solanaReadRequest), solanaReadRequest.accountToRead); + forwarderSolana.callSolana( + abi.encode(solanaReadRequest), + solanaReadRequest.accountToRead, + address(this) + ); then(this.storeTokenAccountData.selector, abi.encode(solanaReadRequest.accountToRead)); } @@ -227,7 +267,13 @@ contract EvmSolanaAppGateway is AppGatewayBase, Ownable { emit TokenAccountRead(tokenAccountAddress, amount, decimals); } - function increase(uint256 amountU64, uint32 amountU32, uint8[] memory vecU8, uint32[] memory vecU32, string memory myString) public { + function increase( + uint256 amountU64, + uint32 amountU32, + uint8[] memory vecU8, + uint32[] memory vecU32, + string memory myString + ) public { triggerCounter++; emit TriggerIncrease(amountU64, amountU32, vecU8, vecU32, myString, triggerCounter); } diff --git a/yarn.lock b/yarn.lock index 3f01d8df..657eb456 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2076,21 +2076,23 @@ "@smithy/types" "^4.1.0" tslib "^2.6.2" -"@socket.tech/socket-protocol-common@1.1.44": - version "1.1.44" - resolved "https://registry.yarnpkg.com/@socket.tech/socket-protocol-common/-/socket-protocol-common-1.1.44.tgz#ee78da13cad3e5544ceed5a352ef7988c55e4044" - integrity sha512-ntrx/71ETxl4xN62F+D8jVNWUMrrpReLUX16DK9M1oAggQHBT1mem4e9EhvoRBriXFmGBmFHs1xJ35BvHsFPDQ== +"@socket.tech/socket-protocol-common@1.1.49": + version "1.2.46" + resolved "https://registry.yarnpkg.com/@socket.tech/socket-protocol-common/-/socket-protocol-common-1.2.46.tgz#059d4c47f544be9f97606631646b2ca039643333" + integrity sha512-6olUnXfn5nRewWA7M6NosJAmAbjkUgjmbw5BcyjSbPpjTAiP9JZXM0Fi5OTCIxrig3Z+LY/gVvji8An+Et1rkw== dependencies: - "@socket.tech/socket-protocol" "1.0.16" + "@socket.tech/socket-protocol" "^1.1.49" axios "^1.7.9" ethers "^5.6.5" pino "^9.6.0" sequelize "^6.21.6" -"@socket.tech/socket-protocol@1.0.16": - version "1.0.16" - resolved "https://registry.yarnpkg.com/@socket.tech/socket-protocol/-/socket-protocol-1.0.16.tgz#06820a213fa8d0661d3c22b3f871db4058ef1440" - integrity sha512-8r68OPqld3fzitu53SDuwGOCEHxECF+6GKBRQ8UtyDS6sAt3HHYGXdYGJ8sYvLtwZePwplautRKVcpDwk/LAgg== +"@socket.tech/socket-protocol@^1.1.49": + version "1.1.49" + resolved "https://registry.yarnpkg.com/@socket.tech/socket-protocol/-/socket-protocol-1.1.49.tgz#ecc84f362a773021b9182dbf4b8668f1b3b30192" + integrity sha512-z6G+2ri9XOetNjzSdfqUTqFIJdeUelfTgdFVVz4HqYVhrvDr3at+zY4i1sJDdCfiTKhfyCIrSgCmreE33gQnOg== + dependencies: + "@types/uuid" "^10.0.0" "@solidity-parser/parser@^0.19.0": version "0.19.0"