diff --git a/script/proposal-2.json b/script/proposal-2.json deleted file mode 100644 index 84501f7..0000000 --- a/script/proposal-2.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "messages": [{ - "@type": "/reserve.psm.v1.MsgAddStableCoin", - "authority":"onomy10d07y265gmmuvt4z0w9aw880jnsr700jqr8n8k", - "denom": "usdt", - "limit_total": "100000000000000000000000000000", - "fee_in": "0.001000000000000000", - "fee_out": "0.001000000000000000", - "nom_type":"nomUSD" - }], - "deposit": "100000000stake", - "title": "My proposal", - "summary": "A short summary of my proposal" - } \ No newline at end of file diff --git a/script/proposal-psm.json b/script/proposal-psm.json new file mode 100644 index 0000000..046b014 --- /dev/null +++ b/script/proposal-psm.json @@ -0,0 +1,41 @@ +{ + "messages": [{ + "@type": "/reserve.psm.v1.MsgAddStableCoin", + "authority":"onomy10d07y265gmmuvt4z0w9aw880jnsr700jqr8n8k", + "denom": "usdt", + "limit_total": "100000000000000000000000000000", + "fee_in": "0.001000000000000000", + "fee_out": "0.001000000000000000", + "nom_type":"nomUSD" + }, + { + "@type": "/reserve.psm.v1.MsgAddStableCoin", + "authority":"onomy10d07y265gmmuvt4z0w9aw880jnsr700jqr8n8k", + "denom": "usdc", + "limit_total": "100000000000000000000000000000", + "fee_in": "0.001000000000000000", + "fee_out": "0.001000000000000000", + "nom_type":"nomUSD" + }, + { + "@type": "/reserve.psm.v1.MsgAddStableCoin", + "authority":"onomy10d07y265gmmuvt4z0w9aw880jnsr700jqr8n8k", + "denom": "jpyt", + "limit_total": "100000000000000000000000000000", + "fee_in": "0.001000000000000000", + "fee_out": "0.001000000000000000", + "nom_type":"nomJPY" + }, + { + "@type": "/reserve.psm.v1.MsgAddStableCoin", + "authority":"onomy10d07y265gmmuvt4z0w9aw880jnsr700jqr8n8k", + "denom": "eurt", + "limit_total": "100000000000000000000000000000", + "fee_in": "0.001000000000000000", + "fee_out": "0.001000000000000000", + "nom_type":"nomEUR" + }], + "deposit": "100000000stake", + "title": "My proposal", + "summary": "A short summary of my proposal" + } \ No newline at end of file diff --git a/script/psm-test.sh b/script/psm-test.sh index ae9e3b4..1f29af1 100755 --- a/script/psm-test.sh +++ b/script/psm-test.sh @@ -25,15 +25,15 @@ echo $mnemonic2| reserved keys add validator2 --recover --keyring-backend=test - echo $mnemonic3| reserved keys add validator3 --recover --keyring-backend=test --home=$HOME/.reserved/validator3 # create validator node with tokens to transfer to the three other nodes -reserved genesis add-genesis-account $(reserved keys show validator1 -a --keyring-backend=test --home=$HOME/.reserved/validator1) 10000000000000000000000000000000stake,10000000000000000000000000000000usdt --home=$HOME/.reserved/validator1 -reserved genesis add-genesis-account $(reserved keys show validator2 -a --keyring-backend=test --home=$HOME/.reserved/validator2) 10000000000000000000000000000000stake,10000000000000000000000000000000usdt --home=$HOME/.reserved/validator1 -reserved genesis add-genesis-account $(reserved keys show validator3 -a --keyring-backend=test --home=$HOME/.reserved/validator3) 10000000000000000000000000000000stake,10000000000000000000000000000000usdt --home=$HOME/.reserved/validator1 -reserved genesis add-genesis-account $(reserved keys show validator1 -a --keyring-backend=test --home=$HOME/.reserved/validator1) 10000000000000000000000000000000stake,10000000000000000000000000000000usdt --home=$HOME/.reserved/validator2 -reserved genesis add-genesis-account $(reserved keys show validator2 -a --keyring-backend=test --home=$HOME/.reserved/validator2) 10000000000000000000000000000000stake,10000000000000000000000000000000usdt --home=$HOME/.reserved/validator2 -reserved genesis add-genesis-account $(reserved keys show validator3 -a --keyring-backend=test --home=$HOME/.reserved/validator3) 10000000000000000000000000000000stake,10000000000000000000000000000000usdt --home=$HOME/.reserved/validator2 -reserved genesis add-genesis-account $(reserved keys show validator1 -a --keyring-backend=test --home=$HOME/.reserved/validator1) 10000000000000000000000000000000stake,10000000000000000000000000000000usdt --home=$HOME/.reserved/validator3 -reserved genesis add-genesis-account $(reserved keys show validator2 -a --keyring-backend=test --home=$HOME/.reserved/validator2) 10000000000000000000000000000000stake,10000000000000000000000000000000usdt --home=$HOME/.reserved/validator3 -reserved genesis add-genesis-account $(reserved keys show validator3 -a --keyring-backend=test --home=$HOME/.reserved/validator3) 10000000000000000000000000000000stake,10000000000000000000000000000000usdt --home=$HOME/.reserved/validator3 +reserved genesis add-genesis-account $(reserved keys show validator1 -a --keyring-backend=test --home=$HOME/.reserved/validator1) 10000000000000000000000000000000stake,10000000000000000000000000000000usdt,10000000000000000000000000000000eurt,10000000000000000000000000000000usdc,10000000000000000000000000000000jpyt --home=$HOME/.reserved/validator1 +reserved genesis add-genesis-account $(reserved keys show validator2 -a --keyring-backend=test --home=$HOME/.reserved/validator2) 10000000000000000000000000000000stake,10000000000000000000000000000000usdt,10000000000000000000000000000000eurt,10000000000000000000000000000000usdc,10000000000000000000000000000000jpyt --home=$HOME/.reserved/validator1 +reserved genesis add-genesis-account $(reserved keys show validator3 -a --keyring-backend=test --home=$HOME/.reserved/validator3) 10000000000000000000000000000000stake,10000000000000000000000000000000usdt,10000000000000000000000000000000eurt,10000000000000000000000000000000usdc,10000000000000000000000000000000jpyt --home=$HOME/.reserved/validator1 +reserved genesis add-genesis-account $(reserved keys show validator1 -a --keyring-backend=test --home=$HOME/.reserved/validator1) 10000000000000000000000000000000stake,10000000000000000000000000000000usdt,10000000000000000000000000000000eurt,10000000000000000000000000000000usdc,10000000000000000000000000000000jpyt --home=$HOME/.reserved/validator2 +reserved genesis add-genesis-account $(reserved keys show validator2 -a --keyring-backend=test --home=$HOME/.reserved/validator2) 10000000000000000000000000000000stake,10000000000000000000000000000000usdt,10000000000000000000000000000000eurt,10000000000000000000000000000000usdc,10000000000000000000000000000000jpyt --home=$HOME/.reserved/validator2 +reserved genesis add-genesis-account $(reserved keys show validator3 -a --keyring-backend=test --home=$HOME/.reserved/validator3) 10000000000000000000000000000000stake,10000000000000000000000000000000usdt,10000000000000000000000000000000eurt,10000000000000000000000000000000usdc,10000000000000000000000000000000jpyt --home=$HOME/.reserved/validator2 +reserved genesis add-genesis-account $(reserved keys show validator1 -a --keyring-backend=test --home=$HOME/.reserved/validator1) 10000000000000000000000000000000stake,10000000000000000000000000000000usdt,10000000000000000000000000000000eurt,10000000000000000000000000000000usdc,10000000000000000000000000000000jpyt --home=$HOME/.reserved/validator3 +reserved genesis add-genesis-account $(reserved keys show validator2 -a --keyring-backend=test --home=$HOME/.reserved/validator2) 10000000000000000000000000000000stake,10000000000000000000000000000000usdt,10000000000000000000000000000000eurt,10000000000000000000000000000000usdc,10000000000000000000000000000000jpyt --home=$HOME/.reserved/validator3 +reserved genesis add-genesis-account $(reserved keys show validator3 -a --keyring-backend=test --home=$HOME/.reserved/validator3) 10000000000000000000000000000000stake,10000000000000000000000000000000usdt,10000000000000000000000000000000eurt,10000000000000000000000000000000usdc,10000000000000000000000000000000jpyt --home=$HOME/.reserved/validator3 reserved genesis gentx validator1 1000000000000000000000stake --keyring-backend=test --home=$HOME/.reserved/validator1 --chain-id=testing-1 reserved genesis gentx validator2 1000000000000000000000stake --keyring-backend=test --home=$HOME/.reserved/validator2 --chain-id=testing-1 reserved genesis gentx validator3 1000000000000000000000stake --keyring-backend=test --home=$HOME/.reserved/validator3 --chain-id=testing-1 @@ -118,7 +118,7 @@ screen -S onomy3 -t onomy3 -d -m reserved start --home=$HOME/.reserved/validator # submit proposal add usdt sleep 7 -reserved tx gov submit-proposal ./script/proposal-2.json --home=$HOME/.reserved/validator1 --from validator1 --keyring-backend test --fees 20stake --chain-id testing-1 -y +reserved tx gov submit-proposal ./script/proposal-psm.json --home=$HOME/.reserved/validator1 --from validator1 --keyring-backend test --fees 20stake --chain-id testing-1 -y # # # vote sleep 7 @@ -138,10 +138,18 @@ reserved q bank balances $(reserved keys show validator1 -a --keyring-backend te # echo "========swap===========" reserved tx psm swap-to-nomUSD 100000000000000000000000usdt --from validator1 --keyring-backend test --home ~/.reserved/validator1 --chain-id testing-1 -y --fees 20stake +sleep 7 + +reserved tx psm swap-to-nomUSD 100000000000000000000000eurt --from validator1 --keyring-backend test --home ~/.reserved/validator1 --chain-id testing-1 -y --fees 20stake + +sleep 7 + +reserved tx psm swap-to-nomUSD 100000000000000000000000usdc --from validator1 --keyring-backend test --home ~/.reserved/validator1 --chain-id testing-1 -y --fees 20stake +sleep 7 +reserved tx psm swap-to-nomUSD 100000000000000000000000jpyt --from validator1 --keyring-backend test --home ~/.reserved/validator1 --chain-id testing-1 -y --fees 20stake sleep 7 # # Check account after swap reserved q bank balances $(reserved keys show validator1 -a --keyring-backend test --home /Users/donglieu/.reserved/validator1) - # # tx swap nomUSD to usdt # reserved tx psm swap-to-stablecoin usdt 1000nomUSD --from validator1 --keyring-backend test --home ~/.reserved/validator1 --chain-id testing-1 -y --fees 20stake diff --git a/x/psm/keeper/abci_test.go b/x/psm/keeper/abci_test.go index b2a67f2..95bb17b 100644 --- a/x/psm/keeper/abci_test.go +++ b/x/psm/keeper/abci_test.go @@ -45,6 +45,7 @@ func (s *KeeperTestSuite) TestUpdatesStablecoinEpoch() { LimitTotal: limitUSDT, FeeIn: t.feeIn, FeeOut: t.feeOut, + NomType: "nomUSD", }) s.mockOracleKeeper.SetPrice(s.Ctx, sc.Denom, t.priceCurrent) err := s.k.Stablecoins.Set(s.Ctx, sc.Denom, sc)