-
Notifications
You must be signed in to change notification settings - Fork 193
/
ica_account.go
21 lines (17 loc) · 949 Bytes
/
ica_account.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package types
import fmt "fmt"
// Helper function to build the host zone ICA owner in the form "{chainId}.{ICA_TYPE}"
func FormatHostZoneICAOwner(chainId string, accountType ICAAccountType) (result string) {
return chainId + "." + accountType.String()
}
// Helper function to build the ICA owner for a trade route ICA
// in the form "{chainId}.{rewardDenom}-{hostDenom}.{ICA_TYPE}"
func FormatTradeRouteICAOwner(chainId, rewardDenom, hostDenom string, icaAccountType ICAAccountType) string {
tradeRouteId := GetTradeRouteId(rewardDenom, hostDenom)
return FormatTradeRouteICAOwnerFromRouteId(chainId, tradeRouteId, icaAccountType)
}
// Helper function to build the ICA owner for a trade route ICA
// in the form "{chainId}.{tradeRouteId}.{ICA_TYPE}"
func FormatTradeRouteICAOwnerFromRouteId(chainId, tradeRouteId string, icaAccountType ICAAccountType) string {
return fmt.Sprintf("%s.%s.%s", chainId, tradeRouteId, icaAccountType.String())
}