Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,5 @@ deployments/local_verification.json

testScript.sh
CLAUDE.md

.idea/
12 changes: 12 additions & 0 deletions Errors.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@
| `InvalidDepositAmount()` | `0xfe9ba5cd` |
| `TokenNotWhitelisted(address)` | `0xea3bff2e` |

## evmx/watcher/Configurations.sol

| Error | Signature |
| ----------------------------------------- | ------------ |
| `InvalidSwitchboardTest(bytes32,bytes32)` | `0x702f36a1` |

## evmx/watcher/RequestHandler.sol

| Error | Signature |
Expand Down Expand Up @@ -81,6 +87,12 @@
| ------------------- | ------------ |
| `NoPermit(bytes32)` | `0x962f6333` |

## utils/common/Converters.sol

| Error | Signature |
| -------------------------- | ------------ |
| `NotAnEvmAddress(bytes32)` | `0x33b960d0` |

## utils/common/Errors.sol

| Error | Signature |
Expand Down
18 changes: 10 additions & 8 deletions EventTopics.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

| Event | Arguments | Topic |
| ---------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------- |
| `AppGatewayCallRequested` | `(triggerId: bytes32, appGatewayId: bytes32, switchboard: address, plug: address, overrides: bytes, payload: bytes)` | `0x5c88d65ab8ba22a57e582bd8ddfa9801cc0ca6be6cb3182baaedc705a612419e` |
| `AppGatewayCallRequested` | `(triggerId: bytes32, appGatewayId: bytes32, switchboard: bytes32, plug: bytes32, overrides: bytes, payload: bytes)` | `0xf83cee1d13047d8a1785495ac352da7c9ac5725641f76506899def19750c7696` |
| `ExecutionFailed` | `(payloadId: bytes32, exceededMaxCopy: bool, returnData: bytes)` | `0x385334bc68a32c4d164625189adc7633e6074eb1b837fb4d11d768245151e4ce` |
| `ExecutionSuccess` | `(payloadId: bytes32, exceededMaxCopy: bool, returnData: bytes)` | `0x324d63a433b21a12b90e79cd2ba736b2a5238be6165e03b750fa4a7d5193d5d9` |
| `OwnershipHandoverCanceled` | `(pendingOwner: address)` | `0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92` |
Expand Down Expand Up @@ -65,7 +65,7 @@
| `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: address)` | `0xa8c4be32b96cca895f1f0f4684e6b377b2c4513bc35eb57a13afb6b5efb2c0ce` |
| `FeesPlugSet` | `(chainSlug: uint32, feesPlug: bytes32)` | `0x677a00737c8099aa9e6c554104ca7941deb59125335cfb3d0d9f604f178db59c` |
| `FeesPoolSet` | `(feesPool: address)` | `0xd07af3fd70b48ab3c077a8d45c3a288498d905d0e3d1e65bc171f6c2e890d8ef` |
| `Initialized` | `(version: uint64)` | `0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2` |
| `OwnershipHandoverCanceled` | `(pendingOwner: address)` | `0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92` |
Expand Down Expand Up @@ -180,13 +180,13 @@
| Event | Arguments | Topic |
| ---------------------------- | ------------------------------------------------------------------------ | -------------------------------------------------------------------- |
| `Initialized` | `(version: uint64)` | `0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2` |
| `IsValidPlugSet` | `(appGateway: address, chainSlug: uint32, plug: address, isValid: bool)` | `0x61cccc7387868fc741379c7acd9dd346e0ca2e5c067dc5b156fbbc55b1c2fcf5` |
| `IsValidPlugSet` | `(appGateway: address, chainSlug: uint32, plug: bytes32, isValid: bool)` | `0xd7a90efd60960a8435ef282822190655f6bd2ffa14bb350dc23d6f6956056d7e` |
| `OwnershipHandoverCanceled` | `(pendingOwner: address)` | `0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92` |
| `OwnershipHandoverRequested` | `(pendingOwner: address)` | `0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d` |
| `OwnershipTransferred` | `(oldOwner: address, newOwner: address)` | `0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0` |
| `PlugAdded` | `(appGatewayId: bytes32, chainSlug: uint32, plug: address)` | `0x7b3e14230a721c4737d275f9a63b92c44cb657bcfddbe6fe9b4d9cd9bd8d4a95` |
| `SocketSet` | `(chainSlug: uint32, socket: address)` | `0x5b13a5470e66a2ec5e9b32af5f9e23fe304864892918c60fffd22509ca73ac97` |
| `SwitchboardSet` | `(chainSlug: uint32, sbType: bytes32, switchboard: address)` | `0x6273f161f4a795e66ef3585d9b4442ef3796b32337157fdfb420b5281e4cf2e3` |
| `PlugAdded` | `(appGatewayId: bytes32, chainSlug: uint32, plug: bytes32)` | `0x3734a2406c5c2f2556c82a0819c51e42a135dd102465cc9856594481ea2f1637` |
| `SocketSet` | `(chainSlug: uint32, socket: bytes32)` | `0x3200bf6ad2ab31b9220ed9d2f83089d7a1332f55aaa3825c57510743a315165b` |
| `SwitchboardSet` | `(chainSlug: uint32, sbType: bytes32, switchboard: bytes32)` | `0xcdfbfa261040f4dffb03c7d9493f74b575f2ae533bb43fd7b5d5b24ac9d804f4` |

## PromiseResolver

Expand Down Expand Up @@ -214,6 +214,8 @@

| Event | Arguments | Topic |
| ---------------------------- | ---------------------------------------- | -------------------------------------------------------------------- |
| `AppGatewayCallFailed` | `(triggerId: bytes32)` | `0xcaf8475fdade8465ea31672463949e6cf1797fdcdd11eeddbbaf857e1e5907b7` |
| `CalledAppGateway` | `(triggerId: bytes32)` | `0xf659ffb3875368f54fb4ab8f5412ac4518af79701a48076f7a58d4448e4bdd0b` |
| `Initialized` | `(version: uint64)` | `0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2` |
| `OwnershipHandoverCanceled` | `(pendingOwner: address)` | `0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92` |
| `OwnershipHandoverRequested` | `(pendingOwner: address)` | `0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d` |
Expand All @@ -239,7 +241,7 @@
| --------------- | ---------------------------------------------------------------------- | -------------------------------------------------------------------- |
| `ExpiryTimeSet` | `(expiryTime: uint256)` | `0x07e837e13ad9a34715a6bd45f49bbf12de19f06df79cb0be12b3a7d7f2397fa9` |
| `ReadFeesSet` | `(readFees: uint256)` | `0xc674cb6dde3a59f84dbf226832e606ffc54ac8a169e1568fc834c7813010f926` |
| `ReadRequested` | `(transaction: tuple, readAtBlockNumber: uint256, payloadId: bytes32)` | `0x42d9c65d4f6e45462ae6206adb3e388e046b7daa1dc8699d9380cac72ff5db0b` |
| `ReadRequested` | `(transaction: tuple, readAtBlockNumber: uint256, payloadId: bytes32)` | `0xbcad63ac625c0f3cb23b62b126567728fcf5950ca8e559150e764eced73e794a` |

## SchedulePrecompile

Expand All @@ -257,7 +259,7 @@
| Event | Arguments | Topic |
| ------------------------------- | ---------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------- |
| `ChainMaxMsgValueLimitsUpdated` | `(chainSlug: uint32, maxMsgValueLimit: uint256)` | `0x439087d094fe7dacbba3f0c67032041952d8bd58a891e15af10ced28fed0eb91` |
| `ContractFactoryPlugSet` | `(chainSlug: uint32, contractFactoryPlug: address)` | `0x85bfa413b9e5e225278f51af2ac872988e0a9374263b118d963c50945ea888bb` |
| `ContractFactoryPlugSet` | `(chainSlug: uint32, contractFactoryPlug: bytes32)` | `0xfad552a6feb82bef23201b8dce04b2460bff41b00f26fef3d791572cfdab49c2` |
| `ExpiryTimeSet` | `(expiryTime: uint256)` | `0x07e837e13ad9a34715a6bd45f49bbf12de19f06df79cb0be12b3a7d7f2397fa9` |
| `FeesSet` | `(writeFees: uint256)` | `0x3346af6da1932164d501f2ec28f8c5d686db5828a36b77f2da4332d89184fe7b` |
| `Initialized` | `(version: uint64)` | `0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2` |
Expand Down
42 changes: 21 additions & 21 deletions FunctionSignatures.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
| `chainSlug` | `0xb349ba65` |
| `completeOwnershipHandover` | `0xf04e283e` |
| `connect` | `0xb3bde1aa` |
| `disableSwitchboard` | `0xe545b261` |
| `disableSwitchboard` | `0xc4d9a820` |
| `enableSwitchboard` | `0xf97a498a` |
| `execute` | `0xafa8b480` |
| `getPlugConfig` | `0xf9778ee0` |
Expand Down Expand Up @@ -151,7 +151,7 @@
| `requestOwnershipHandover` | `0x25692962` |
| `rescueFunds` | `0x6ccae054` |
| `sbType` | `0x745de344` |
| `setFeesPlug` | `0xeab75f36` |
| `setFeesPlug` | `0xd6a9a8b7` |
| `setFeesPool` | `0xd6684588` |
| `tokenOnChainBalances` | `0x3b27866d` |
| `transferCredits` | `0xf1686c89` |
Expand Down Expand Up @@ -224,8 +224,8 @@
| `forwarderBeacon` | `0x945709ae` |
| `forwarderImplementation` | `0xe38d60a1` |
| `getAsyncPromiseAddress` | `0x104f39b4` |
| `getForwarderAddress` | `0x48c0b3e0` |
| `getOrDeployForwarderContract` | `0x0aa178de` |
| `getForwarderAddress` | `0x9c038b01` |
| `getOrDeployForwarderContract` | `0xe9bf1edf` |
| `initialize` | `0x485cc955` |
| `owner` | `0x8da5cb5b` |
| `ownershipHandoverExpiresAt` | `0xfee81cf4` |
Expand Down Expand Up @@ -292,7 +292,7 @@
| `feesManager__` | `0x70568b58` |
| `getChainSlug` | `0x0b8c6568` |
| `getOnChainAddress` | `0x9da48789` |
| `initialize` | `0x647c576c` |
| `initialize` | `0x148841cb` |
| `onChainAddress` | `0x8bd0b363` |
| `rescueFunds` | `0x6ccae054` |
| `watcher__` | `0x300bb063` |
Expand Down Expand Up @@ -361,22 +361,22 @@
| ---------------------------- | ------------ |
| `cancelOwnershipHandover` | `0x54d1f13d` |
| `completeOwnershipHandover` | `0xf04e283e` |
| `getPlugConfigs` | `0x8a028c38` |
| `getPlugConfigs` | `0x25945c1a` |
| `initialize` | `0x485cc955` |
| `isValidPlug` | `0xec8aef74` |
| `isValidPlug` | `0x00f9b9f4` |
| `owner` | `0x8da5cb5b` |
| `ownershipHandoverExpiresAt` | `0xfee81cf4` |
| `renounceOwnership` | `0x715018a6` |
| `requestOwnershipHandover` | `0x25692962` |
| `rescueFunds` | `0x6ccae054` |
| `setAppGatewayConfigs` | `0xd137fcbb` |
| `setIsValidPlug` | `0xf41332b0` |
| `setSocket` | `0x075c40be` |
| `setSwitchboard` | `0x61706f1e` |
| `setAppGatewayConfigs` | `0xebfb22cd` |
| `setIsValidPlug` | `0x4842c37a` |
| `setSocket` | `0x38d4de67` |
| `setSwitchboard` | `0x491eac1f` |
| `sockets` | `0xb44a23ab` |
| `switchboards` | `0xaa539546` |
| `transferOwnership` | `0xf2fde38b` |
| `verifyConnections` | `0xa53b6fad` |
| `verifyConnections` | `0x36cb19fb` |
| `watcher__` | `0x300bb063` |

## PromiseResolver
Expand Down Expand Up @@ -420,7 +420,7 @@
| `rescueFunds` | `0x6ccae054` |
| `setPrecompile` | `0x122e0042` |
| `setRequestPayloadCountLimit` | `0x8526582b` |
| `submitRequest` | `0xbb299a2c` |
| `submitRequest` | `0xf91ba7cc` |
| `transferOwnership` | `0xf2fde38b` |
| `updateRequestAndProcessBatch` | `0x46464471` |
| `watcher__` | `0x300bb063` |
Expand Down Expand Up @@ -455,14 +455,14 @@
| `ownershipHandoverExpiresAt` | `0xfee81cf4` |
| `payloadQueue` | `0x74f00ffb` |
| `promiseResolver__` | `0xdee152be` |
| `queue` | `0xf03ca7f7` |
| `queueAndSubmit` | `0xf0fb9665` |
| `queue` | `0x65967f1a` |
| `queueAndSubmit` | `0x9d4c9df7` |
| `renounceOwnership` | `0x715018a6` |
| `requestHandler__` | `0x55184561` |
| `requestOwnershipHandover` | `0x25692962` |
| `rescueFunds` | `0xa58c6fc5` |
| `setCoreContracts` | `0xefa891c4` |
| `setIsValidPlug` | `0x7fc82ff6` |
| `setIsValidPlug` | `0x06c0a40a` |
| `setTriggerFees` | `0xaeb30511` |
| `submitRequest` | `0x4890b5ef` |
| `transferOwnership` | `0xf2fde38b` |
Expand Down Expand Up @@ -506,7 +506,7 @@
| `resolvePayload` | `0xea92e825` |
| `setExpiryTime` | `0x30fc4cff` |
| `setFees` | `0x3d18678e` |
| `validateAndGetPrecompileData` | `0xab172aab` |
| `validateAndGetPrecompileData` | `0x997f5bef` |
| `watcher__` | `0x300bb063` |

## SchedulePrecompile
Expand All @@ -525,7 +525,7 @@
| `setMaxScheduleDelayInSeconds` | `0x12953318` |
| `setScheduleCallbackFees` | `0xec8fd71e` |
| `setScheduleFeesPerSecond` | `0x28e59e57` |
| `validateAndGetPrecompileData` | `0xab172aab` |
| `validateAndGetPrecompileData` | `0x997f5bef` |
| `watcher__` | `0x300bb063` |

## WritePrecompile
Expand All @@ -538,7 +538,7 @@
| `contractFactoryPlugs` | `0x35426631` |
| `digestHashes` | `0xd1a862bf` |
| `expiryTime` | `0x99bc0aea` |
| `getDigest` | `0xdd4bf97b` |
| `getDigest` | `0x91b6288b` |
| `getPrecompileFees` | `0xb7a3d04c` |
| `getPrevBatchDigestHash` | `0x372863a1` |
| `handlePayload` | `0x1d5e1d98` |
Expand All @@ -549,13 +549,13 @@
| `requestOwnershipHandover` | `0x25692962` |
| `rescueFunds` | `0x6ccae054` |
| `resolvePayload` | `0xea92e825` |
| `setContractFactoryPlugs` | `0xc067b6dd` |
| `setContractFactoryPlugs` | `0x8b198f5c` |
| `setExpiryTime` | `0x30fc4cff` |
| `setFees` | `0x3d18678e` |
| `transferOwnership` | `0xf2fde38b` |
| `updateChainMaxMsgValueLimits` | `0x6a7aa6ac` |
| `uploadProof` | `0x81b48fcf` |
| `validateAndGetPrecompileData` | `0xab172aab` |
| `validateAndGetPrecompileData` | `0x997f5bef` |
| `watcherProofs` | `0x3fa3166b` |
| `watcher__` | `0x300bb063` |
| `writeFees` | `0x5c664aeb` |
9 changes: 5 additions & 4 deletions contracts/evmx/base/AppGatewayBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import "../interfaces/IPromise.sol";
import {InvalidPromise, AsyncModifierNotSet} from "../../utils/common/Errors.sol";
import {FAST, READ, WRITE, SCHEDULE} from "../../utils/common/Constants.sol";
import {IsPlug, QueueParams, Read, WriteFinality, Parallel} from "../../utils/common/Structs.sol";
import {toBytes32Format} from "../../utils/common/Converters.sol";

/// @title AppGatewayBase
/// @notice Abstract contract for the app gateway
Expand Down Expand Up @@ -137,7 +138,7 @@ abstract contract AppGatewayBase is AddressResolverUtil, IAppGateway {
function setAddress(bytes memory data_, bytes memory returnData_) external onlyPromises {
(uint32 chainSlug, bytes32 contractId) = abi.decode(data_, (uint32, bytes32));
forwarderAddresses[contractId][chainSlug] = asyncDeployer__().getOrDeployForwarderContract(
abi.decode(returnData_, (address)),
toBytes32Format(abi.decode(returnData_, (address))),
chainSlug
);
}
Expand All @@ -161,9 +162,9 @@ abstract contract AppGatewayBase is AddressResolverUtil, IAppGateway {
function getOnChainAddress(
bytes32 contractId_,
uint32 chainSlug_
) public view returns (address onChainAddress) {
) public view returns (bytes32 onChainAddress) {
if (forwarderAddresses[contractId_][chainSlug_] == address(0)) {
return address(0);
return bytes32(0);
}

onChainAddress = IForwarder(forwarderAddresses[contractId_][chainSlug_])
Expand Down Expand Up @@ -216,7 +217,7 @@ abstract contract AppGatewayBase is AddressResolverUtil, IAppGateway {
/// @param isValid Boolean flag indicating whether the contract is authorized (true) or not (false)
/// @dev This function retrieves the onchain address using the contractId_ and chainSlug, then calls the watcher precompile to update the plug's validity status
function _setValidPlug(bool isValid, uint32 chainSlug_, bytes32 contractId_) internal {
address onchainAddress = getOnChainAddress(contractId_, chainSlug_);
bytes32 onchainAddress = getOnChainAddress(contractId_, chainSlug_);
watcher__().setIsValidPlug(isValid, chainSlug_, onchainAddress);
}

Expand Down
Loading