feat: ASI mobix staking replacement#348
Conversation
… feat/asi-mobix-staking-replacement # Conflicts: # cmd/fetchd/cmd/genasiupgrade.go
cmd/fetchd/cmd/genasiupgrade.go
Outdated
| contracts := jsonData["wasm"].(map[string]interface{})["contracts"].([]interface{}) | ||
| MobixStakingContractAddress := networkInfo.Contracts.MobixStaking.Addr | ||
|
|
||
| re := regexp.MustCompile(fmt.Sprintf(`%s%s1([%s]{%d})$`, OldAddrPrefix, "", Bech32Chars, AddrDataLength+AddrChecksumLength)) |
There was a problem hiding this comment.
| re := regexp.MustCompile(fmt.Sprintf(`%s%s1([%s]{%d})$`, OldAddrPrefix, "", Bech32Chars, AddrDataLength+AddrChecksumLength)) | |
| re := regexp.MustCompile(fmt.Sprintf(`$(stakes|unbond_entries)%s%s1([%s]{%d,%d})$`, OldAddrPrefix, "", Bech32Chars, 32+AddrChecksumLength, 52+AddrChecksumLength)) |
or, probably even better:
| re := regexp.MustCompile(fmt.Sprintf(`%s%s1([%s]{%d})$`, OldAddrPrefix, "", Bech32Chars, AddrDataLength+AddrChecksumLength)) | |
| re := regexp.MustCompile(fmt.Sprintf(`$(stakes|unbond_entries)%s%s1([%s]{%d,%d})$`, OldAddrPrefix, "", Bech32Chars, AddrChecksumLength, 52+AddrChecksumLength)) |
Above suggested $(stakes|unbond_entries) start of the regexp is overkill, due to complications with multiple matches.
Perhaps, simpler solution would be simply check the key value manually whether it starts with the "stakes" or "unbond_entries" strings and pass follosing substring in to the address conversion functionm which would return just converted address, which would then be conctatenated back with original "stakes" or "unbond_entries" prefix.
There was a problem hiding this comment.
I would use leven higher value then 52 (which supposed to be for contract address, and at the moment it looks like it is largest address length we know of), for example at least 60, or even 100.
… feat/asi-mobix-staking-replacement # Conflicts: # cmd/fetchd/cmd/genesis-asi-upgrade.go
No description provided.