Skip to content

Commit

Permalink
update auctions scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
hard-nett committed Apr 6, 2024
1 parent 0ab0475 commit edb8431
Show file tree
Hide file tree
Showing 24 changed files with 375 additions and 660 deletions.
6 changes: 0 additions & 6 deletions scripts/auctions/.gitignore

This file was deleted.

35 changes: 35 additions & 0 deletions scripts/auctions/01_init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
AUCTION_CODE_ID=120
PUBKEY=terp1tyl97ac3s7sec4jwznk0s7n3tlwf3matfmkape


MSG=$(cat <<EOF
{
"protocol_fee": "0.01",
"min_increment": "0.1",
"duration": 300,
"min_duration": 60,
"accepted_denom": ["uterpx"],
"min_reserve_price": "1000",
"max_royalty_fee": "0.2",
"protocol_addr": "$PUBKEY"
}
EOF
)
echo $MSG


response_command='terpd tx wasm i $AUCTION_CODE_ID "$MSG" --label="Auction Marketplace" --no-admin --gas-prices 0.05uthiolx --gas auto --gas-adjustment 1.9 --from test1 -y -b sync -o json --chain-id 90u-4'
response=$(eval $response_command);
echo $response


if [ -n "$response" ]; then
txhash=$(echo "$response" | jq -r '.txhash')
echo 'waiting for tx to process'
sleep 6;
tx_response=$(terpd q tx $txhash -o json)
contract_address=$(echo "$tx_response" | jq -r '.logs[].events[] | select(.type == "instantiate") | .attributes[] | select(.key == "_contract_address") | .value')
echo "Contract Address: $contract_address"
else
echo "Error: Empty response"
fi
77 changes: 77 additions & 0 deletions scripts/auctions/02_nft.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
AUCTION_CODE_ID=120
CW721_BASE_ID=68
PUBKEY=terp1tyl97ac3s7sec4jwznk0s7n3tlwf3matfmkape

# terp1mum2jzk55uhl375cmpydla9lsen65fvmcz2sm6k92n9uc8mm8r5sm5f6m8

# MSG=$(cat <<EOF
# {
# "name": "Test1",
# "symbol": "TEST",
# "minter": "$PUBKEY"
# }
# EOF
# )
# echo $MSG


# response_command='terpd tx wasm i $CW721_BASE_ID "$MSG" --label="NFT" --no-admin --gas-prices 0.05uthiolx --gas auto --gas-adjustment 1.9 --from test1 -y -b sync -o json --chain-id 90u-4'
# response=$(eval $response_command);
# echo $response

# if [ -n "$response" ]; then
# txhash=$(echo "$response" | jq -r '.txhash')
# echo 'waiting for tx to process'
# sleep 6;
# tx_response=$(terpd q tx $txhash -o json)
# contract_address=$(echo "$tx_response" | jq -r '.logs[].events[] | select(.type == "instantiate") | .attributes[] | select(.key == "_contract_address") | .value')
# echo "Contract Address: $contract_address"
# else
# echo "Error: Empty response"
# fi


MINT_MSG=$(cat <<EOF
{
"mint": {
"token_id": "2",
"owner": "$PUBKEY",
"token_uri": "ipfs://QmboqXNQcf4pcNhfMWAeXCbTejxuVreDVDaB4qoFmg7DBR",
"extension": {
"image": "ipfs://QmboqXNQcf4pcNhfMWAeXCbTejxuVreDVDaB4qoFmg7DBR",
"description": "test",
"name": "Test 1",
"attributes": [
{
"trait_type": "background",
"value": "aurora"
},
{
"trait_type": "head",
"value": "aurora"
}
]
}
}
}
EOF
)
# echo $MSG



response_command='terpd tx wasm e terp1mum2jzk55uhl375cmpydla9lsen65fvmcz2sm6k92n9uc8mm8r5sm5f6m8 "$MINT_MSG" --gas-prices 0.05uthiolx --gas auto --gas-adjustment 1.9 --from test1 -y -b sync -o json --chain-id 90u-4'
response=$(eval $response_command);
echo $response

if [ -n "$response" ]; then
txhash=$(echo "$response" | jq -r '.txhash')
echo 'waiting for tx to process'
sleep 6;
tx_response=$(terpd q tx $txhash -o json)
echo $tx_response;
# contract_address=$(echo "$tx_response" | jq -r '.logs[].events[] | select(.type == "instantiate") | .attributes[] | select(.key == "_contract_address") | .value')
# echo "Contract Address: $contract_address"
else
echo "Error: Empty response"
fi
47 changes: 47 additions & 0 deletions scripts/auctions/03_create.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
PUBKEY=terp1tyl97ac3s7sec4jwznk0s7n3tlwf3matfmkape
CW721_CONTRACT=terp1mum2jzk55uhl375cmpydla9lsen65fvmcz2sm6k92n9uc8mm8r5sm5f6m8
AUCTION_CONTRACT=terp1mullcexgw5sznuscul79j5xh88syc5ker98zn8270hkjt6hld68q030qs0
TOKEN_ID=1

AUCTION_MSG=$(cat <<EOF
{
"create_auction": {
"denom": "uterpx",
"reserve_price": "420000000",
"is_instant_sale": false
}
}
EOF
)

binary_auction_msg=$(echo $AUCTION_MSG | jq -c . | base64)
echo $binary_auction_msg

MSG=$(cat <<EOF
{
"send_nft": {
"contract": "$AUCTION_CONTRACT",
"token_id": "$TOKEN_ID",
"msg": "$binary_auction_msg"
}
}
EOF
)
echo $MSG


response_command='terpd tx wasm e $CW721_CONTRACT "$MSG" --gas-prices 0.05uthiolx --gas auto --gas-adjustment 1.9 --from test1 -y -b sync -o json --chain-id 90u-4'
response=$(eval $response_command);
# echo $response

if [ -n "$response" ]; then
txhash=$(echo "$response" | jq -r '.txhash')
echo 'waiting for tx to process'
sleep 6;
tx_response=$(terpd q tx $txhash -o json)
# contract_address=$(echo "$tx_response" | jq -r '.logs[].events[] | select(.type == "instantiate") | .attributes[] | select(.key == "_contract_address") | .value')
# echo "Contract Address: $contract_address"
echo 'finished with txhash: $txhash'
else
echo "Error: Empty response"
fi
34 changes: 34 additions & 0 deletions scripts/auctions/04_bid.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
PUBKEY=terp1tyl97ac3s7sec4jwznk0s7n3tlwf3matfmkape
AUCTION_CONTRACT=terp1mullcexgw5sznuscul79j5xh88syc5ker98zn8270hkjt6hld68q030qs0
AUCTION_ID=0
BID_AMOUNT=420000000uterpx

binary_auction_msg=$(echo $AUCTION_MSG | jq -c . | base64)
echo $binary_auction_msg

MSG=$(cat <<EOF
{
"place_bid": {
"auction_id": "$AUCTION_ID"
}
}
EOF
)
echo $MSG


response_command='terpd tx wasm e $AUCTION_CONTRACT "$MSG" --amount $BID_AMOUNT --gas-prices 0.05uthiolx --gas auto --gas-adjustment 1.9 --from test1 -y -b sync -o json --chain-id 90u-4'
response=$(eval $response_command);
# echo $response

if [ -n "$response" ]; then
txhash=$(echo "$response" | jq -r '.txhash')
echo 'waiting for tx to process'
sleep 6;
tx_response=$(terpd q tx $txhash -o json)
# contract_address=$(echo "$tx_response" | jq -r '.logs[].events[] | select(.type == "instantiate") | .attributes[] | select(.key == "_contract_address") | .value')
# echo "Contract Address: $contract_address"
echo 'finished with txhash:' $txhash
else
echo "Error: Empty response"
fi
51 changes: 51 additions & 0 deletions scripts/auctions/05_admin.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
PUBKEY=terp1tyl97ac3s7sec4jwznk0s7n3tlwf3matfmkape
AUCTION_CONTRACT=terp1mullcexgw5sznuscul79j5xh88syc5ker98zn8270hkjt6hld68q030qs0
AUCTION_ID=0

binary_auction_msg=$(echo $AUCTION_MSG | jq -c . | base64)
echo $binary_auction_msg

MSG=$(cat <<EOF
{"admin_pause": {}}
EOF
)
# MSG=$(cat <<EOF
# {"admin_resume": {}}
# EOF
# MSG=$(cat <<EOF
# {"admin_cancel_auction": {"auction_id": "$AUCTION_ID"}}
# EOF
# )
# )
# MSG=$(cat <<EOF
# {"admin_change_config": {}}
# EOF
# )
# MSG=$(cat <<EOF
# {"set_royalty_fee": {}}
# EOF
# )
# MSG=$(cat <<EOF
# {"set_royalty_address": {}}
# EOF
# )
# MSG=$(cat <<EOF
# {"settle_hook": {}}
# EOF
# )

echo $MSG

response_command='terpd tx wasm e $AUCTION_CONTRACT "$MSG" --gas-prices 0.05uthiolx --gas auto --gas-adjustment 1.9 --from test1 -y -b sync -o json --chain-id 90u-4'
response=$(eval $response_command);
# echo $response

if [ -n "$response" ]; then
txhash=$(echo "$response" | jq -r '.txhash')
echo 'waiting for tx to process'
sleep 6;
tx_response=$(terpd q tx $txhash -o json)
echo 'finished with txhash:' $txhash
else
echo "Error: Empty response"
fi
51 changes: 51 additions & 0 deletions scripts/auctions/06_settle.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
PUBKEY=terp1tyl97ac3s7sec4jwznk0s7n3tlwf3matfmkape
AUCTION_CONTRACT=terp1mullcexgw5sznuscul79j5xh88syc5ker98zn8270hkjt6hld68q030qs0
AUCTION_ID=0

binary_auction_msg=$(echo $AUCTION_MSG | jq -c . | base64)
echo $binary_auction_msg

MSG=$(cat <<EOF
{"admin_pause": {}}
EOF
)
# MSG=$(cat <<EOF
# {"admin_resume": {}}
# EOF
# MSG=$(cat <<EOF
# {"admin_cancel_auction": {"auction_id": "$AUCTION_ID"}}
# EOF
# )
# )
# MSG=$(cat <<EOF
# {"admin_change_config": {}}
# EOF
# )
# MSG=$(cat <<EOF
# {"set_royalty_fee": {}}
# EOF
# )
# MSG=$(cat <<EOF
# {"set_royalty_address": {}}
# EOF
# )
# MSG=$(cat <<EOF
# {"settle_hook": {}}
# EOF
# )

echo $MSG

response_command='terpd tx wasm e $AUCTION_CONTRACT "$MSG" --gas-prices 0.05uthiolx --gas auto --gas-adjustment 1.9 --from test1 -y -b sync -o json --chain-id 90u-4'
response=$(eval $response_command);
# echo $response

if [ -n "$response" ]; then
txhash=$(echo "$response" | jq -r '.txhash')
echo 'waiting for tx to process'
sleep 6;
tx_response=$(terpd q tx $txhash -o json)
echo 'finished with txhash:' $txhash
else
echo "Error: Empty response"
fi
12 changes: 0 additions & 12 deletions scripts/auctions/env.example

This file was deleted.

23 changes: 0 additions & 23 deletions scripts/auctions/package.json

This file was deleted.

21 changes: 0 additions & 21 deletions scripts/auctions/src/delist.ts

This file was deleted.

Loading

0 comments on commit edb8431

Please sign in to comment.