@@ -78,17 +78,17 @@ var networkInfos = map[string]NetworkConfig{
7878 OldDenom : "afet" ,
7979 },
8080 SupplyInfo : SupplyInfo {
81- SupplyToMint : "100000000000000000000000000" , // TODO(JS): likely amend this
81+ SupplyToMint : "0" , // TODO(JS): likely amend this
8282 UpdatedSupplyOverflowAddr : "fetch15p3rl5aavw9rtu86tna5lgxfkz67zzr6ed4yhw" , // TODO(JS): likely amend this
8383 },
8484 IbcTargetAddr : "fetch1rhrlzsx9z865dqen8t4v47r99dw6y4va4uph0x" , // TODO(JS): amend this
8585 ReconciliationTargetAddr : & ReconciliationTargetAddr , // TODO(JS): amend this
8686 Contracts : & Contracts {
8787 Almanac : & Almanac {
88- Addr : "fetch1mezzhfj7qgveewzwzdk6lz5sae4dunpmmsjr9u7z0tpmdsae8zmquq3y0y" , // mainnet STAGING contract,
88+ StagingAddr : "fetch1mezzhfj7qgveewzwzdk6lz5sae4dunpmmsjr9u7z0tpmdsae8zmquq3y0y" , // mainnet STAGING contract,
8989 },
9090 AName : & AName {
91- Addr : "fetch1479lwv5vy8skute5cycuz727e55spkhxut0valrcm38x9caa2x8q99ef0q" , // mainnet DEVELOPMENT contract,
91+ StagingAddr : "fetch1479lwv5vy8skute5cycuz727e55spkhxut0valrcm38x9caa2x8q99ef0q" , // mainnet STAGING contract,
9292 },
9393 MobixStaking : & MobixStaking {
9494 Addr : "fetch1xr3rq8yvd7qplsw5yx90ftsr2zdhg4e9z60h5duusgxpv72hud3szdul6e" , // TODO(JS): amend this
@@ -101,32 +101,34 @@ var networkInfos = map[string]NetworkConfig{
101101 },
102102
103103 "dorado-1" : {
104- NewChainID : "asi -1" , // TODO(JS): likely amend this
104+ NewChainID : "eridanus -1" ,
105105 NewDescription : "Test ASI token" , // TODO(JS): confirm this
106106 DenomInfo : DenomInfo {
107107 NewBaseDenom : "testasi" ,
108108 NewDenom : "atestasi" ,
109109 OldDenom : "atestfet" ,
110110 },
111111 SupplyInfo : SupplyInfo {
112- SupplyToMint : "100000000000000000000000000" , // TODO(JS): likely amend this
112+ SupplyToMint : "0" , // TODO(JS): likely amend this
113113 UpdatedSupplyOverflowAddr : "fetch15p3rl5aavw9rtu86tna5lgxfkz67zzr6ed4yhw" , // TODO(JS): likely amend this
114114 },
115- IbcTargetAddr : "fetch1rhrlzsx9z865dqen8t4v47r99dw6y4va4uph0x" , // TODO(JS): amend this
115+ // IbcTargetAddr: "fetch1rhrlzsx9z865dqen8t4v47r99dw6y4va4uph0x", // TODO(JS): amend this
116116 Contracts : & Contracts {
117117 Almanac : & Almanac {
118- Addr : "fetch135h26ys2nwqealykzey532gamw4l4s07aewpwc0cyd8z6m92vyhsplf0vp" , // testnet DEVELOPMENT contract,
118+ StagingAddr : "fetch1tjagw8g8nn4cwuw00cf0m5tl4l6wfw9c0ue507fhx9e3yrsck8zs0l3q4w" , // testnet STAGING contract,
119+ DevAddr : "fetch135h26ys2nwqealykzey532gamw4l4s07aewpwc0cyd8z6m92vyhsplf0vp" , // testnet DEVELOPMENT contract,
119120 },
120121 AName : & AName {
121- Addr : "fetch1kewgfwxwtuxcnppr547wj6sd0e5fkckyp48dazsh89hll59epgpspmh0tn" , // testnet DEVELOPMENT contract,
122+ DevAddr : "fetch1kewgfwxwtuxcnppr547wj6sd0e5fkckyp48dazsh89hll59epgpspmh0tn" , // testnet DEVELOPMENT contract,
123+ StagingAddr : "fetch1mxz8kn3l5ksaftx8a9pj9a6prpzk2uhxnqdkwuqvuh37tw80xu6qges77l" , // testnet STAGING contract,
122124 },
123125 MobixStaking : & MobixStaking {
124126 Addr : "fetch1xr3rq8yvd7qplsw5yx90ftsr2zdhg4e9z60h5duusgxpv72hud3szdul6e" ,
125127 },
126- TokenBridge : & TokenBridge {
127- Addr : "fetch1kewgfwxwtuxcnppr547wj6sd0e5fkckyp48dazsh89hll59epgpspmh0tn " ,
128- NewAdmin : "fetch15p3rl5aavw9rtu86tna5lgxfkz67zzr6ed4yhw " ,
129- },
128+ // TokenBridge: &TokenBridge{
129+ // Addr: "",
130+ // NewAdmin: "",
131+ // },
130132 FccCw20 : & FccCw20 {
131133 Addr : "fetch1s0p7pwtm8qhvh2sfpg0ajgl20hwtehr0vcztyeku0vkzzvg044xqx4t7pt" ,
132134 },
@@ -209,16 +211,10 @@ func ASIGenesisUpgradeCmd(defaultNodeHome string) *cobra.Command {
209211 ASIGenesisUpgradeUpdateFccIssuanceContract (jsonData , networkConfig )
210212
211213 // withdraw balances from IBC channels
212- if err = ASIGenesisUpgradeWithdrawIBCChannelsBalances (jsonData , networkConfig , & manifest ); err != nil {
213- return err
214- }
214+ ASIGenesisUpgradeWithdrawIBCChannelsBalances (jsonData , networkConfig , & manifest )
215215
216216 // withdraw balances from reconciliation addresses
217- if networkConfig .ReconciliationTargetAddr != nil {
218- if err = ASIGenesisUpgradeWithdrawReconciliationBalances (jsonData , networkConfig , & manifest ); err != nil {
219- return err
220- }
221- }
217+ ASIGenesisUpgradeWithdrawReconciliationBalances (jsonData , networkConfig , & manifest )
222218
223219 // set denom metadata in bank module
224220 ASIGenesisUpgradeReplaceDenomMetadata (jsonData , networkConfig )
@@ -274,6 +270,9 @@ func replaceAddressInContractStateKey2(keyBytes []byte, prefix []byte) string {
274270 panic (err )
275271 }
276272
273+ // set to new address length
274+ address1Len = len (address1 )
275+
277276 var buffer bytes.Buffer
278277 writer := bufio .NewWriter (& buffer )
279278
@@ -607,23 +606,33 @@ func ASIGenesisUpgradeReplaceAlmanacState(jsonData map[string]interface{}, netwo
607606 return
608607 }
609608
610- almanacContractAddress := networkInfo .Contracts .Almanac .Addr
611- almanacContract := getContractFromAddr (almanacContractAddress , jsonData )
609+ for _ , addr := range []string {networkInfo .Contracts .Almanac .StagingAddr , networkInfo .Contracts .Almanac .DevAddr } {
610+ if addr == "" {
611+ continue
612+ }
613+
614+ almanacContract := getContractFromAddr (addr , jsonData )
612615
613- // empty the almanac contract state
614- almanacContract ["contract_state" ] = []interface {}{}
616+ // empty the almanac contract state
617+ almanacContract ["contract_state" ] = []interface {}{}
618+ }
615619}
616620
617621func ASIGenesisUpgradeReplaceANameState (jsonData map [string ]interface {}, networkInfo NetworkConfig ) {
618- if networkInfo .Contracts != nil && networkInfo .Contracts .AName ! = nil {
622+ if networkInfo .Contracts == nil || networkInfo .Contracts .AName = = nil {
619623 return
620624 }
621625
622- anameContractAddress := networkInfo .Contracts .AName .Addr
623- anameContract := getContractFromAddr (anameContractAddress , jsonData )
626+ for _ , addr := range []string {networkInfo .Contracts .AName .StagingAddr , networkInfo .Contracts .AName .DevAddr } {
627+ if addr == "" {
628+ continue
629+ }
630+
631+ anameContract := getContractFromAddr (addr , jsonData )
624632
625- // empty the AName contract state
626- anameContract ["contract_state" ] = []interface {}{}
633+ // empty the AName contract state
634+ anameContract ["contract_state" ] = []interface {}{}
635+ }
627636}
628637
629638func getContractFromAddr (addr string , jsonData map [string ]interface {}) map [string ]interface {} {
@@ -666,7 +675,11 @@ func replaceAddresses(addressTypePrefix string, jsonData map[string]interface{},
666675 })
667676}
668677
669- func ASIGenesisUpgradeWithdrawIBCChannelsBalances (jsonData map [string ]interface {}, networkInfo NetworkConfig , manifest * ASIUpgradeManifest ) error {
678+ func ASIGenesisUpgradeWithdrawIBCChannelsBalances (jsonData map [string ]interface {}, networkInfo NetworkConfig , manifest * ASIUpgradeManifest ) {
679+ if networkInfo .IbcTargetAddr == "" {
680+ return
681+ }
682+
670683 bank := jsonData [banktypes .ModuleName ].(map [string ]interface {})
671684 balances := bank ["balances" ].([]interface {})
672685 balanceMap := getGenesisBalancesMap (balances )
@@ -678,8 +691,7 @@ func ASIGenesisUpgradeWithdrawIBCChannelsBalances(jsonData map[string]interface{
678691 }
679692 withdrawalBalanceIdx , ok := (* balanceMap )[ibcWithdrawalAddress ]
680693 if ! ok {
681- fmt .Println ("failed to find ibc withdrawal address in genesis balances - have addresses already been converted?" )
682- return nil
694+ panic ("failed to find ibc withdrawal address in genesis balances - have addresses already been converted?" )
683695 }
684696
685697 ibc := jsonData [ibccore .ModuleName ].(map [string ]interface {})
@@ -697,7 +709,7 @@ func ASIGenesisUpgradeWithdrawIBCChannelsBalances(jsonData map[string]interface{
697709 rawAddr := ibctransfertypes .GetEscrowAddress (portId , channelId )
698710 channelAddr , err := sdk .Bech32ifyAddressBytes (OldAddrPrefix + AccAddressPrefix , rawAddr )
699711 if err != nil {
700- return fmt . Errorf ( "failed to bech32ify address: %w" , err )
712+ panic ( err )
701713 }
702714
703715 balanceIdx , ok := (* balanceMap )[channelAddr ]
@@ -718,8 +730,6 @@ func ASIGenesisUpgradeWithdrawIBCChannelsBalances(jsonData map[string]interface{
718730 // zero out the channel balance
719731 balances [balanceIdx ].(map [string ]interface {})["coins" ] = []interface {}{}
720732 }
721-
722- return nil
723733}
724734
725735func getGenesisAccountSequenceMap (accounts []interface {}) * map [string ]int {
@@ -749,7 +759,11 @@ func getGenesisAccountSequenceMap(accounts []interface{}) *map[string]int {
749759 return & accountMap
750760}
751761
752- func ASIGenesisUpgradeWithdrawReconciliationBalances (jsonData map [string ]interface {}, networkInfo NetworkConfig , manifest * ASIUpgradeManifest ) error {
762+ func ASIGenesisUpgradeWithdrawReconciliationBalances (jsonData map [string ]interface {}, networkInfo NetworkConfig , manifest * ASIUpgradeManifest ) {
763+ if networkInfo .ReconciliationTargetAddr == nil {
764+ return
765+ }
766+
753767 bank := jsonData [banktypes .ModuleName ].(map [string ]interface {})
754768 balances := bank ["balances" ].([]interface {})
755769 reconciliationWithdrawAddress := networkInfo .ReconciliationTargetAddr
@@ -769,7 +783,7 @@ func ASIGenesisUpgradeWithdrawReconciliationBalances(jsonData map[string]interfa
769783
770784 reconciliationBalanceIdx , ok := (* balanceMap )[* reconciliationWithdrawAddress ]
771785 if ! ok {
772- return fmt . Errorf ("no match in genesis for reconciliation address: %s" , * reconciliationWithdrawAddress )
786+ panic ("no match in genesis for reconciliation withdraw address" )
773787 }
774788
775789 manifest .Reconciliation = & ASIUpgradeTransfers {
@@ -784,7 +798,7 @@ func ASIGenesisUpgradeWithdrawReconciliationBalances(jsonData map[string]interfa
784798
785799 accSequence , ok := (* accountSequenceMap )[addr ]
786800 if ! ok {
787- return fmt . Errorf ("no match in genesis for reconciliation address: %s" , addr )
801+ panic ("no match in genesis for reconciliation address" )
788802 }
789803
790804 balanceIdx , ok := (* balanceMap )[addr ]
@@ -812,7 +826,6 @@ func ASIGenesisUpgradeWithdrawReconciliationBalances(jsonData map[string]interfa
812826 // zero out the reconciliation account balance
813827 balances [balanceIdx ].(map [string ]interface {})["coins" ] = []interface {}{}
814828 }
815- return nil
816829}
817830
818831func ASIGenesisUpgradeASISupply (jsonData map [string ]interface {}, networkInfo NetworkConfig , manifest * ASIUpgradeManifest ) {
@@ -823,7 +836,9 @@ func ASIGenesisUpgradeASISupply(jsonData map[string]interface{}, networkInfo Net
823836 panic ("asi upgrade update supply: failed to convert new supply value to int" )
824837 }
825838
826- if additionalSupply .LT (sdk .ZeroInt ()) {
839+ if additionalSupply .IsZero () {
840+ return
841+ } else if additionalSupply .LT (sdk .ZeroInt ()) {
827842 panic ("asi upgrade update supply: additional supply value is negative" )
828843 }
829844
@@ -986,11 +1001,13 @@ type TokenBridge struct {
9861001}
9871002
9881003type Almanac struct {
989- Addr string
1004+ DevAddr string
1005+ StagingAddr string
9901006}
9911007
9921008type AName struct {
993- Addr string
1009+ DevAddr string
1010+ StagingAddr string
9941011}
9951012
9961013type MobixStaking struct {
0 commit comments