Skip to content

Commit d11ac04

Browse files
committed
init escrow module account
1 parent f73e518 commit d11ac04

File tree

4 files changed

+17
-4
lines changed

4 files changed

+17
-4
lines changed

app/app.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -644,6 +644,7 @@ func New(
644644
appCodec,
645645
keys[lendingtypes.StoreKey],
646646
keys[lendingtypes.MemStoreKey],
647+
app.AccountKeeper,
647648
app.BankKeeper,
648649
nil,
649650
app.AuctionKeeper,

tests/e2e/lending/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ func main() {
6464
borrowerPrivKeyHex := "7b769bcd5372539ce9ad7d4d80deb668cd07b9e6d90a6744ea7390b6b18aa55e"
6565

6666
depositAmount := sdk.NewInt64Coin("sat", 100000)
67-
borrowAmount := sdk.NewInt64Coin("uusdc", 8000000)
67+
borrowAmount := sdk.NewInt64Coin("uusdc", 2000000)
6868
loanPeriod := 1000000 * time.Minute
6969

7070
loanSecret := generateRandSecret()

x/lending/keeper/keeper.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
package keeper
22

33
import (
4+
"fmt"
5+
46
"cosmossdk.io/log"
57
storetypes "cosmossdk.io/store/types"
68
"github.com/cosmos/cosmos-sdk/codec"
79
sdk "github.com/cosmos/cosmos-sdk/types"
10+
811
"github.com/sideprotocol/side/x/lending/types"
912
)
1013

@@ -14,6 +17,7 @@ type (
1417
storeKey storetypes.StoreKey
1518
memKey storetypes.StoreKey
1619

20+
authKeeper types.AccountKeeper
1721
bankKeeper types.BankKeeper
1822
oracleKeeper types.OracleKeeper
1923
auctionKeeper types.AuctionKeeper
@@ -28,17 +32,24 @@ func NewKeeper(
2832
cdc codec.BinaryCodec,
2933
storeKey,
3034
memKey storetypes.StoreKey,
35+
ak types.AccountKeeper,
3136
bankKeeper types.BankKeeper,
3237
oracleKeeper types.OracleKeeper,
3338
auctionKeeper types.AuctionKeeper,
3439
dlcKeeper types.DLCKeeper,
3540
btcbridgeKeeper types.BtcBridgeKeeper,
3641
authority string,
3742
) Keeper {
43+
// ensure escrow module account is set
44+
if addr := ak.GetModuleAddress(types.RepaymentEscrowAccount); addr == nil {
45+
panic(fmt.Sprintf("%s module account has not been set", types.RepaymentEscrowAccount))
46+
}
47+
3848
return Keeper{
3949
cdc: cdc,
4050
storeKey: storeKey,
4151
memKey: memKey,
52+
authKeeper: ak,
4253
bankKeeper: bankKeeper,
4354
oracleKeeper: oracleKeeper,
4455
auctionKeeper: auctionKeeper,

x/lending/types/expected_keepers.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import (
77

88
sdkmath "cosmossdk.io/math"
99
sdk "github.com/cosmos/cosmos-sdk/types"
10-
"github.com/cosmos/cosmos-sdk/x/auth/types"
1110
banktype "github.com/cosmos/cosmos-sdk/x/bank/types"
1211

1312
auctiontypes "github.com/sideprotocol/side/x/auction/types"
@@ -17,8 +16,10 @@ import (
1716

1817
// AccountKeeper defines the expected account keeper used for simulations (noalias)
1918
type AccountKeeper interface {
20-
GetAccount(ctx sdk.Context, addr sdk.AccAddress) types.AccountI
21-
// Methods imported from account should be defined here
19+
GetAccount(ctx context.Context, addr sdk.AccAddress) sdk.AccountI
20+
21+
GetModuleAddress(name string) sdk.AccAddress
22+
GetModuleAccount(ctx context.Context, moduleName string) sdk.ModuleAccountI
2223
}
2324

2425
// BankKeeper defines the expected interface needed to retrieve account balances.

0 commit comments

Comments
 (0)