-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## 1. Overview In this PR we are adding Burn contract that will burn the token sent to it. ## 2. Implementation details The Burn Coins Contract is a simple smart contract designed to burn the coins sent to it. Here are some highlights of the implementation: - The contract consists of an `instantiate` function to initialize the contract. - It includes an `execute` function that has `burn` function to handle the execution of coin burning. - The contract allows to query the total amount of coins burnt using the `query` function. Design Rationale: - The contract follows a straightforward design to achieve its primary objective of burning coins. - It ensures that burning coins is irreversible to maintain the integrity of the tokenomics. ## 3. How to test/use To test or use the Burn Coins Contract, follow these steps: - Build the contract locally - Change to demos directory - Run `sh quasar_localnet.sh` - Run `burn.sh` ## 4. Checklist - [x] Does the Readme need to be updated? ## 5. Limitations (optional) <!-- Describe any limitation of the capabilities listed in the Overview section. --> ## 6. Future Work (optional) Potential future enhancements for the Burn Coins Contract include: - Implementing additional functionality for managing burnt coins, such as tracking burnt amounts per user or token. - Adding support for configurable burning parameters, such as burn fees or burn rates. --------- Co-authored-by: Laurens <32776056+LaurensKubat@users.noreply.github.com>
- Loading branch information
1 parent
40287ee
commit c2b3307
Showing
15 changed files
with
977 additions
and
343 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,32 @@ | ||
#!/bin/sh | ||
|
||
BINARY=quasarnoded | ||
CHAIN_ID="quasar" | ||
ACCOUNT_NAME="alice" | ||
ACCOUNT_ADDRESS="quasar1sqlsc5024sszglyh7pswk5hfpc5xtl77gqjwec" | ||
|
||
cd ../../smart-contracts | ||
|
||
#docker run --rm -v "$(pwd)":/code --mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry cosmwasm/workspace-optimizer:0.12.11 | ||
|
||
RES=$($BINARY tx wasm store artifacts/burn_coins-aarch64.wasm --from $ACCOUNT_NAME --keyring-backend test -y -b block --output json --chain-id $CHAIN_ID --fees 10000uqsr --gas 7000000) | ||
CODE_ID=$(echo $RES | jq -r '.logs[0].events[-1].attributes[1].value') | ||
echo "Got airdrop CODE_ID = $CODE_ID" | ||
|
||
INIT='{}' | ||
|
||
echo "Deploying airdrop contract" | ||
OUT1=$($BINARY tx wasm instantiate $CODE_ID "{}" --from $ACCOUNT_NAME --keyring-backend test --label "burn coins contract" -b block -y --admin $ACCOUNT_ADDRESS --chain-id $CHAIN_ID --gas 7000000 --fees 10000uqsr) | ||
ADDR1=$($BINARY query wasm list-contract-by-code $CODE_ID --output json | jq -r '.contracts[0]') | ||
echo "Got address of burn coin contract = $ADDR1" | ||
|
||
quasarnoded q bank total | ||
|
||
echo "Should not fail" | ||
quasarnoded tx wasm execute $ADDR1 '{"burn":{}}' --from $ACCOUNT_NAME --keyring-backend test -y --output json --chain-id $CHAIN_ID --fees 10000uqsr --gas 7000000 -b block --amount 90000000000000000uqsr,200000000stake,20000token | ||
|
||
quasarnoded q wasm contract-state smart $ADDR1 '{"total_burnt_query":{}}' | ||
|
||
quasarnoded q bank total | ||
|
||
|
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,133 @@ | ||
#!/bin/sh | ||
|
||
## This script helps to create a basic version of the quasar chain genesis file for development purposes. | ||
## However it will need some manual modifications before you start the chain to incorporate the custom fields. | ||
|
||
# Configure variables | ||
BINARY=quasarnoded | ||
HOME_QSR=$HOME/.quasarnode | ||
CHAIN_ID=quasar | ||
ALICE="edge victory hurry slight dog exit company bike hill erupt shield aspect turkey retreat stairs summer sadness crush absorb draft viable orphan chuckle exhibit" | ||
BOB="harvest ill mean warfare gospel slide tragic palace model excess surprise distance voyage change bus grant special artwork win width group dwarf today jar" | ||
USER_1="guard cream sadness conduct invite crumble clock pudding hole grit liar hotel maid produce squeeze return argue turtle know drive eight casino maze host" | ||
USER_2="fuel obscure melt april direct second usual hair leave hobby beef bacon solid drum used law mercy worry fat super must ritual bring faculty" | ||
|
||
ALICE_GENESIS_COINS=20000token,200000000stake,100000000000000000uqsr | ||
BOB_GENESIS_COINS=10000token,100000000stake,1000000000uqsr | ||
USER_1_GENESIS_COINS=10000000000stake,10000000000uqsr | ||
USER_2_GENESIS_COINS=10000000000stake,10000000000uqsr | ||
|
||
# Remove previous setup | ||
rm -rf $HOME_QSR | ||
|
||
$BINARY init $CHAIN_ID --chain-id $CHAIN_ID | ||
|
||
# Bootstrap the quasar local network with single node | ||
|
||
echo $ALICE | $BINARY keys add alice --keyring-backend test --recover | ||
echo $BOB | $BINARY keys add bob --keyring-backend test --recover | ||
echo $USER_1 | $BINARY keys add user1 --keyring-backend test --recover | ||
echo $USER_2 | $BINARY keys add user2 --keyring-backend test --recover | ||
$BINARY add-genesis-account $($BINARY keys show alice --keyring-backend test -a) $ALICE_GENESIS_COINS | ||
$BINARY add-genesis-account $($BINARY keys show bob --keyring-backend test -a) $BOB_GENESIS_COINS | ||
$BINARY add-genesis-account $($BINARY keys show user1 --keyring-backend test -a) $USER_1_GENESIS_COINS | ||
$BINARY add-genesis-account $($BINARY keys show user2 --keyring-backend test -a) $USER_2_GENESIS_COINS | ||
$BINARY gentx alice 100000000uqsr --chain-id $CHAIN_ID --keyring-backend test | ||
$BINARY collect-gentxs | ||
|
||
# Check platform | ||
platform='unknown' | ||
unamestr=`uname` | ||
if [ "$unamestr" = 'Linux' ]; then | ||
platform='linux' | ||
elif [ "$unamestr" = 'Darwin' ]; then | ||
platform='macos' | ||
fi | ||
|
||
if [ $platform = 'linux' ]; then | ||
sed -i 's/enable = false/enable = true/g' $HOME_QSR/config/app.toml | ||
sed -i 's/swagger = false/swagger = true/g' $HOME_QSR/config/app.toml | ||
sed -i 's/minimum-gas-prices = ""/minimum-gas-prices = "0uqsr"/g' $HOME_QSR/config/app.toml | ||
sed -i 's/query_gas_limit = 300000/query_gas_limit = 800000/g' $HOME_QSR/config/app.toml | ||
sed -i 's+laddr = "tcp://127.0.0.1:26657"+laddr = "tcp://127.0.0.1:26659"+g' $HOME_QSR/config/config.toml | ||
sed -i 's+node = "tcp://localhost:26657"+node = "tcp://localhost:26659"+g' $HOME_QSR/config/client.toml | ||
sed -i 's+laddr = "tcp://0.0.0.0:26656"+laddr = "tcp://0.0.0.0:26661"+g' $HOME_QSR/config/config.toml | ||
sed -i 's+pprof_laddr = "localhost:6060"+pprof_laddr = "localhost:6061"+g' $HOME_QSR/config/config.toml | ||
sed -i 's+address = "0.0.0.0:9090"+address = "0.0.0.0:9095"+g' $HOME_QSR/config/app.toml | ||
sed -i 's+address = "0.0.0.0:9091"+address = "0.0.0.0:8091"+g' $HOME_QSR/config/app.toml | ||
sed -i 's+address = "tcp://0.0.0.0:1317"+address = "tcp://0.0.0.0:1311"+g' $HOME_QSR/config/app.toml | ||
sed -i 's+address = ":8080"+address = ":8081"+g' $HOME_QSR/config/app.toml | ||
elif [ $platform = 'macos' ]; then | ||
sed -i'.original' -e 's/enable = false/enable = true/g' $HOME_QSR/config/app.toml | ||
sed -i'.original' -e 's/swagger = false/swagger = true/g' $HOME_QSR/config/app.toml | ||
sed -i'.original' -e 's/query_gas_limit = 300000/query_gas_limit = 100000000/g' $HOME_QSR/config/app.toml | ||
sed -i'.original' -e 's/minimum-gas-prices = ""/minimum-gas-prices = "0uatom"/g' $HOME_QSR/config/app.toml | ||
sed -i'.original' -e 's+laddr = "tcp://127.0.0.1:26657"+laddr = "tcp://127.0.0.1:26659"+g' $HOME_QSR/config/config.toml | ||
sed -i'.original' -e 's+node = "tcp://localhost:26657"+node = "tcp://localhost:26659"+g' $HOME_QSR/config/client.toml | ||
sed -i'.original' -e 's+laddr = "tcp://0.0.0.0:26656"+laddr = "tcp://0.0.0.0:26661"+g' $HOME_QSR/config/config.toml | ||
sed -i'.original' -e 's+pprof_laddr = "localhost:6060"+pprof_laddr = "localhost:6061"+g' $HOME_QSR/config/config.toml | ||
sed -i'.original' -e 's+address = "0.0.0.0:9090"+address = "0.0.0.0:9095"+g' $HOME_QSR/config/app.toml | ||
sed -i'.original' -e 's+address = "0.0.0.0:9091"+address = "0.0.0.0:8091"+g' $HOME_QSR/config/app.toml | ||
sed -i'.original' -e 's+address = "tcp://0.0.0.0:1317"+address = "tcp://0.0.0.0:1311"+g' $HOME_QSR/config/app.toml | ||
sed -i'.original' -e 's+address = ":8080"+address = ":8081"+g' $HOME_QSR/config/app.toml | ||
else | ||
echo "only linux and macos platforms are supported, if you are using other platforms you should probably improve this script." | ||
|
||
exit 1 | ||
sed -i '' 's/enable = false/enable = true/g' $HOME_QSR/config/app.toml | ||
sed -i '' 's/swagger = false/swagger = true/g' $HOME_QSR/config/app.toml | ||
fi | ||
|
||
cp $HOME_QSR/config/genesis.json $HOME_QSR/config/genesis_original.json | ||
cat $HOME_QSR/config/genesis_original.json | | ||
jq '.app_state.crisis.constant_fee.denom="uqsr"' | | ||
jq '.app_state.staking.params.bond_denom="uqsr"' | | ||
jq '.app_state.mint.params.mint_denom="uqsr"' | | ||
jq '.app_state.gov.deposit_params.min_deposit=[{denom:"uqsr",amount:"1"}]' | | ||
jq '.app_state.gov.voting_params.voting_period="60s"' | | ||
jq '.app_state.gov.tally_params={quorum:"0.000000000000000001",threshold:"0.5",veto_threshold:"0.334"}' | | ||
jq '.app_state.orion = { | ||
"lpPosition": null, | ||
"lpStat": null, | ||
"params": { | ||
"destination_chain_id": "osmosis", | ||
"enabled": true, | ||
"lp_epoch_id": "minute", | ||
"mgmt_fee_per": "0.003000000000000000", | ||
"osmosis_local_info": { | ||
"chain_id": "osmosis", | ||
"connection_id": "connection-1", | ||
"local_zone_id": "osmosis-1" | ||
}, | ||
"perf_fee_per": "0.020000000000000000", | ||
"white_listed_pools": [ | ||
1, | ||
2, | ||
3 | ||
] | ||
}, | ||
"rewardCollection": null | ||
}' | | ||
jq '.app_state.qbank = { | ||
"claimableRewards": [], | ||
"depositInfos": [], | ||
"params": { | ||
"enabled": true, | ||
"min_orion_epoch_denom_dollar_deposit": "100.000000000000000000", | ||
"orion_epoch_identifier": "minute", | ||
"white_listed_denoms_in_orion": [ | ||
{ | ||
"onehop_osmo": "ibc/BE1BB42D4BE3C30D50B68D7C41DB4DFCE9678E8EF8C539F6E6A9345048894FCC", | ||
"onehop_quasar": "ibc/BE1BB42D4BE3C30D50B68D7C41DB4DFCE9678E8EF8C539F6E6A9345048894FCC", | ||
"origin_name": "uatom" | ||
} | ||
] | ||
}, | ||
"totalClaimedRewards": [], | ||
"totalDeposits": [], | ||
"totalWithdraws": [], | ||
"withdrawables": [] | ||
}' > $HOME_QSR/config/genesis.json | ||
|
||
# Start | ||
$BINARY start --home $HOME_QSR >> ./logs/quasar_localnet.log 2>&1 |
Oops, something went wrong.