6
6
cli "github.com/cheqd/cheqd-node/tests/integration/cli"
7
7
helpers "github.com/cheqd/cheqd-node/tests/integration/helpers"
8
8
9
+ sdkmath "cosmossdk.io/math"
9
10
"github.com/cheqd/cheqd-node/tests/integration/testdata"
10
11
didtypes "github.com/cheqd/cheqd-node/x/did/types"
11
12
sdk "github.com/cosmos/cosmos-sdk/types"
@@ -24,8 +25,8 @@ var _ = Describe("Upgrade - Burn coins from relevant message signer", func() {
24
25
// assert no error
25
26
Expect (err ).To (BeNil ())
26
27
27
- // generate fixed fees, in which case 500,000,000 ncheq or 0 .5 cheq
28
- fees := helpers .GenerateFees ("500000000ncheq " )
28
+ // generate fixed fees, in which case 3, 500,000,000 ncheq or 3 .5 cheq
29
+ fees := helpers .GenerateFees ("3500000000ncheq " )
29
30
30
31
// burn the coins
31
32
res , err := cli .BurnMsg (testdata .BASE_ACCOUNT_1 , burnCoins .String (), fees )
@@ -46,13 +47,13 @@ var _ = Describe("Upgrade - Burn coins from relevant message signer", func() {
46
47
diff := balanceBefore .Sub (balanceAfter )
47
48
48
49
// assert the difference is equal to the coins burnt
49
- total := burnCoins .Add (sdk .NewCoin (didtypes .BaseMinimalDenom , sdk .NewInt (500_000_000 )))
50
+ total := burnCoins .Add (sdk .NewCoin (didtypes .BaseMinimalDenom , sdk .NewInt (3_500_000_000 )))
50
51
51
52
// assert the difference is equal to the coins burnt
52
53
Expect (diff ).To (Equal (total ))
53
54
})
54
55
55
- It ("shouldn't burn as their are insufficient funds in the sender " , func () {
56
+ It ("shouldn't burn if sender has insufficient funds" , func () {
56
57
// define the coins to burn, in which case 1,000,000 ncheq or 0.01 cheq
57
58
coins := sdk .NewCoin (didtypes .BaseMinimalDenom , sdk .NewInt (1_000_000 ))
58
59
@@ -62,13 +63,13 @@ var _ = Describe("Upgrade - Burn coins from relevant message signer", func() {
62
63
// assert no error
63
64
Expect (err ).To (BeNil ())
64
65
65
- // generate fixed fees, in which case 500,000,000 ncheq or 0 .5 cheq
66
- fees := helpers .GenerateFees ("500000000ncheq " )
66
+ // generate fixed fees, in which case 3, 500,000,000 ncheq or 3 .5 cheq
67
+ fees := helpers .GenerateFees ("3500000000ncheq " )
67
68
68
69
// burn the coins
69
70
res , err := cli .BurnMsg (testdata .BASE_ACCOUNT_3 , coins .String (), fees )
70
71
71
- // assert no error
72
+ // assert error
72
73
Expect (err ).NotTo (BeNil ())
73
74
74
75
// assert the response code is 0
@@ -84,3 +85,68 @@ var _ = Describe("Upgrade - Burn coins from relevant message signer", func() {
84
85
Expect (balanceBefore ).To (Equal (balanceAfter ))
85
86
})
86
87
})
88
+
89
+ var _ = Describe ("Upgrade - Feemarket fees (non-taxable transactions)" , func () {
90
+ It ("should successfully submit a non-taxable transaction with sufficient fees (--gas-prices)" , func () {
91
+ // query feemarket gas price for the base minimal denom
92
+ gasPrice , err := cli .QueryFeemarketGasPrice (didtypes .BaseMinimalDenom )
93
+
94
+ // print the gas price
95
+ By ("Gas Price: " + gasPrice .Price .String ())
96
+
97
+ // assert no error
98
+ Expect (err ).To (BeNil ())
99
+
100
+ // define the coins to send, in which case 1,000,000,000 ncheq or 1 cheq
101
+ coins := sdk .NewCoin (didtypes .BaseMinimalDenom , sdk .NewInt (1_000_000_000 ))
102
+
103
+ // compute gas price, using offset
104
+ gasPrice .Price .Amount = gasPrice .Price .Amount .Mul (sdkmath .LegacyNewDec (didtypes .FeeOffset ))
105
+
106
+ // define feeParams
107
+ feeParams := []string {
108
+ "--gas" , cli .Gas ,
109
+ "--gas-adjustment" , cli .GasAdjustment ,
110
+ "--gas-prices" , gasPrice .Price .String (),
111
+ }
112
+
113
+ // send the coins, balance assertions are intentionally omitted or out of scope
114
+ res , err := cli .SendTokensTx (testdata .BASE_ACCOUNT_1 , testdata .BASE_ACCOUNT_2_ADDR , coins .String (), feeParams )
115
+
116
+ // assert no error
117
+ Expect (err ).To (BeNil ())
118
+
119
+ // assert the response code is 0
120
+ Expect (res .Code ).To (BeEquivalentTo (0 ))
121
+ })
122
+
123
+ It ("should successfully submit a non-taxable transaction with sufficient fees (--fees)" , func () {
124
+ // query feemarket gas price for the base minimal denom
125
+ gasPrice , err := cli .QueryFeemarketGasPrice (didtypes .BaseMinimalDenom )
126
+
127
+ // print the gas price
128
+ By ("Gas Price: " + gasPrice .Price .String ())
129
+
130
+ // assert no error
131
+ Expect (err ).To (BeNil ())
132
+
133
+ // define the coins to send, in which case 1,000,000,000 ncheq or 1 cheq
134
+ coins := sdk .NewCoin (didtypes .BaseMinimalDenom , sdk .NewInt (1_000_000_000 ))
135
+
136
+ // define static fees, in which case gas price is multiplied by roughly 3 or greater, times the minimal base denom
137
+ // consider multiplying in the range of [1.5, 3] times the gas price
138
+ gasPrice .Price .Amount = gasPrice .Price .Amount .Mul (sdkmath .LegacyNewDec (3 )).Mul (sdkmath .LegacyNewDec (didtypes .BaseFactor ))
139
+
140
+ // define feeParams
141
+ feeParams := helpers .GenerateFees (gasPrice .Price .String ())
142
+
143
+ // send the coins, balance assertions are intentionally omitted or out of scope
144
+ res , err := cli .SendTokensTx (testdata .BASE_ACCOUNT_1 , testdata .BASE_ACCOUNT_2_ADDR , coins .String (), feeParams )
145
+
146
+ // assert no error
147
+ Expect (err ).To (BeNil ())
148
+
149
+ // assert the response code is 0
150
+ Expect (res .Code ).To (BeEquivalentTo (0 ))
151
+ })
152
+ })
0 commit comments