Skip to content

Commit

Permalink
Merge pull request #793 from EmpowerPlastic/circulus-1
Browse files Browse the repository at this point in the history
Circulus 1
  • Loading branch information
gjermundgaraba authored May 30, 2023
2 parents 51aee4b + 856d6da commit b7b3ff2
Show file tree
Hide file tree
Showing 35 changed files with 4,055 additions and 44 deletions.
4 changes: 2 additions & 2 deletions testnets/circulus-1/Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ test-collect-gentx:
FROM ../../chain/+build
WORKDIR /empowerchain/chain/build
RUN ./empowerd init empower
COPY ./genesis.json /root/.empowerchain/config/genesis.json
COPY ./gentx/ /root/.empowerchain/config/gentx/
RUN ./empowerd genesis collect-gentxs
COPY collect-gentxs.sh .
RUN ./collect-gentxs.sh
12 changes: 7 additions & 5 deletions testnets/circulus-1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ cd chain && \
make install
```

> PLEASE: notice the `git checkout circulus-1`. Use this branch, and also target this branch in the PR
2. **Init chain directory**
```bash
empowerd init <MONIKER>
Expand Down Expand Up @@ -50,15 +52,15 @@ empowerd genesis gentx <WALLET_NAME> 1000000umpwr \
--website="" \
--security-contact="" \
--identity="" \
--details=""
--details="" \
--ip="<use your public ip to help other validators find you>"
```

8. **Copy genesis.json and gentx to empowerchain repo and submit a PR to circulus-1 branch**
8. **Copy gentx to empowerchain repo, __rename it__ and submit a PR to circulus-1 branch**
```bash
cp ~/.empowerchain/config/genesis.json <PATH_TO_EMPOWERCHAIN_REPO>/testnets/circulus-1/genesis.json
cp ~/.empowerchain/config/gentx/gentx-*.json <PATH_TO_EMPOWERCHAIN_REPO>/testnets/circulus-1/gentx/
cp ~/.empowerchain/config/gentx/gentx-*.json <PATH_TO_EMPOWERCHAIN_REPO>/testnets/circulus-1/gentx/gentx-<VALIDATOR_NAME>.json
```

Make sure you also do a rename of the file when copying or before submitting the PR (should be `gentx-<VALIDATOR_NAME>.json`)

## Genesis launch

Expand Down
31 changes: 31 additions & 0 deletions testnets/circulus-1/collect-gentxs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash
DENOM=umpwr
VALIDATOR_COINS=1000000$DENOM
MAXBOND=1000000

set -e

find /root/.empowerchain/config/gentx -iname "*.json" -print0 |
while IFS= read -r -d '' line; do
GENACC=$(cat $line | sed -n 's|.*"delegator_address":"\([^"]*\)".*|\1|p')
denomquery=$(jq -r '.body.messages[0].value.denom' $line)
amountquery=$(jq -r '.body.messages[0].value.amount' $line)

echo $GENACC
echo $amountquery
echo $denomquery

# only allow $DENOM tokens to be bonded
if [ $denomquery != $DENOM ]; then
echo "invalid denomination"
exit 1
fi
# limit the amount that can be bonded
if [ $amountquery -gt $MAXBOND ]; then
echo "bonded too much: $amountquery > $MAXBOND"
exit 1
fi

./empowerd genesis add-genesis-account $(jq -r '.body.messages[0].delegator_address' $line) $VALIDATOR_COINS
done
./empowerd genesis collect-gentxs
Loading

0 comments on commit b7b3ff2

Please sign in to comment.