-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1a2c31e
commit b603c12
Showing
14 changed files
with
183 additions
and
55 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 |
---|---|---|
|
@@ -13,3 +13,8 @@ GOBIN=$output_bin_dir go install github.com/ferranbt/fastssz/[email protected] | |
|
||
$bridge_scripts/build-ethereum-node.sh | ||
$bridge_scripts/build-relayer.sh | ||
$bridge_scripts/build-symbiotic-contracts.sh | ||
|
||
pushd $ts_scripts_dir | ||
pnpm install | ||
popd |
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
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
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
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
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,26 @@ | ||
#!/bin/bash | ||
|
||
# Exit on any error | ||
set -e | ||
|
||
scripts_path="$(realpath ./scripts/bridge)" | ||
|
||
source $scripts_path/set-env.sh | ||
|
||
echo "Building symbiotic contracts" | ||
|
||
echo "Checkout Symbiotic contract repository" | ||
|
||
if [ -d "$symbiotic_contracts_dir" ]; | ||
then | ||
echo "Symbiotic contract repository seems to be already setup. Skipping git fetch" | ||
else | ||
git clone https://github.com/moondance-labs/tanssi-symbiotic $symbiotic_contracts_dir | ||
pushd $symbiotic_contracts_dir | ||
git fetch && git checkout 518f7e9d0059d24d899d2fc8340da5387a127b3b | ||
popd | ||
fi | ||
|
||
pushd $symbiotic_contracts_dir | ||
forge build | ||
popd |
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
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,17 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eu | ||
|
||
scripts_path="$(realpath ./scripts/bridge)" | ||
source $scripts_path/set-env.sh | ||
|
||
pushd "$ts_scripts_dir" > /dev/null | ||
contract_dir="$artifacts_dir/relayer/contracts" deploy_script="DeployLocal.sol" pnpm generateContracts "$output_dir/snowbridge_contracts.json" > /dev/null | ||
contract_dir="$artifacts_dir/tanssi-symbiotic" deploy_script="DeployTanssiEcosystemDemo.s.sol" pnpm generateContracts "$output_dir/symbiotic_contracts.json" > /dev/null | ||
popd > /dev/null | ||
|
||
# Output the file so that invoker can read it | ||
snowbridge_info=$(cat "$output_dir/snowbridge_contracts.json") | ||
symbiotic_info=$(cat "$output_dir/symbiotic_contracts.json") | ||
|
||
echo "{ \"snowbridge_info\": $snowbridge_info, \"symbiotic_info\": $symbiotic_info, \"ethereum_key\": \"$ethereum_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
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
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,13 @@ | ||
{ | ||
"name": "@tanssi-symbiotic/test-helpers", | ||
"version": "1.0.0", | ||
"description": "Tanssi symbiotic test helpers", | ||
"license": "Apache-2.0", | ||
"scripts": { | ||
"generateContracts": "npx tsx src/generateContractInfo.ts" | ||
}, | ||
"dependencies": { | ||
"@types/node": "^18.16.8", | ||
"tsx": "^4.19.2" | ||
} | ||
} |
51 changes: 51 additions & 0 deletions
51
test/scripts/bridge/ts-scripts/src/generateContractInfo.ts
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,51 @@ | ||
import fs from "node:fs" | ||
import path from "node:path" | ||
|
||
const run = async () => { | ||
const NetworkId = process.env.ETH_NETWORK_ID || 11155111 | ||
const basedir = process.env.contract_dir || "../contracts" | ||
const DeployInfoFile = path.join( | ||
basedir, | ||
'broadcast', | ||
process.env.deploy_script, | ||
`${NetworkId}/run-latest.json` | ||
) | ||
const BuildInfoDir = path.join(basedir, "./out") | ||
const DestFile = | ||
process.argv.length >= 3 ? process.argv[2] : process.env["output_dir"] + "/contracts.json" | ||
type Contract = { | ||
[key: string]: ContractInfo | ||
} | ||
let contracts: Contract = {} | ||
const deploymentInfo = JSON.parse(fs.readFileSync(DeployInfoFile, "utf8")) | ||
type ContractInfo = { | ||
abi?: object | ||
address?: string | ||
} | ||
for (let transaction of deploymentInfo.transactions) { | ||
if (transaction.transactionType === "CREATE") { | ||
let contractName: string = transaction.contractName | ||
if (contractName) { | ||
let contractInfo: ContractInfo = { address: transaction.contractAddress } | ||
let contractBuildingInfo = JSON.parse( | ||
fs.readFileSync( | ||
path.join(BuildInfoDir, contractName + ".sol", contractName + ".json"), | ||
"utf8" | ||
) | ||
) | ||
contractInfo.abi = contractBuildingInfo.abi | ||
contracts[contractName] = contractInfo | ||
} | ||
} | ||
} | ||
fs.writeFileSync(DestFile, JSON.stringify({ contracts }, null, 2), "utf8") | ||
} | ||
|
||
run() | ||
.then(() => { | ||
console.log("Contract File generated successfully") | ||
process.exit(0) | ||
}) | ||
.catch((err) => { | ||
console.error(err) | ||
}) |
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