generated from evan-gray/multichain-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* forge install: wormhole-solidity-sdk v0.1.0 * EVM: Add wormhole transceiver * Code review rework * Pick up new router interfaces * evm: Use create2 * evm: Set up compiler version * Code review rework
- Loading branch information
1 parent
54bf202
commit 5a271c1
Showing
21 changed files
with
1,347 additions
and
66 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
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,3 +1,9 @@ | ||
[submodule "evm/lib/forge-std"] | ||
path = evm/lib/forge-std | ||
url = https://github.com/foundry-rs/forge-std | ||
[submodule "evm/lib/wormhole-solidity-sdk"] | ||
path = evm/lib/wormhole-solidity-sdk | ||
url = https://github.com/wormhole-foundation/wormhole-solidity-sdk | ||
[submodule "evm/lib/example-gmp-router"] | ||
path = evm/lib/example-gmp-router | ||
url = https://github.com/wormholelabs-xyz/example-gmp-router |
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
Submodule example-gmp-router
added at
633b4d
Submodule wormhole-solidity-sdk
added at
b9e129
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity ^0.8.19; | ||
|
||
import {WormholeTransceiver, wormholeTransceiverVersionString} from "../src/WormholeTransceiver.sol"; | ||
import "forge-std/Script.sol"; | ||
|
||
// DeployWormholeTransceiver is a forge script to deploy the WormholeTransceiver contract. Use ./sh/deployWormholeTransceiver.sh to invoke this. | ||
contract DeployWormholeTransceiver is Script { | ||
function test() public {} // Exclude this from coverage report. | ||
|
||
function dryRun( | ||
uint16 ourChain, | ||
uint256 evmChain, | ||
address admin, | ||
address router, | ||
address wormhole, | ||
uint8 consistencyLevel | ||
) public { | ||
_deploy(ourChain, evmChain, admin, router, wormhole, consistencyLevel); | ||
} | ||
|
||
function run( | ||
uint16 ourChain, | ||
uint256 evmChain, | ||
address admin, | ||
address router, | ||
address wormhole, | ||
uint8 consistencyLevel | ||
) public returns (address deployedAddress) { | ||
vm.startBroadcast(); | ||
(deployedAddress) = _deploy(ourChain, evmChain, admin, router, wormhole, consistencyLevel); | ||
vm.stopBroadcast(); | ||
} | ||
|
||
function _deploy( | ||
uint16 ourChain, | ||
uint256 evmChain, | ||
address admin, | ||
address router, | ||
address wormhole, | ||
uint8 consistencyLevel | ||
) internal returns (address deployedAddress) { | ||
bytes32 salt = keccak256(abi.encodePacked(wormholeTransceiverVersionString)); | ||
WormholeTransceiver wormholeTransceiver = | ||
new WormholeTransceiver{salt: salt}(ourChain, evmChain, admin, router, wormhole, consistencyLevel); | ||
|
||
return (address(wormholeTransceiver)); | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity ^0.8.19; | ||
|
||
import {WormholeTransceiver} from "../src/WormholeTransceiver.sol"; | ||
import "forge-std/Script.sol"; | ||
import "example-gmp-router/libraries/UniversalAddress.sol"; | ||
|
||
// ReceiveMsg is a forge script to receive a message on the WormholeTransceiver contract. Use ./sh/receiveMsg.sh to invoke this. | ||
contract ReceiveMsg is Script { | ||
function test() public {} // Exclude this from coverage report. | ||
|
||
function dryRun(address wormholeTransceiver, bytes calldata vaaBytes) public { | ||
_receiveMsg(wormholeTransceiver, vaaBytes); | ||
} | ||
|
||
function run(address wormholeTransceiver, bytes calldata vaaBytes) public { | ||
vm.startBroadcast(); | ||
_receiveMsg(wormholeTransceiver, vaaBytes); | ||
vm.stopBroadcast(); | ||
} | ||
|
||
function _receiveMsg(address wormholeTransceiver, bytes calldata vaaBytes) internal { | ||
WormholeTransceiver wormholeTransceiverContract = WormholeTransceiver(wormholeTransceiver); | ||
wormholeTransceiverContract.receiveMessage(vaaBytes); | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity ^0.8.19; | ||
|
||
import {WormholeTransceiver} from "../src/WormholeTransceiver.sol"; | ||
import "forge-std/Script.sol"; | ||
import "example-gmp-router/libraries/UniversalAddress.sol"; | ||
|
||
// SetPeer is a forge script to set the peer for a given chain with the WormholeTransceiver contract. Use ./sh/setPeer.sh to invoke this. | ||
contract SetPeer is Script { | ||
function test() public {} // Exclude this from coverage report. | ||
|
||
function dryRun(address wormholeTransceiver, uint16 peerChain, bytes32 peerAddress) public { | ||
_setPeer(wormholeTransceiver, peerChain, peerAddress); | ||
} | ||
|
||
function run(address wormholeTransceiver, uint16 peerChain, bytes32 peerAddress) public { | ||
vm.startBroadcast(); | ||
_setPeer(wormholeTransceiver, peerChain, peerAddress); | ||
vm.stopBroadcast(); | ||
} | ||
|
||
function _setPeer(address wormholeTransceiver, uint16 peerChain, bytes32 peerAddress) internal { | ||
WormholeTransceiver wormholeTransceiverContract = WormholeTransceiver(wormholeTransceiver); | ||
wormholeTransceiverContract.setPeer(peerChain, peerAddress); | ||
} | ||
} |
Oops, something went wrong.