@@ -23,9 +23,12 @@ type TestnetValidator struct {
2323 OperatorAddress sdk.ValAddress
2424 ConsensusAddress sdk.ConsAddress
2525 ConsensusPubKey * types.Any
26+ Status stakingtypes.BondStatus
2627 Moniker string
2728 Commission stakingtypes.Commission
2829 MinSelfDelegation sdk.Int
30+ Tokens sdk.Int
31+ DelegatorShares sdk.Dec
2932}
3033
3134type TestnetUpgrade struct {
@@ -42,8 +45,13 @@ type TestnetGovConfig struct {
4245 } `json:"voting_params,omitempty"`
4346}
4447
48+ type TestnetAccount struct {
49+ Address sdk.AccAddress `json:"address"`
50+ Balances []sdk.Coin `json:"balances"`
51+ }
52+
4553type TestnetConfig struct {
46- Accounts []sdk. AccAddress
54+ Accounts []TestnetAccount
4755 Validators []TestnetValidator
4856 Gov TestnetGovConfig
4957 Upgrade TestnetUpgrade
@@ -137,27 +145,21 @@ func InitAkashAppForTestnet(
137145 OperatorAddress : val .OperatorAddress .String (),
138146 ConsensusPubkey : val .ConsensusPubKey ,
139147 Jailed : false ,
140- Status : stakingtypes . Bonded ,
141- Tokens : sdk . NewInt ( 900000000000000 ) ,
142- DelegatorShares : sdk . MustNewDecFromStr ( "10000000" ) ,
148+ Status : val . Status ,
149+ Tokens : val . Tokens ,
150+ DelegatorShares : val . DelegatorShares ,
143151 Description : stakingtypes.Description {
144- Moniker : "Testnet Validator" ,
145- },
146- Commission : stakingtypes.Commission {
147- CommissionRates : stakingtypes.CommissionRates {
148- Rate : sdk .MustNewDecFromStr ("0.05" ),
149- MaxRate : sdk .MustNewDecFromStr ("0.1" ),
150- MaxChangeRate : sdk .MustNewDecFromStr ("0.05" ),
151- },
152+ Moniker : val .Moniker ,
152153 },
153- MinSelfDelegation : sdk .OneInt (),
154+ Commission : val .Commission ,
155+ MinSelfDelegation : val .MinSelfDelegation ,
154156 }
155157
156158 // Add our validator to power and last validators store
157159 app .Keepers .Cosmos .Staking .SetValidator (ctx , newVal )
158160 err = app .Keepers .Cosmos .Staking .SetValidatorByConsAddr (ctx , newVal )
159161 if err != nil {
160- return nil
162+ panic ( err )
161163 }
162164
163165 app .Keepers .Cosmos .Staking .SetValidatorByPowerIndex (ctx , newVal )
@@ -189,7 +191,10 @@ func InitAkashAppForTestnet(
189191 Tombstoned : false ,
190192 }
191193
192- _ , _ = app .Keepers .Cosmos .Staking .ApplyAndReturnValidatorSetUpdates (ctx )
194+ _ , err = app .Keepers .Cosmos .Staking .ApplyAndReturnValidatorSetUpdates (ctx )
195+ if err != nil {
196+ panic (err )
197+ }
193198
194199 app .Keepers .Cosmos .Slashing .SetValidatorSigningInfo (ctx , newConsAddr , newValidatorSigningInfo )
195200 }
@@ -208,19 +213,25 @@ func InitAkashAppForTestnet(
208213 // BANK
209214 //
210215
211- defaultCoins := sdk .NewCoins (
212- sdk .NewInt64Coin ("uakt" , 1000000000000 ),
213- sdk .NewInt64Coin ("ibc/12C6A0C374171B595A0A9E18B83FA09D295FB1F2D8C6DAA3AC28683471752D84" , 1000000000000 ), // axlUSDC
214- )
215-
216216 for _ , account := range tcfg .Accounts {
217- err := app .Keepers .Cosmos .Bank .MintCoins (ctx , minttypes .ModuleName , defaultCoins )
217+ var coins sdk.Coins
218+
219+ if len (account .Balances ) > 0 {
220+ coins = sdk .NewCoins (account .Balances ... )
221+ } else {
222+ coins = sdk .NewCoins (
223+ sdk .NewInt64Coin ("uakt" , 1000000000000 ),
224+ sdk .NewInt64Coin ("ibc/12C6A0C374171B595A0A9E18B83FA09D295FB1F2D8C6DAA3AC28683471752D84" , 1000000000000 ), // axlUSDC
225+ )
226+ }
227+
228+ err := app .Keepers .Cosmos .Bank .MintCoins (ctx , minttypes .ModuleName , coins )
218229 if err != nil {
219- return nil
230+ panic ( err )
220231 }
221- err = app .Keepers .Cosmos .Bank .SendCoinsFromModuleToAccount (ctx , minttypes .ModuleName , account , defaultCoins )
232+ err = app .Keepers .Cosmos .Bank .SendCoinsFromModuleToAccount (ctx , minttypes .ModuleName , account . Address , coins )
222233 if err != nil {
223- return nil
234+ panic ( err )
224235 }
225236 }
226237
0 commit comments