change denoms to CLR/USDC from token/stake

master
michael 2022-09-07 22:15:49 +00:00
parent da45a14534
commit 627308d809
4 changed files with 60 additions and 27 deletions

View File

@ -1,11 +1,39 @@
genesis:
app_state:
bank:
denom_metadata:
- name: Colinear
symbol: CLR
description: "Native utility coin of the Colinear blockchain"
display: clr
base: uclr
denom_units:
- denom: uclr
exponent: "0"
- denom: clr
exponent: "6"
- name: "USD Coin"
symbol: USDC
description: "Mock USDC"
display: usdc
base: uusdc
denom_units:
- denom: uusdc
exponent: "0"
- denom: usdc
exponent: "6"
staking:
params:
bond_denom: "uclr"
accounts:
- name: alice
coins: ["20000token", "200000000stake"]
coins: ["20000usdc", "200000000000uclr"]
- name: bob
coins: ["10000token", "100000000stake"]
coins: ["10000usdc", "100000000000uclr"]
validator:
name: alice
staked: "100000000stake"
staked: "100000000uclr"
client:
openapi:
path: "docs/static/openapi.yml"
@ -13,4 +41,4 @@ client:
# path: "vue/src/store"
faucet:
name: bob
coins: ["5token", "100000stake"]
coins: ["500usdc", "100000000uclr"]

View File

@ -8,59 +8,59 @@ colineard tx colinear new-auction asdf asdf 200 token $(now + 3500) \
-y --from bob \
| expect_fail "Can't create auction below min lease period"
colineard tx colinear new-auction asdf asdf 200 token $(now + 8200000) \
colineard tx colinearcore new-auction asdf asdf 200 usdc $(now + 8200000) \
-y --from bob \
| expect_fail "Can't create auction above max lease period"
before=$(get_balance $BOB token)
before=$(get_balance $BOB usdc)
colineard tx colinear new-auction asdf asdf 200 token $(now + 3700) \
colineard tx colinearcore new-auction asdf asdf 200 usdc $(now + 3700) \
-y --from bob \
| expect_success "New auction is created"
get_balance $BOB token | expect_change -200 $before "Change in Bob's balance"
get_balance $BOB usdc | expect_change -200 $before "Change in Bob's balance"
colineard tx colinear new-bid $(get_last_auction_index) 100 \
colineard tx colinearcore new-bid $(get_last_auction_index) 100 \
-y --from alice \
| expect_success "New bid is correctly created"
colineard tx colinear new-bid $(get_last_auction_index) 90 \
colineard tx colinearcore new-bid $(get_last_auction_index) 90 \
-y --from alice \
| expect_success "Can bid below price ceiling"
colineard tx colinear new-bid $(get_last_auction_index) 100 \
colineard tx colinearcore new-bid $(get_last_auction_index) 100 \
-y --from alice \
| expect_fail "Can't create duplicate bids"
colineard tx colinear new-bid $(get_next_auction_index) 100 \
colineard tx colinearcore new-bid $(get_next_auction_index) 100 \
-y --from alice \
| expect_fail "Can't create bids for nonexistent auctions"
colineard tx colinear new-bid $(get_last_auction_index) 600 \
colineard tx colinearcore new-bid $(get_last_auction_index) 600 \
-y --from alice \
| expect_fail "Can't bid over price ceiling"
colineard tx colinear new-bid $(get_last_auction_index) 0 \
colineard tx colinearcore new-bid $(get_last_auction_index) 0 \
-y --from alice \
| expect_fail "Can't bid 0 tokens"
| expect_fail "Can't bid 0 usdcs"
colineard q colinear auction-bids $(get_last_auction_index) \
colineard q colinearcore auction-bids $(get_last_auction_index) \
| jq -M ".bids | length" \
| assert_eq 2 "Number of auction bids"
before=$(get_balance $BOB token)
before=$(get_balance $BOB usdc)
# Was experiencing issues with bob's balance not updating, probably
# because we weren't waiting long enough
log_info "Waiting 12s until auction expires..."
sleep 12
colineard tx colinear new-bid $(get_last_auction_index) 50 \
colineard tx colinearcore new-bid $(get_last_auction_index) 50 \
-y --from alice \
| expect_fail "Can't add bids after auction expiry"
colineard q colinear show-auction $(get_last_auction_index) \
colineard q colinearcore show-auction $(get_last_auction_index) \
| jq -rM ".auction.best.amount" \
| assert_eq 90 "Remaining vested amount from finalized top bid"
get_balance $BOB token | expect_change 110 $before "Change in Bob's balance"
get_balance $BOB usdc | expect_change 110 $before "Change in Bob's balance"

View File

@ -69,12 +69,12 @@ function get_key {
}
function get_last_auction_index {
res=$(colineard q colinear show-next-auction | jq -M ".NextAuction.auctionId | tonumber")
res=$(colineard q colinearcore show-next-auction | jq -M ".NextAuction.auctionId | tonumber")
echo "$res-1" | bc
}
function get_next_auction_index {
colineard q colinear show-next-auction | jq -M ".NextAuction.auctionId | tonumber"
colineard q colinearcore show-next-auction | jq -M ".NextAuction.auctionId | tonumber"
}
function now {

View File

@ -9,13 +9,18 @@ const (
MaxLeasePeriod = 8_035_200 // 3 months
// Minimum required staked CLR to be a provider (i.e. to bid)
ProviderMinLockedClr = 500
// 500 CLR
ProviderMinLockedUClr = 500_000_000
// Amount slashed when a provider is offline during an audit
ProviderLockedSlash = 100
// 100 CLR
ProviderLockedSlashUClr = 100_000_000
// Blocks between provider audit pings
// 40 blocks ~40min-2hr
ProviderPingFrequency = 40
// Blocks between provider audits
// 400 blocks ~400-1200min
ProviderAuditFrequency = 400
// Blocks before an audit ping must be returned
// 3 blocks ~4-12sec
ProviderAuditLength = 4
// Gas Fees
AuctionGas = 10