-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* refactor and enhance testing utilities * fix WormholeOverride.sign() by using provided params * enable decodeDeposit from bytes directly * further cleanup refactor and extend README * fix formating
- Loading branch information
1 parent
fa2dc15
commit 189fd62
Showing
30 changed files
with
1,285 additions
and
1,370 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,10 +28,18 @@ forge install wormhole-foundation/[email protected] | |
|
||
**EVM Version** | ||
|
||
One hazard of developing EVM contracts in a cross-chain environment is that different chains have varying levels EVM-equivalence. This means you have to ensure that all chains that you are planning to deploy to support all EIPs/opcodes that you rely on. | ||
One hazard of developing EVM contracts in a cross-chain environment is that different chains have varying levels of "EVM-equivalence". This means you have to ensure that all chains that you are planning to deploy to support all EIPs/opcodes that you rely on. | ||
|
||
For example, if you are using a solc version newer than `0.8.19` and are planning to deploy to a chain that does not support [PUSH0 opcode](https://eips.ethereum.org/EIPS/eip-3855) (introduced as part of the Shanghai hardfork), you should set `evm_version = "paris"` in your `foundry.toml`, since the default EVM version of solc was advanced from Paris to Shanghai as part of solc's `0.8.20` release. | ||
|
||
**Testing** | ||
|
||
It is strongly recommended that you run the forge test suite of this SDK with your own compiler version to catch potential errors that stem from differences in compiler versions early. Yes, strictly speaking the Solidity version pragma should prevent these issues, but better to be safe than sorry, especially given that some components make extensive use of inline assembly. | ||
|
||
**IERC20 Remapping** | ||
|
||
This SDK comes with its own IERC20 interface. Given that projects tend to combine different SDKs, there's often this annoying issue of clashes of IERC20 interfaces, even though the are effectively the same. We handle this issue by importing `IERC20/IERC20.sol` which allows remapping the `IERC20/` prefix to whatever directory contains `IERC20.sol` in your project, thus providing an override mechanism that should allow dealing with this problem seamlessly until forge allows remapping of individual files. | ||
|
||
## Philosophy/Creeds | ||
|
||
In This House We Believe: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,76 @@ | ||
/* | ||
* Copyright (c) 2022, Circle Internet Financial Limited. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
// SPDX-License-Identifier: Apache 2 | ||
// Copyright (c) 2022, Circle Internet Financial Limited. | ||
// | ||
// stripped, flattened version of: | ||
// https://github.com/circlefin/evm-cctp-contracts/blob/master/src/MessageTransmitter.sol | ||
|
||
pragma solidity ^0.8.0; | ||
|
||
import "./IRelayer.sol"; | ||
import "./IReceiver.sol"; | ||
import {IOwnable2Step} from "./shared/IOwnable2Step.sol"; | ||
import {IPausable} from "./shared/IPausable.sol"; | ||
|
||
interface IAttestable { | ||
event AttesterEnabled(address indexed attester); | ||
event AttesterDisabled(address indexed attester); | ||
|
||
event SignatureThresholdUpdated(uint256 oldSignatureThreshold, uint256 newSignatureThreshold); | ||
event AttesterManagerUpdated( | ||
address indexed previousAttesterManager, | ||
address indexed newAttesterManager | ||
); | ||
|
||
function attesterManager() external view returns (address); | ||
function isEnabledAttester(address attester) external view returns (bool); | ||
function getNumEnabledAttesters() external view returns (uint256); | ||
function getEnabledAttester(uint256 index) external view returns (address); | ||
|
||
function updateAttesterManager(address newAttesterManager) external; | ||
function setSignatureThreshold(uint256 newSignatureThreshold) external; | ||
function enableAttester(address attester) external; | ||
function disableAttester(address attester) external; | ||
} | ||
|
||
interface IMessageTransmitter is IAttestable, IPausable, IOwnable2Step { | ||
event MessageSent(bytes message); | ||
|
||
event MessageReceived( | ||
address indexed caller, | ||
uint32 sourceDomain, | ||
uint64 indexed nonce, | ||
bytes32 sender, | ||
bytes messageBody | ||
); | ||
|
||
function localDomain() external view returns (uint32); | ||
function version() external view returns (uint32); | ||
function maxMessageBodySize() external view returns (uint256); | ||
function nextAvailableNonce() external view returns (uint64); | ||
function usedNonces(bytes32 nonce) external view returns (bool); | ||
|
||
function sendMessage( | ||
uint32 destinationDomain, | ||
bytes32 recipient, | ||
bytes calldata messageBody | ||
) external returns (uint64); | ||
|
||
function sendMessageWithCaller( | ||
uint32 destinationDomain, | ||
bytes32 recipient, | ||
bytes32 destinationCaller, | ||
bytes calldata messageBody | ||
) external returns (uint64); | ||
|
||
function replaceMessage( | ||
bytes calldata originalMessage, | ||
bytes calldata originalAttestation, | ||
bytes calldata newMessageBody, | ||
bytes32 newDestinationCaller | ||
) external; | ||
|
||
/** | ||
* @title IMessageTransmitter | ||
* @notice Interface for message transmitters, which both relay and receive messages. | ||
*/ | ||
interface IMessageTransmitter is IRelayer, IReceiver { | ||
function receiveMessage( | ||
bytes calldata message, | ||
bytes calldata attestation | ||
) external returns (bool success); | ||
|
||
function setMaxMessageBodySize(uint256 newMaxMessageBodySize) external; | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.