-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat!: Add support for standard ibc #614
Changes from all commits
f7e5ce3
0bb850e
e455c96
7ffd9ec
9ffc8d8
c3728b8
d81a17a
6bda8c5
76ff33c
cc3dc74
bb27038
85b9e2b
f648ff6
6384a25
a73a324
1c94289
2835a9e
ea5f007
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
package initconfig | ||
|
||
import ( | ||
"encoding/json" | ||
"fmt" | ||
"os" | ||
"strings" | ||
) | ||
|
||
type BankDenomMetadata struct { | ||
Base string `json:"base"` | ||
DenomUnits []BankDenomUnitMetadata `json:"denom_units"` | ||
Description string `json:"description"` | ||
Display string `json:"display"` | ||
Name string `json:"name"` | ||
Symbol string `json:"symbol"` | ||
} | ||
|
||
type BankDenomUnitMetadata struct { | ||
Aliases []string `json:"aliases"` | ||
Denom string `json:"denom"` | ||
Exponent uint `json:"exponent"` | ||
} | ||
|
||
func getBankDenomMetadata(denom string, decimals uint) string { | ||
displayDenom := denom[1:] | ||
|
||
metadata := []BankDenomMetadata{ | ||
{ | ||
Base: denom, | ||
DenomUnits: []BankDenomUnitMetadata{ | ||
{ | ||
Aliases: []string{}, | ||
Denom: denom, | ||
Exponent: 0, | ||
}, | ||
{ | ||
Aliases: []string{}, | ||
Denom: displayDenom, | ||
Exponent: decimals, | ||
}, | ||
}, | ||
Description: fmt.Sprintf("Denom metadata for %s (%s)", displayDenom, denom), | ||
Display: displayDenom, | ||
Name: displayDenom, | ||
Symbol: strings.ToUpper(displayDenom), | ||
}, | ||
} | ||
|
||
json, err := json.Marshal(metadata) | ||
if err != nil { | ||
return "" | ||
} | ||
|
||
return string(json) | ||
} | ||
|
||
func createTokenMetadaJSON(metadataPath string, denom string, decimals uint) error { | ||
metadata := getBankDenomMetadata(denom, decimals) | ||
if metadata == "" { | ||
return fmt.Errorf("failed to generate token metadata") | ||
} | ||
|
||
file, err := os.Create(metadataPath) | ||
if err != nil { | ||
return err | ||
} | ||
_, err = file.WriteString(metadata) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
return nil | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package migrate | ||
|
||
import ( | ||
"fmt" | ||
"os/exec" | ||
|
||
"github.com/dymensionxyz/roller/cmd/consts" | ||
"github.com/dymensionxyz/roller/cmd/utils" | ||
"github.com/dymensionxyz/roller/config" | ||
"github.com/dymensionxyz/roller/relayer" | ||
) | ||
|
||
type VersionMigratorV1000 struct{} | ||
|
||
func (v *VersionMigratorV1000) ShouldMigrate(prevVersion VersionData) bool { | ||
return prevVersion.Major < 1 | ||
} | ||
|
||
func (v *VersionMigratorV1000) PerformMigration(rlpCfg config.RollappConfig) error { | ||
fmt.Println("💈 Migrating Rollapp key...") | ||
migrateRollappKeyCmd := exec.Command(consts.Executables.RollappEVM, "keys", "migrate", "--home", rlpCfg.Home+"/relayer/keys/"+rlpCfg.RollappID, "--keyring-backend", "test") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. doesn't There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it doesn't have it. |
||
out, err := utils.ExecBashCommandWithStdout(migrateRollappKeyCmd) | ||
if err != nil { | ||
return err | ||
} | ||
fmt.Println(out.String()) | ||
fmt.Println("💈 Migrating Hub key...") | ||
migrateHubKeyCmd := exec.Command(consts.Executables.Dymension, "keys", "migrate", "--home", rlpCfg.Home+"/relayer/keys/"+rlpCfg.HubData.ID, "--keyring-backend", "test") | ||
out, err = utils.ExecBashCommandWithStdout(migrateHubKeyCmd) | ||
if err != nil { | ||
return err | ||
} | ||
fmt.Println(out.String()) | ||
fmt.Println("💈 Updating relayer configuration to match new relayer key...") | ||
if err := relayer.UpdateRlyConfigValue(rlpCfg, []string{"chains", rlpCfg.RollappID, "value", "extra-codecs"}, []string{"ethermint"}); err != nil { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the ethermint codec won't break something with non-evm rollapp? |
||
return err | ||
} | ||
return nil | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No changes required on the rollapp itself? how it's state will change to use the tendermint IBC?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the change to the rollapp itself is in the rollapp binary.