Skip to content

Commit

Permalink
rename paths for avalanche-starter-kit (#173)
Browse files Browse the repository at this point in the history
  • Loading branch information
owenwahlgren authored Oct 1, 2024
1 parent ae3a2ab commit e999eaf
Show file tree
Hide file tree
Showing 17 changed files with 27 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ Lets start by deploying our sender contract on C-Chain. It will be responsible f
<Step>
### Read the Sender Contract

The following contract is located inside `src/0-send-receive` directory. Read through the contract below and and understand what is happening:
The following contract is located inside `contracts/interchain-messaging/send-receive` directory. Read through the contract below and and understand what is happening:

```solidity title="src/0-send-receive/senderOnCChain.sol"
```solidity title="contracts/interchain-messaging/send-receive/senderOnCChain.sol"
// (c) 2023, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
Expand Down Expand Up @@ -127,7 +127,7 @@ contract SenderOnCChain {
To deploy a contract using Foundry use the following command:

```bash
forge create --rpc-url local-c --private-key $PK src/0-send-receive/senderOnCChain.sol:SenderOnCChain
forge create --rpc-url local-c --private-key $PK contracts/interchain-messaging/send-receive/senderOnCChain.sol:SenderOnCChain
```
```
[⠊] Compiling...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ Now it's time to deploy our receiver contract to our L1. It will implement the c

### Read the Receiver Contract

The following contract is located inside `src/0-send-receive` directory. Read through the contract below and and understand what is happening:
The following contract is located inside `contracts/interchain-messaging/send-receive` directory. Read through the contract below and and understand what is happening:

```solidity title="src/0-send-receive/receiverOnSubnet.sol"
```solidity title="contracts/interchain-messaging/send-receive/receiverOnSubnet.sol"
// (c) 2023, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
Expand Down Expand Up @@ -57,7 +57,7 @@ contract ReceiverOnSubnet is ITeleporterReceiver {
To deploy a contract using Foundry use the following command:

```bash
forge create --rpc-url myblockchain --private-key $PK src/0-send-receive/receiverOnSubnet.sol:ReceiverOnSubnet
forge create --rpc-url myblockchain --private-key $PK contracts/interchain-messaging/send-receive/receiverOnSubnet.sol:ReceiverOnSubnet
```
```
[⠊] Compiling...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ icon: Terminal

To create a deeper understanding of the concepts, now change the provided contracts. Instead of sending a string, now send a number and add up the numbers on the destination chain:

Once you finished with the assignment you can review the correct answer at `/src/0b-send-receive` in the [Avalanche-Starter-Kit](https://github.com/ava-labs/avalanche-starter-kit)
Once you finished with the assignment you can review the correct answer at `/contracts/interchain-messaging/send-receive-assignment-solution` in the [Avalanche-Starter-Kit](https://github.com/ava-labs/avalanche-starter-kit)
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ The sender contract has now two tasks:

Therefore, we need to change the sender contract to be able to receive a message back. We will need to implement the same interface `ITeleporterReceiver` as the receiver contract and implement the `receiveTeleporterMessage` function.

```solidity title="src/1-send-roundtrip/senderOnCChain.sol"
```solidity title="contracts/interchain-messaging/send-roundtrip/senderOnCChain.sol"
// (c) 2023, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Perform the changes on `senderOnCChain.sol` described in the [previous section.]
### Deploy the Sender Contract

```bash
forge create --rpc-url local-c --private-key $PK src/1-send-roundtrip/senderOnCChain.sol:SenderOnCChain
forge create --rpc-url local-c --private-key $PK contracts/interchain-messaging/send-roundtrip/senderOnCChain.sol:SenderOnCChain
```
```
[⠊] Compiling...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ The receiver contract now has two tasks:

Therefore, we need to change the receiver contract to be able to send a message back. We will need to instantiate a `TeleporterMessenger` and call the `sendCrossChainMessage()` function.

```solidity title="src/1-send-roundtrip/receiverOnSubnet.sol"
```solidity title="contracts/interchain-messaging/send-roundtrip/receiverOnSubnet.sol"
// (c) 2023, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Go ahead and deploy the receiver contract:
### Deploy the Receiver Contract

```bash
forge create --rpc-url myblockchain --private-key $PK src/1-send-roundtrip/receiverOnSubnet.sol:ReceiverOnSubnet
forge create --rpc-url myblockchain --private-key $PK contracts/interchain-messaging/send-roundtrip/receiverOnSubnet.sol:ReceiverOnSubnet
```
```
[⠊] Compiling...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ To increase the readability of the code, we have created a helper function `enco
Deploy the sender contract on the Local C-Chain:

```bash
forge create --rpc-url local-c --private-key $PK src/2a-invoking-functions/SimpleCalculatorSenderOnCChain.sol:SimpleCalculatorSenderOnCChain
forge create --rpc-url local-c --private-key $PK contracts/interchain-messaging/invoking-functions/SimpleCalculatorSenderOnCChain.sol:SimpleCalculatorSenderOnCChain
```
```
[⠊] Compiling...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ contract SimpleCalculatorReceiverOnSubnet is ITeleporterReceiver {
Deploy the receiver contract on your Avalanche L1:

```bash
forge create --rpc-url myblockchain --private-key $PK src/2a-invoking-functions/SimpleCalculatorReceiverOnSubnet.sol:SimpleCalculatorReceiverOnSubnet
forge create --rpc-url myblockchain --private-key $PK contracts/interchain-messaging/invoking-functions/SimpleCalculatorReceiverOnSubnet.sol:SimpleCalculatorReceiverOnSubnet
```

```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ For the add function we need to encode two numbers. For the concatenate function

The first step is to create a `CalculatorAction` enum that specifies the different functions that can be called on the calculator.

```solidity title="src/2b-invoking-functions/CalculatorActions.sol"
```solidity title="contracts/interchain-messaging/invoking-functions/CalculatorActions.sol"
pragma solidity ^0.8.18;
enum CalculatorAction {
Expand All @@ -28,7 +28,7 @@ enum CalculatorAction {

In the next step we can add this to our `encode helpers` in the sender contract:

```solidity title="src/2b-invoking-functions/CalculatorSenderOnCChain.sol"
```solidity title="contracts/interchain-messaging/invoking-functions/CalculatorSenderOnCChain.sol"
pragma solidity ^0.8.18;
import "@teleporter/ITeleporterMessenger.sol";
Expand Down Expand Up @@ -85,7 +85,7 @@ As you can see here we are calling `abi.encode` twice in the encode helpers. The

Let's now look at the receiver:

```solidity title="src/2b-invoking-functions/CalculatorReceiverOnSubnet.sol"
```solidity title="contracts/interchain-messaging/invoking-functions/CalculatorReceiverOnSubnet.sol"
pragma solidity ^0.8.18;
import "@teleporter/ITeleporterMessenger.sol";
Expand Down Expand Up @@ -179,7 +179,7 @@ Deploy the sender and receiver contracts and try out the `add` and `concatenate`
<Callout type="warn" title="Don't forget to replace BOTH destinationBlockchainIDs in CalculatorSenderOnCChain with the Blockchain ID (HEX) from your Avalanche L1!" />

```bash
forge create --rpc-url local-c --private-key $PK src/2b-invoking-functions/CalculatorSenderOnCChain.sol:CalculatorSenderOnCChain
forge create --rpc-url local-c --private-key $PK contracts/interchain-messaging/invoking-functions/CalculatorSenderOnCChain.sol:CalculatorSenderOnCChain
```
```
[⠃] Compiling...
Expand All @@ -206,7 +206,7 @@ export SENDER_ADDRESS=0x8B3BC4270BE2abbB25BC04717830bd1Cc493a461
### Deploy the Receiver Contract:

```bash
forge create --rpc-url myblockchain --private-key $PK src/2b-invoking-functions/CalculatorReceiverOnSubnet.sol:CalculatorReceiverOnSubnet
forge create --rpc-url myblockchain --private-key $PK contracts/interchain-messaging/invoking-functions/CalculatorReceiverOnSubnet.sol:CalculatorReceiverOnSubnet
```
```
[⠊] Compiling...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ You will need to:
- Add a new encode helper and send function to the sender contract
- Add a new route to the receiver and implement the `tripleSum` function

Check out the solution under `/src/2c-invoking-functions` on the Avalanche-Starter-Kit
Check out the solution under `/contracts/interchain-messaging/2c-invoking-functions` on the Avalanche-Starter-Kit
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ icon: BookOpen

Let's now integrate the registry into a smart contract. Let's go back to the very simple string sending contract from the beginning:

```solidity title="src/3-registry/SenderOnCChainWithRegistry.sol"
```solidity title="contracts/interchain-messaging/registry/SenderOnCChainWithRegistry.sol"
pragma solidity ^0.8.18;
import "@teleporter/upgrades/TeleporterRegistry.sol"; // [!code highlight]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Now that we have an ERC20 token deployed and some of those tokens in our account

In the following contract, make sure to update `destinationBlockchainID` with your current deployment

```solidity title="src/9-incentivize-relayer/senderWithFees.sol"
```solidity title="contracts/interchain-messaging/incentivize-relayer/senderWithFees.sol"
// (c) 2023, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Now we have all the Smart Contract 📜 set we can start sending incentivized cr
To deploy the sender contract run:

```bash
forge create --rpc-url local-c --private-key $PK src/9-incentivize-relayer/senderWithFees.sol:SenderWithFeesOnCChain
forge create --rpc-url local-c --private-key $PK contracts/interchain-messaging/incentivize-relayer/senderWithFees.sol:SenderWithFeesOnCChain
```
```
[⠊] Compiling...
Expand Down Expand Up @@ -50,7 +50,7 @@ export SENDER_ADDRESS=0xa4DfF80B4a1D748BF28BC4A271eD834689Ea3407
Now, deploy the receiver contract.

```bash
forge create --rpc-url myblockchain --private-key $PK src/9-incentivize-relayer/receiverWithFees.sol:ReceiverOnSubnet
forge create --rpc-url myblockchain --private-key $PK contracts/interchain-messaging/incentivize-relayer/receiverWithFees.sol:ReceiverOnSubnet
```
```
[⠊] Compiling...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import { Step, Steps } from 'fumadocs-ui/components/steps';

### Deploy an ERC-20 Token

To transfer an ERC20 token from C-chain to your own blockchain, the fist thing we will need is the ERC20 token to bridge. You will find a contract in the Starter-Kit under src/8-erc20-to-erc20-interchain-token-transfer/ERC20.sol:TOK of the Starter-kit
To transfer an ERC20 token from C-chain to your own blockchain, the fist thing we will need is the ERC20 token to bridge. You will find a contract in the Starter-Kit under `contracts/interchain-token-transfer/MyToken.sol:TOK` of the Starter-kit

```bash
forge create --rpc-url local-c --private-key $PK src/8-erc20-to-erc20-interchain-token-transfer/ERC20.sol:TOK
forge create --rpc-url local-c --private-key $PK contracts/interchain-token-transfer/MyToken.sol:TOK
```

</Step>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { Step, Steps } from 'fumadocs-ui/components/steps';
### Deploy Wrapped Native Token `ExampleWNATV`

```bash
forge create --rpc-url myblockchain --private-key $PK src/5-native-to-erc20-interchain-token-transfer/ExampleWNATV.sol:WNATV
forge create --rpc-url myblockchain --private-key $PK contracts/interchain-token-transfer/ExampleWNATV.sol:WNATV
```
```
[⠊] Compiling...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ While deploying the wrapped exchange contract, you will need to send two constru
- The second argument is the Trader Joe's (or any other Uniswap V2-like dapp) Factory V1 contract address on the destination chain (Fuji), which is: [`0xF5c7d9733e5f53abCC1695820c4818C59B457C2C`](https://testnet.snowtrace.io/address/0xF5c7d9733e5f53abCC1695820c4818C59B457C2C). Deployed contracts of TraderJoe can be found [here](https://docs.traderjoexyz.com/deployment-addresses/fuji).

```bash
forge create --rpc-url local-c --private-key $PK src/10-cross-chain-token-swaps/DexERC20Wrapper.sol:DexERC20Wrapper --constructor-args 0xd00ae08403B9bbb9124bB305C09058E32C39A48c 0xF5c7d9733e5f53abCC1695820c4818C59B457C2C
forge create --rpc-url local-c --private-key $PK contracts/interchain-token-transfer/cross-chain-token-swaps/DexERC20Wrapper.sol:DexERC20Wrapper --constructor-args 0xd00ae08403B9bbb9124bB305C09058E32C39A48c 0xF5c7d9733e5f53abCC1695820c4818C59B457C2C
```

</Step>
Expand Down

0 comments on commit e999eaf

Please sign in to comment.