-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #215 from movementlabsxyz/eng-546-atomic-bridge
ENG 546 atomic bridge
- Loading branch information
Showing
82 changed files
with
7,177 additions
and
1,034 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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#!/bin/bash | ||
|
||
MOVE_TOML_PATH="protocol-units/bridge/move-modules/Move.toml" | ||
|
||
# Initialize Aptos and capture output | ||
INIT_OUTPUT=$(aptos init 2>&1) | ||
echo "$INIT_OUTPUT" | ||
|
||
# Extract the account address from the initialization output | ||
ADDRESS=$(echo "$INIT_OUTPUT" | grep -oE '0x[a-f0-9]{64}' | head -1) | ||
if [[ -z "$ADDRESS" ]]; then | ||
echo "Error: Failed to extract the Aptos account address." | ||
exit 1 | ||
fi | ||
|
||
# Generate a random seed | ||
RANDOM_SEED=$(shuf -i 0-1000000 -n 1) | ||
echo "Seed: $RANDOM_SEED" | ||
|
||
# Derive the resource account address using the random seed | ||
RESOURCE_OUTPUT=$(aptos account derive-resource-account-address --address "$ADDRESS" --seed "" --seed-encoding hex 2>&1) | ||
echo "Resource address derivation output: $RESOURCE_OUTPUT" | ||
|
||
# Extract the resource address directly | ||
RESOURCE_ADDRESS=$(echo "$RESOURCE_OUTPUT" | grep -oE '[a-f0-9]{64}') | ||
|
||
if [[ -z "$RESOURCE_ADDRESS" ]]; then | ||
echo "Error: Failed to extract the resource account address." | ||
exit 1 | ||
fi | ||
|
||
# Prepend the 0x to the resource address | ||
RESOURCE_ADDRESS="0x$RESOURCE_ADDRESS" | ||
|
||
echo "Extracted address: $ADDRESS" | ||
echo "Derived resource address: $RESOURCE_ADDRESS" | ||
|
||
# Update the Move.toml file with the addresses | ||
sed -i "s/^resource_addr = \".*\"/resource_addr = \"$RESOURCE_ADDRESS\"/" "$MOVE_TOML_PATH" | ||
sed -i "s/^atomic_bridge = \".*\"/atomic_bridge = \"$RESOURCE_ADDRESS\"/" "$MOVE_TOML_PATH" | ||
sed -i "s/^moveth = \".*\"/moveth = \"$RESOURCE_ADDRESS\"/" "$MOVE_TOML_PATH" | ||
sed -i "s/^master_minter = \".*\"/master_minter = \"$RESOURCE_ADDRESS\"/" "$MOVE_TOML_PATH" | ||
sed -i "s/^minter = \".*\"/minter = \"$RESOURCE_ADDRESS\"/" "$MOVE_TOML_PATH" | ||
sed -i "s/^admin = \".*\"/admin = \"$RESOURCE_ADDRESS\"/" "$MOVE_TOML_PATH" | ||
sed -i "s/^origin_addr = \".*\"/origin_addr = \"$ADDRESS\"/" "$MOVE_TOML_PATH" | ||
|
||
echo "Move.toml updated with ADDRESS: $ADDRESS and RESOURCE_ADDRESS: $RESOURCE_ADDRESS" | ||
|
||
echo "Contents of $MOVE_TOML_PATH:" | ||
cat "$MOVE_TOML_PATH" |
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 |
---|---|---|
|
@@ -8,7 +8,7 @@ on: | |
- synchronize | ||
push: | ||
branches: | ||
- main | ||
- '**' | ||
|
||
jobs: | ||
|
||
|
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
Oops, something went wrong.