-
Notifications
You must be signed in to change notification settings - Fork 191
/
ica_account.go
33 lines (27 loc) · 991 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
22
23
24
25
26
27
28
29
30
31
32
33
package keeper
import (
"github.com/Stride-Labs/stride/x/stakeibc/types"
"github.com/cosmos/cosmos-sdk/store/prefix"
sdk "github.com/cosmos/cosmos-sdk/types"
)
// SetICAAccount set iCAAccount in the store
func (k Keeper) SetICAAccount(ctx sdk.Context, iCAAccount types.ICAAccount) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ICAAccountKey))
b := k.cdc.MustMarshal(&iCAAccount)
store.Set([]byte{0}, b)
}
// GetICAAccount returns iCAAccount
func (k Keeper) GetICAAccount(ctx sdk.Context) (val types.ICAAccount, found bool) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ICAAccountKey))
b := store.Get([]byte{0})
if b == nil {
return val, false
}
k.cdc.MustUnmarshal(b, &val)
return val, true
}
// RemoveICAAccount removes iCAAccount from the store
func (k Keeper) RemoveICAAccount(ctx sdk.Context) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ICAAccountKey))
store.Delete([]byte{0})
}