2222 MaxTime = time .Unix (253402297199 , 0 ).UTC ()
2323)
2424
25- // LockupKeeper provides a way to manage module storage.
26- type LockupKeeper struct {
25+ // Keeper provides a way to manage module storage.
26+ type Keeper struct {
2727 cdc codec.Codec
2828 storeKey sdk.StoreKey
2929
@@ -34,8 +34,8 @@ type LockupKeeper struct {
3434
3535// NewLockupKeeper returns an instance of Keeper.
3636func NewLockupKeeper (cdc codec.Codec , storeKey sdk.StoreKey , ak types.AccountKeeper ,
37- bk types.BankKeeper , dk types.DistrKeeper ) LockupKeeper {
38- return LockupKeeper {
37+ bk types.BankKeeper , dk types.DistrKeeper ) Keeper {
38+ return Keeper {
3939 cdc : cdc ,
4040 storeKey : storeKey ,
4141 ak : ak ,
@@ -45,12 +45,12 @@ func NewLockupKeeper(cdc codec.Codec, storeKey sdk.StoreKey, ak types.AccountKee
4545}
4646
4747// Logger returns a logger instance.
48- func (k LockupKeeper ) Logger (ctx sdk.Context ) log.Logger {
48+ func (k Keeper ) Logger (ctx sdk.Context ) log.Logger {
4949 return ctx .Logger ().With ("module" , fmt .Sprintf ("x/%s" , types .ModuleName ))
5050}
5151
5252// LockTokens lock tokens from an account for specified duration.
53- func (k LockupKeeper ) LockTokens (ctx sdk.Context , owner sdk.AccAddress ,
53+ func (k Keeper ) LockTokens (ctx sdk.Context , owner sdk.AccAddress ,
5454 coins sdk.Coins , duration time.Duration ) (* types.Lock , error ) {
5555 // create new lock object
5656 lock := & types.Lock {
@@ -71,7 +71,7 @@ func (k LockupKeeper) LockTokens(ctx sdk.Context, owner sdk.AccAddress,
7171
7272// UnlockTokens returns tokens back from the module account address to the lock owner.
7373// The ID associated with the lock must exist, and the current block time must be after lock end time.
74- func (k LockupKeeper ) UnlockTokens (ctx sdk.Context , lockID uint64 ) (unlockedTokens sdk.Coins , err error ) {
74+ func (k Keeper ) UnlockTokens (ctx sdk.Context , lockID uint64 ) (unlockedTokens sdk.Coins , err error ) {
7575 lock , err := k .LocksState (ctx ).Get (lockID )
7676 if err != nil {
7777 return nil , err
@@ -101,7 +101,7 @@ func (k LockupKeeper) UnlockTokens(ctx sdk.Context, lockID uint64) (unlockedToke
101101}
102102
103103// InitiateUnlocking starts the unlocking process of a lockup.
104- func (k LockupKeeper ) InitiateUnlocking (ctx sdk.Context , lockID uint64 ) (updatedLock * types.Lock , err error ) {
104+ func (k Keeper ) InitiateUnlocking (ctx sdk.Context , lockID uint64 ) (updatedLock * types.Lock , err error ) {
105105 // we get the lockup
106106 lock , err := k .LocksState (ctx ).Get (lockID )
107107 if err != nil {
@@ -125,7 +125,7 @@ func (k LockupKeeper) InitiateUnlocking(ctx sdk.Context, lockID uint64) (updated
125125}
126126
127127// UnlockAvailableCoins unlocks all the available coins for the provided account sdk.AccAddress.
128- func (k LockupKeeper ) UnlockAvailableCoins (ctx sdk.Context , account sdk.AccAddress ) (coins sdk.Coins , err error ) {
128+ func (k Keeper ) UnlockAvailableCoins (ctx sdk.Context , account sdk.AccAddress ) (coins sdk.Coins , err error ) {
129129 ids := k .LocksState (ctx ).UnlockedIDsByAddress (account )
130130
131131 coins = sdk .NewCoins ()
@@ -142,30 +142,30 @@ func (k LockupKeeper) UnlockAvailableCoins(ctx sdk.Context, account sdk.AccAddre
142142}
143143
144144// AccountLockedCoins returns the locked coins of the given sdk.AccAddress
145- func (k LockupKeeper ) AccountLockedCoins (ctx sdk.Context , account sdk.AccAddress ) (coins sdk.Coins , err error ) {
145+ func (k Keeper ) AccountLockedCoins (ctx sdk.Context , account sdk.AccAddress ) (coins sdk.Coins , err error ) {
146146 return k .LocksState (ctx ).IterateLockedCoins (account ), nil
147147}
148148
149149// AccountUnlockedCoins returns the unlocked coins of the given sdk.AccAddress
150- func (k LockupKeeper ) AccountUnlockedCoins (ctx sdk.Context , account sdk.AccAddress ) (coins sdk.Coins , err error ) {
150+ func (k Keeper ) AccountUnlockedCoins (ctx sdk.Context , account sdk.AccAddress ) (coins sdk.Coins , err error ) {
151151 return k .LocksState (ctx ).IterateUnlockedCoins (account ), nil
152152}
153153
154154// TotalLockedCoins returns the module account locked coins.
155- func (k LockupKeeper ) TotalLockedCoins (ctx sdk.Context ) (coins sdk.Coins , err error ) {
155+ func (k Keeper ) TotalLockedCoins (ctx sdk.Context ) (coins sdk.Coins , err error ) {
156156 return k .LocksState (ctx ).IterateTotalLockedCoins (), nil
157157}
158158
159159// LocksByDenom allows to iterate over types.Lock associated with a denom.
160160// CONTRACT: no writes on store can happen until the function exits.
161- func (k LockupKeeper ) LocksByDenom (ctx sdk.Context , do func (lock * types.Lock ) (stop bool )) (coins sdk.Coins , err error ) {
161+ func (k Keeper ) LocksByDenom (ctx sdk.Context , do func (lock * types.Lock ) (stop bool )) (coins sdk.Coins , err error ) {
162162 panic ("impl" )
163163}
164164
165165// LocksByDenomUnlockingAfter allows to iterate over types.Lock associated with a denom that unlock
166166// after the provided duration.
167167// CONTRACT: no writes on store can happen until the function exits.
168- func (k LockupKeeper ) LocksByDenomUnlockingAfter (ctx sdk.Context , denom string , duration time.Duration , do func (lock * types.Lock ) (stop bool )) {
168+ func (k Keeper ) LocksByDenomUnlockingAfter (ctx sdk.Context , denom string , duration time.Duration , do func (lock * types.Lock ) (stop bool )) {
169169 endTime := ctx .BlockTime ().Add (duration )
170170 state := k .LocksState (ctx )
171171 state .IterateCoinsByDenomUnlockingAfter (denom , endTime , func (id uint64 ) (stop bool ) {
0 commit comments