Skip to content

Commit

Permalink
Merge pull request #16 from wormhole-foundation/example-disclaimer
Browse files Browse the repository at this point in the history
disclaimer
  • Loading branch information
JoeHowarth authored Sep 18, 2023
2 parents 82fe9dc + d2d3bf2 commit e471ace
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ The purpose of this SDK is to provide helpers to take your existing single-chain
### Installation

**Foundry and Forge**

```bash
forge install wormhole-foundation/wormhole-solidity-sdk
```
Expand All @@ -19,15 +20,13 @@ forge install wormhole-foundation/wormhole-solidity-sdk

- Includes interfaces to interact with contracts in the Wormhole ecosystem (src/interfaces)
- Includes the base class ‘Base’ with helpers for common actions that will typically need to be done within ‘receiveWormholeMessages’:
- `onlyWormholeRelayer()`: Checking that msg.sender is the wormhole relayer contract
- `replayProtect(bytes32 deliveryHash)`: Checking that the current delivery has not already been processed (via the hash)

- `onlyWormholeRelayer()`: Checking that msg.sender is the wormhole relayer contract
- `replayProtect(bytes32 deliveryHash)`: Checking that the current delivery has not already been processed (via the hash)
Sometimes, Cross-chain applications may be set up such that there is one ‘spoke’ contract on every chain, which sends messages to the ‘hub’ contract. If so, we’d ideally only want to allow messages to be sent from these spoke contracts. Included are helpers for this:

- `setRegisteredSender(uint16 sourceChain, bytes32 sourceAddress)`: Setting the specified sender for ‘sourceChain’ to be ‘sourceAddress’
- `isRegisteredSender(uint16 sourceChain, bytes32 sourceAddress)` : Checking that the sender who requested the delivery is the registered address for that chain

- `setRegisteredSender(uint16 sourceChain, bytes32 sourceAddress)`: Setting the specified sender for ‘sourceChain’ to be ‘sourceAddress’
- `isRegisteredSender(uint16 sourceChain, bytes32 sourceAddress)` : Checking that the sender who requested the delivery is the registered address for that chain
Look at test/Counter.t.sol for an example usage of Base

- Included are also the ‘TokenSender’ and ‘TokenReceiver’ base classes with helpers for smart contracts that wish to send and receive tokens using Wormhole’s TokenBridge. See ‘HelloToken’ for example usage.
- Included are helpers that help set up a local forge testing environment. See ‘HelloWormhole’ for example usage.

**Note: This code is meant to be used as starter / reference code. Feel free to modify for use in your contracts, and also make sure to audit any code used from here as part of your contracts before deploying to mainnet.**

0 comments on commit e471ace

Please sign in to comment.