Skip to content

Commit

Permalink
Merge pull request #56 from TRON-US/add-trongrid-domain
Browse files Browse the repository at this point in the history
add trongrid domain
  • Loading branch information
Eric Chen authored Nov 4, 2020
2 parents 40d7526 + a7613c2 commit d589461
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
3 changes: 3 additions & 0 deletions init.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ func DefaultServicesConfig() Services {
ExchangeDomain: "https://exchange.bt.co",
SolidityDomain: "grpc.trongrid.io:50052",
FullnodeDomain: "grpc.trongrid.io:50051",
TrongridDomain: "https://api.trongrid.io",
EscrowPubKeys: []string{"CAISIQPAfB2Mt2ic+n3JcL4vrKXxBCmB0iNh+5BYiXdJNWed/Q=="},
GuardPubKeys: []string{"CAISIQJ16EiwvGko4SaBEEUFyMdNZp1vKsTLgIXCY6fRa3/Obg=="},
}
Expand All @@ -229,6 +230,7 @@ func DefaultServicesConfigDev() Services {
ExchangeDomain: "https://exchange-dev.bt.co",
SolidityDomain: "grpc.trongrid.io:50052",
FullnodeDomain: "grpc.trongrid.io:50051",
TrongridDomain: "https://api.shasta.trongrid.io",
EscrowPubKeys: []string{"CAISIQJOcRK0q4TOwpswAkvMMq33ksQfhplEyhHcZnEUFbthQg=="},
GuardPubKeys: []string{"CAISIQJhPBQWKPPjYcuPWR9sl+QlN0wJSRbQs3yUKmggvubXwg=="},
}
Expand All @@ -244,6 +246,7 @@ func DefaultServicesConfigTestnet() Services {
ExchangeDomain: "https://exchange-staging.bt.co",
SolidityDomain: "grpc.trongrid.io:50052",
FullnodeDomain: "grpc.trongrid.io:50051",
TrongridDomain: "https://api.shasta.trongrid.io",
EscrowPubKeys: []string{"CAISIQJOcRK0q4TOwpswAkvMMq33ksQfhplEyhHcZnEUFbthQg=="},
GuardPubKeys: []string{"CAISIQJhPBQWKPPjYcuPWR9sl+QlN0wJSRbQs3yUKmggvubXwg=="},
}
Expand Down
18 changes: 18 additions & 0 deletions migrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,23 @@ func migrate_15_MissingRemoteAPI(cfg *Config) bool {
return false
}

func migrate_16_TrongridDomain(cfg *Config) bool {
if strings.Contains(cfg.Services.EscrowDomain, "dev") || strings.Contains(cfg.Services.EscrowDomain, "staging") {
if len(cfg.Services.TrongridDomain) == 0 {
ds := DefaultServicesConfigTestnet()
cfg.Services.TrongridDomain = ds.TrongridDomain
return true
}
} else {
if len(cfg.Services.TrongridDomain) == 0 {
ds := DefaultServicesConfig()
cfg.Services.TrongridDomain = ds.TrongridDomain
return true
}
}
return false
}

// MigrateConfig migrates config options to the latest known version
// It may correct incompatible configs as well
// inited = just initialized in the same call
Expand All @@ -248,5 +265,6 @@ func MigrateConfig(cfg *Config, inited, hasHval bool) bool {
updated = migrate_13_HostContractManager(cfg) || updated
updated = migrate_14_TestnetBootstrapNodes(cfg) || updated
updated = migrate_15_MissingRemoteAPI(cfg) || updated
updated = migrate_16_TrongridDomain(cfg) || updated
return updated
}
1 change: 1 addition & 0 deletions services.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ type Services struct {
ExchangeDomain string
SolidityDomain string
FullnodeDomain string
TrongridDomain string

EscrowPubKeys []string
GuardPubKeys []string
Expand Down

0 comments on commit d589461

Please sign in to comment.