-
Notifications
You must be signed in to change notification settings - Fork 166
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feat/use_gmp_executable
- Loading branch information
Showing
30 changed files
with
912 additions
and
567 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,7 @@ | ||
EVM_PRIVATE_KEY=YOUR_PRIVATE_KEY_HERE | ||
|
||
# For amplifier examples | ||
GMP_API_URL= | ||
ENVIRONMENT= # e.g. devnet-amplifier, testnet, or mainnet | ||
CRT_PATH= # e.g. './client.crt' | ||
KEY_PATH= # e.g. './client.key' |
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 |
---|---|---|
|
@@ -17,3 +17,6 @@ chain-config/*.json | |
!./**/artifacts/send_receive.wasm | ||
|
||
.multiversx | ||
|
||
*.crt | ||
*.key |
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,14 @@ | ||
{ | ||
"devnet-amplifier": [ | ||
{ | ||
"name": "avalanche-fuji", | ||
"rpc": "https://rpc.ankr.com/avalanche_fuji", | ||
"gateway": "0xF128c84c3326727c3e155168daAa4C0156B87AD1" | ||
}, | ||
{ | ||
"name": "xrpl-evm-sidechain", | ||
"rpc": "https://rpc-evm-sidechain.xrpl.org", | ||
"gateway": "0x48CF6E93C4C1b014F719Db2aeF049AA86A255fE2" | ||
} | ||
] | ||
} |
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,58 @@ | ||
const fs = require('fs'); | ||
const https = require('https'); | ||
const dotenv = require('dotenv'); | ||
|
||
// Load environment variables from .env file | ||
dotenv.config(); | ||
|
||
// Load the certificate and key | ||
const cert = fs.readFileSync(process.env.CRT_PATH); | ||
const key = fs.readFileSync(process.env.KEY_PATH); | ||
|
||
// Default configuration values | ||
const defaults = { | ||
// gRPC | ||
HOST: 'localhost', | ||
PORT: '50051', | ||
|
||
// GMP API | ||
GMP_API_URL: 'http://localhost:8080', | ||
}; | ||
|
||
const chainsConfigFile = JSON.parse(fs.readFileSync('./examples/amplifier/config/chains.json', 'utf8')); | ||
const environment = process.env.ENVIRONMENT; | ||
const chainsConfig = chainsConfigFile[environment]; | ||
|
||
function getConfig() { | ||
const serverHOST = process.env.HOST || defaults.HOST; | ||
const serverPort = process.env.PORT || defaults.PORT; | ||
|
||
const gmpAPIURL = process.env.GMP_API_URL || defaults.GMP_API_URL; | ||
|
||
return { | ||
serverHOST, | ||
serverPort, | ||
gmpAPIURL, | ||
chains: chainsConfig, | ||
httpsAgent: new https.Agent({ | ||
cert, | ||
key, | ||
rejectUnauthorized: false, | ||
}), | ||
}; | ||
} | ||
|
||
function getChainConfig(chainName) { | ||
const chainConfig = chainsConfig.find((c) => c.name === chainName); | ||
|
||
if (!chainConfig) { | ||
throw new Error(`RPC URL not found for chain: ${chainName}`); | ||
} | ||
|
||
return chainConfig; | ||
} | ||
|
||
module.exports = { | ||
getConfig, | ||
getChainConfig, | ||
}; |
1 change: 1 addition & 0 deletions
1
examples/amplifier/config/latestTasks/latestTask-xrpl-evm-sidechain.json
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 @@ | ||
"01924dc4-698e-7ad2-9f9b-0bad962771ef" |
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,42 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.0; | ||
|
||
import { AxelarExecutable } from '@axelar-network/axelar-gmp-sdk-solidity/contracts/executable/AxelarExecutable.sol'; | ||
import { IAxelarGateway } from '@axelar-network/axelar-gmp-sdk-solidity/contracts/interfaces/IAxelarGateway.sol'; | ||
|
||
/** | ||
* @title AmplifierGMPTest | ||
* @notice Send a message from chain A to chain B and stores gmp message | ||
*/ | ||
contract AmplifierGMPTest is AxelarExecutable { | ||
string public message; | ||
string public sourceChain; | ||
string public sourceAddress; | ||
|
||
constructor(address _gateway) AxelarExecutable(_gateway) {} | ||
|
||
/** | ||
* @notice Send message from chain A to chain B | ||
* @dev message param is passed in as gmp message | ||
* @param destinationChain name of the dest chain (ex. "Fantom") | ||
* @param destinationAddress address on dest chain this tx is going to | ||
* @param _message message to be sent | ||
*/ | ||
function setRemoteValue(string calldata destinationChain, string calldata destinationAddress, string calldata _message) external { | ||
bytes memory payload = abi.encode(_message); | ||
gateway.callContract(destinationChain, destinationAddress, payload); | ||
} | ||
|
||
/** | ||
* @notice logic to be executed on dest chain | ||
* @dev this is triggered automatically by relayer | ||
* @param _sourceChain blockchain where tx is originating from | ||
* @param _sourceAddress address on src chain where tx is originating from | ||
* @param _payload encoded gmp message sent from src chain | ||
*/ | ||
function _execute(string calldata _sourceChain, string calldata _sourceAddress, bytes calldata _payload) internal override { | ||
(message) = abi.decode(_payload, (string)); | ||
sourceChain = _sourceChain; | ||
sourceAddress = _sourceAddress; | ||
} | ||
} |
Oops, something went wrong.