Skip to content

Commit

Permalink
Script for the task that executes passed proposals
Browse files Browse the repository at this point in the history
  • Loading branch information
nlipartiia-hacken committed Dec 22, 2022
1 parent f46152a commit acbcf41
Show file tree
Hide file tree
Showing 2 changed files with 107 additions and 0 deletions.
79 changes: 79 additions & 0 deletions scripts/uni-testnet/create-auto-execute-dao-task.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
set -e

SH_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/$(basename "${BASH_SOURCE[0]}")"
SH_DIR="$(cd -P "$(dirname "${SH_PATH}")";pwd)"
. $SH_DIR/base/init-vars.sh

if [ -z "$1" ]; then
echo "Must provide contract address"
exit 1
elif [ -z "$2" ]; then
echo "Must provide user address"
exit 1
elif [ -z "$3" ]; then
echo "Must provide rules address"
exit 1
elif [ -z "$4" ]; then
echo "Must provide dao address"
exit 1
elif [ -z "$5" ]; then
echo "Must provide agent address"
exit 1
fi

CONTRACT="$1"
USER="$2"
RULES="$3"
DAO="$4"
AGENT="$5"

EXECUTE_MSG='{"execute":{"proposal_id":""}}'
ENCODED_EXECUTE_MSG=$(printf $EXECUTE_MSG | base64)

DAODAO='{
"create_task": {
"task": {
"interval": "Immediate",
"cw20_coins": [],
"stop_on_fail": false,
"actions": [
{
"msg": {
"wasm": {
"execute": {
"contract_addr": "'$DAO'",
"msg": "'$ENCODED_EXECUTE_MSG'",
"funds": []
}
}
},
"gas_limit": 300000
}
],
"queries": [
{
"check_passed_proposals": {
"dao_address": "'$DAO'"
}
}
],
"transforms": [
{
"action_idx": 0,
"query_idx": 0,
"action_path": [
{
"key": "execute"
},
{
"key": "proposal_id"
}
],
"query_response_path": []
}
]
}
}
}'

junod tx wasm execute $CONTRACT "$DAODAO" --amount 1000000ujunox --from "$USER" $TXFLAG -y
28 changes: 28 additions & 0 deletions scripts/uni-testnet/proxy-call-with-query.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash
set -e

SH_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/$(basename "${BASH_SOURCE[0]}")"
SH_DIR="$(cd -P "$(dirname "${SH_PATH}")";pwd)"
. $SH_DIR/base/init-vars.sh

if [ -z "$1" ]
then
echo "Must provide contract address"
exit 1
elif [ -z "$2" ]
then
echo "Must provide address of the agent"
exit 1
elif [ -z "$3" ]
then
echo "Must provide the task hash"
exit 1
else
CONTRACT="$1"
AGENT="$2"
HASH="$3"
fi


PROXY_CALL='{"proxy_call":{"task_hash": "'$HASH'"}}'
junod tx wasm execute $CONTRACT "$PROXY_CALL" --from $AGENT $TXFLAG -y

0 comments on commit acbcf41

Please sign in to comment.