-
Notifications
You must be signed in to change notification settings - Fork 0
/
authz_signer.go
39 lines (32 loc) · 937 Bytes
/
authz_signer.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package zetaclient
import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/zeta-chain/zetacore/common"
crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types"
)
type AuthZSigner struct {
KeyType common.KeyType
GranterAddress string
GranteeAddress sdk.AccAddress
}
func (a AuthZSigner) String() string {
return a.KeyType.String() + " " + a.GranterAddress + " " + a.GranteeAddress.String()
}
var signers map[string]AuthZSigner
func init() {
signersList := make(map[string]AuthZSigner)
for _, tx := range crosschaintypes.GetAllAuthzZetaclientTxTypes() {
signersList[tx] = AuthZSigner{KeyType: common.ZetaClientGranteeKey}
}
signers = signersList
}
func SetupAuthZSignerList(granter string, grantee sdk.AccAddress) {
for k, v := range signers {
v.GranterAddress = granter
v.GranteeAddress = grantee
signers[k] = v
}
}
func GetSigner(msgURL string) AuthZSigner {
return signers[msgURL]
}