Skip to content

Instantly share code, notes, and snippets.

@rabi-siddique
Created September 26, 2024 14:06
Show Gist options
  • Save rabi-siddique/5dc08dd3d167c4a1ecbc912d42fee68a to your computer and use it in GitHub Desktop.
Save rabi-siddique/5dc08dd3d167c4a1ecbc912d42fee68a to your computer and use it in GitHub Desktop.
test-ec-changes-with-a3p
# Generate Bundles
mkdir -p bundles
FILENAME=packages/builders/scripts/inter-protocol/ec-changes-core.js
(agoric run $FILENAME) > /tmp/,run.log
node parseProposals.mjs < /tmp/,run.log \
| jq -r '.bundles[]' | sort -u > bundles/bundle-list
# Install Bundles
# Make sure to get enough ISTs for gov1 by creating a vault
# I created a vault from dapp-inter ==> You can create from CLI too
install_bundle() {
ls -sh "$1"
agd tx swingset install-bundle --compress "@$1" \
--from gov1 --keyring-backend=test --gas=auto --gas-adjustment=1.2 \
--chain-id=agoriclocal -bblock --yes -o json
}
for b in $(cat bundles/bundle-list); do
echo Installing $b
install_bundle $b
sleep 5
done
# Submit Proposal
PERMIT=replace-committee-and-charter-permit.json
SCRIPT=replace-committee-and-charter.js
walletName=gov1
agd tx gov submit-proposal swingset-core-eval $PERMIT $SCRIPT \
--title="Replace EC Committee and Charter" --description="Evaluate $SCRIPT" \
--deposit=10000000ubld --gas=auto --gas-adjustment=1.2 \
--from $walletName --chain-id agoriclocal --keyring-backend=test \
--yes -b block
sleep 3
# Accept Proposal
LATEST_PROPOSAL=$(agd query gov proposals --output json | jq -c '[.proposals[] | if .proposal_id == null then .id else .proposal_id end | tonumber] | max')
PROPOSAL=$LATEST_PROPOSAL
VOTE_OPTION=yes
CHAINID=agoriclocal
GAS_ADJUSTMENT=1.2
CONTAINER_ID=$(docker ps -q) # Assuming you're only running a3p container
# Construct the SIGN_BROADCAST_OPTS correctly
SIGN_BROADCAST_OPTS="--keyring-backend=test --chain-id=$CHAINID --gas=auto --gas-adjustment=$GAS_ADJUSTMENT --yes -b block"
# Execute the command in the Docker container
docker exec -it $CONTAINER_ID bash -c \
"agd tx gov vote $PROPOSAL $VOTE_OPTION --from=validator $SIGN_BROADCAST_OPTS -o json > tx.json"
# View Proposal
agd query gov proposals --output json \
| jq -c '.proposals[] | [if .proposal_id == null then .id else .proposal_id end,.voting_end_time,.status]'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment