Skip to content

Commit

Permalink
Fix read me
Browse files Browse the repository at this point in the history
  • Loading branch information
schnetzlerjoe committed Mar 29, 2023
1 parent aa1f925 commit b2c2125
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 47 deletions.
2 changes: 0 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ DOCKER_BUF := $(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace bu
### Install ###
###############################################################################
install:
@echo "---> Installing axelar"
@bash ./network/axelar/axelar.sh
@echo "---> Installing Hermes relayer"
@bash ./network/hermes/install.sh
@echo "---> Installing Agoric SDK"
Expand Down
72 changes: 27 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,21 @@
# Axelar Transfer Contract
# Axelar EVM Cross Chain Messaging Contract

This repo holds the Agoric smart contract for interacting with the Axelar cross-chain protocol through Agoric for cross-chain asset transfers and cross-chain messaging (once supported) for EVM chains supported by Axelar.
This repo holds the Agoric smart contract for interacting with the Axelar cross-chain mesaging protocol within Agoric smart contracts allowing for cross-chain messaging across the dozens of EVM chains supported by Axelar.

## Getting Started
You will need to have Golang, NodeJS and Rust installed to get started.

## Installation & Setup

```sh
cd $HOME
git clone https://github.com/pitalco/interaccounts
cd interaccounts
agoric install

```bash
cd $HOME
git clone https://github.com/pitalco/axelar-transfer
cd axelar-transfer
agoric install

# Install all required software. Agoric, Axelar, and Hermes Relayer
make install

# Initialize everything needed
make init
# install all dependencies
agoric install

# Start a local Agoric chain. Wait for the chain to start spitting out blocks. Keep running and go to a new terminal.
agoric start local-chain --reset
Expand All @@ -33,40 +26,10 @@ agoric open --repl
# start the repl/ag-solo. Wait for the wallet to fully launch!!!! Keep running in terminal.
agoric start local-solo --reset

# In another terminal start a local Axelar chain. Will log to log file in Axelar directory
make start

# Wait for the chains to start up by checking logs. When producing blocks run this IN ANOTHER NEW TERMINAL to start axelar local evm mock chains. Keep running
cd ~/axelar-transfer/axelar-local-gmp-examples
npm run build
node scripts/createLocal

# then in a free terminal run this to start up the Axelar tofnd process
make start-tofnd

# Finally start the vald Axelar process
make start-vald

# Then start hermes relayer. Will log everything in hermes.log file
make start-rly
```

## Deploying the Interaccounts Contract

Lets deploy the dependency contract to Zoe so we can use it for our Axelar contract. Move back to an open terminal and run the following commands
```sh
# Make sure you are in the linked interaccounts base directory
cd $HOME/interaccounts/contract

agoric deploy ./deploy.js
```

Lets save the installation on our name board. In the repl, run:
```javascript
installation = E(home.board).getValue(Installation_ID)
E(home.myAddressNameAdmin).default("interaccounts", installation)
```

## Deploying the Axelar Contract

Now lets deploy the Axelar contract
Expand All @@ -90,8 +53,27 @@ instance = E(home.zoe).startInstance(installation)
// Lets initialize Axelar and get the Axelar facet
axelar = E(instance.publicFacet).setupAxelar(zoe, myAddressNameAdmin, port2, controllerConnectionId, hostConnectionId)

// Lets create a deposit address on Axelar to bridge to Avalanche
E(axelar).bridgeToEVM("Ethereum", "0x2b9b278Ed8754112ba6317EB277b46662B2bC365", "ubld");
// create metadata (note you have to abi encode payload)
let payload = "0x000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000104d79206e616d65206973204d6f72672e00000000000000000000000000000000"

/** @type {Metadata} */
const metadata = {
sender: "agoric1",
payload,
type: 1,
destChain: "Polygon",
destAddress: "0xb94D8A2f5CAE9A94A8D4364bA2d4c77e87219ff9"
}

// Lets send a GMP message
await E(axelar).sendGMP(
zoe,
localPurseP,
peg,
'axelar1',
1000000n / 4n,
metadata
);
```

Send the assets to the deposit address on `Axelar` using the Pegasus contract, and let Axelar handle the rest!
Axelar will now take the message and handle the rest running it on the desination chain (Polygon here)!

0 comments on commit b2c2125

Please sign in to comment.