diff --git a/README.md b/README.md index 23f6fa35..db1c0f6b 100644 --- a/README.md +++ b/README.md @@ -6,9 +6,9 @@ This starter kit will get you started with cross-Subnet smart contracts using Te - **Foundry**: - Forge: Compile and Deploy smart contracts to the local network, Fuji Testnet or Mainnet - Cast: Interact with these smart contracts -- **Teleporter**: All contracts you may to interact with Teleporter +- **Teleporter**: All contracts you may want to interact with Teleporter - **AWM Relayer**: The binary to run your own relayer -- **Examples**: Contracts showcasing how to achieve common patterns, such as sending simple messages, call functions of a contract on another blockchain and bridging assets. Please note that these example contracts have not audited and are for educational purposes only +- **Examples**: Contracts showcasing how to achieve common patterns, such as sending simple messages, call functions of a contract on another blockchain and bridging assets. Please note that these example contracts have not been audited and are for educational purposes only ## Set Up @@ -18,7 +18,7 @@ This starter kit utilizes a Dev Container specification. Dev Containers use cont You can run them directly on Github by clicking **Code**, switching to the **Codespaces** tab and clicking **Create codespace on main**. A new window will open that loads the codespace. Afterwards you will see a browser version of VS code with all the dependencies installed. Codespace time out after some time of inactivity, but can be restarted. -### Run locally +### Run Dev Container locally with Docker Alternatively, you can run them locally. You need [docker](https://www.docker.com/products/docker-desktop/) installed and [VS Code](https://code.visualstudio.com/) with the extensions [Dev Container extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers). Then clone the repository and open it in VS Code. VS Code will ask you if you want to reopen the project in a container. diff --git a/src/3-creating-contracts/BridgeReceiverOnSubnet.sol b/src/3-creating-contracts/BridgeReceiverOnSubnet.sol index 682ce914..22835867 100644 --- a/src/3-creating-contracts/BridgeReceiverOnSubnet.sol +++ b/src/3-creating-contracts/BridgeReceiverOnSubnet.sol @@ -14,6 +14,7 @@ import "./BridgeActions.sol"; contract TokenMinterReceiverOnBulletin is ITeleporterReceiver { TeleporterRegistry public immutable teleporterRegistry = TeleporterRegistry(0x827364Da64e8f8466c23520d81731e94c8DDe510); + address public tokenAddress; function receiveTeleporterMessage(bytes32, address, bytes calldata message) external { // Only a Teleporter Messenger registered in the registry can deliver a message. diff --git a/src/3-creating-contracts/BridgeSenderOnCChain.sol b/src/3-creating-contracts/BridgeSenderOnCChain.sol index 9d0a0038..b10e7d97 100644 --- a/src/3-creating-contracts/BridgeSenderOnCChain.sol +++ b/src/3-creating-contracts/BridgeSenderOnCChain.sol @@ -5,6 +5,7 @@ pragma solidity ^0.8.18; +import "@teleporter/upgrades/TeleporterRegistry.sol"; import "@teleporter/ITeleporterMessenger.sol"; import "./BridgeActions.sol"; @@ -33,7 +34,9 @@ contract ERC20MinterSenderOnCChain { } function sendMintTokenMessage(address destinationAddress, address to, uint256 amount) external { - teleporterMessenger.sendCrossChainMessage( + ITeleporterMessenger messenger = teleporterRegistry.getLatestTeleporter(); + + messenger.sendCrossChainMessage( TeleporterMessageInput({ destinationBlockchainID: 0xd7cdc6f08b167595d1577e24838113a88b1005b471a6c430d79c48b4c89cfc53, destinationAddress: destinationAddress, diff --git a/src/x-erc721-bridge/ERC721Bridge.sol b/src/x-erc721-bridge/ERC721Bridge.sol index 4c7ba42f..33b41953 100644 --- a/src/x-erc721-bridge/ERC721Bridge.sol +++ b/src/x-erc721-bridge/ERC721Bridge.sol @@ -59,7 +59,7 @@ contract ERC721Bridge is IERC721Bridge, TeleporterOwnerUpgradeable, IERC721Recei * @dev Initializes the Teleporter Messenger used for sending and receiving messages, * and initializes the current chain ID. */ - constructor(address teleporterRegistryAddress) TeleporterOwnerUpgradeable(teleporterRegistryAddress) { + constructor(address teleporterRegistryAddress) TeleporterOwnerUpgradeable(teleporterRegistryAddress, msg.sender) { currentBlockchainID = IWarpMessenger(WARP_PRECOMPILE_ADDRESS).getBlockchainID(); }