Skip to content

Commit 865b1ce

Browse files
authored
feat: enforce usdc blacklist checks (#5)
1 parent f65893b commit 865b1ce

File tree

13 files changed

+236
-215
lines changed

13 files changed

+236
-215
lines changed

go.mod

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ go 1.21
44

55
require (
66
cosmossdk.io/errors v1.0.0
7+
github.com/circlefin/noble-fiattokenfactory v0.0.0-20240502160322-738932cb316d
78
github.com/cosmos/cosmos-sdk v0.45.16
89
github.com/gogo/protobuf v1.3.3
910
github.com/golang/protobuf v1.5.3
@@ -75,7 +76,6 @@ require (
7576
github.com/cosmos/gorocksdb v1.2.0 // indirect
7677
github.com/cosmos/iavl v0.19.5 // indirect
7778
github.com/cosmos/ledger-cosmos-go v0.12.2 // indirect
78-
github.com/creachadair/taskgroup v0.4.2 // indirect
7979
github.com/curioswitch/go-reassign v0.2.0 // indirect
8080
github.com/daixiang0/gci v0.11.2 // indirect
8181
github.com/danieljoos/wincred v1.1.2 // indirect
@@ -91,7 +91,6 @@ require (
9191
github.com/ettle/strcase v0.1.1 // indirect
9292
github.com/fatih/color v1.15.0 // indirect
9393
github.com/fatih/structtag v1.2.0 // indirect
94-
github.com/felixge/httpsnoop v1.0.2 // indirect
9594
github.com/firefart/nonamedreturns v1.0.4 // indirect
9695
github.com/fsnotify/fsnotify v1.6.0 // indirect
9796
github.com/fzipp/gocyclo v0.6.0 // indirect
@@ -140,13 +139,11 @@ require (
140139
github.com/hashicorp/errwrap v1.1.0 // indirect
141140
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
142141
github.com/hashicorp/go-multierror v1.1.1 // indirect
143-
github.com/hashicorp/go-uuid v1.0.2 // indirect
144142
github.com/hashicorp/go-version v1.6.0 // indirect
145143
github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d // indirect
146144
github.com/hashicorp/hcl v1.0.0 // indirect
147145
github.com/hdevalence/ed25519consensus v0.1.0 // indirect
148146
github.com/hexops/gotextdiff v1.0.3 // indirect
149-
github.com/improbable-eng/grpc-web v0.15.0 // indirect
150147
github.com/inconshreveable/mousetrap v1.1.0 // indirect
151148
github.com/jgautheron/goconst v1.6.0 // indirect
152149
github.com/jingyugao/rowserrcheck v1.1.1 // indirect
@@ -206,7 +203,6 @@ require (
206203
github.com/regen-network/cosmos-proto v0.3.1 // indirect
207204
github.com/rivo/uniseg v0.4.3 // indirect
208205
github.com/rogpeppe/go-internal v1.10.0 // indirect
209-
github.com/rs/cors v1.8.3 // indirect
210206
github.com/ryancurrah/gomodguard v1.3.0 // indirect
211207
github.com/ryanrolds/sqlclosecheck v0.5.1 // indirect
212208
github.com/sanposhiho/wastedassign/v2 v2.0.7 // indirect

go.sum

Lines changed: 2 additions & 183 deletions
Large diffs are not rendered by default.

go.work.sum

Lines changed: 49 additions & 4 deletions
Large diffs are not rendered by default.

local.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ if ! [ -f .halo/data/priv_validator_state.json ]; then
2727
halod add-genesis-account entitlements-pending-owner 10000000uusdc --home .halo --keyring-backend test
2828

2929
TEMP=.halo/genesis.json
30+
touch $TEMP && jq '.app_state.bank.denom_metadata = [{ "description": "Circle USD Coin", "denom_units": [{ "denom": "uusdc", "exponent": 0, "aliases": ["microusdc"] }, { "denom": "usdc", "exponent": 6 }], "base": "uusdc", "display": "usdc", "name": "Circle USD Coin", "symbol": "USDC" }]' .halo/config/genesis.json > $TEMP && mv $TEMP .halo/config/genesis.json
3031
touch $TEMP && jq '.app_state.staking.params.bond_denom = "ustake"' .halo/config/genesis.json > $TEMP && mv $TEMP .halo/config/genesis.json
32+
touch $TEMP && jq '.app_state."fiat-tokenfactory".mintingDenom = { "denom": "uusdc" }' .halo/config/genesis.json > $TEMP && mv $TEMP .halo/config/genesis.json
3133
touch $TEMP && jq '.app_state.halo.aggregator_state.owner = '$AGGREGATOR_OWNER'' .halo/config/genesis.json > $TEMP && mv $TEMP .halo/config/genesis.json
3234
touch $TEMP && jq '.app_state.halo.entitlements_state.owner = '$ENTITLEMENTS_OWNER'' .halo/config/genesis.json > $TEMP && mv $TEMP .halo/config/genesis.json
3335
touch $TEMP && jq '.app_state.halo.owner = '$OWNER'' .halo/config/genesis.json > $TEMP && mv $TEMP .halo/config/genesis.json

simapp/app.go

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ import (
4545
tmos "github.com/tendermint/tendermint/libs/os"
4646
dbm "github.com/tendermint/tm-db"
4747

48+
ftf "github.com/circlefin/noble-fiattokenfactory/x/fiattokenfactory"
49+
ftfkeeper "github.com/circlefin/noble-fiattokenfactory/x/fiattokenfactory/keeper"
50+
ftftypes "github.com/circlefin/noble-fiattokenfactory/x/fiattokenfactory/types"
51+
4852
"github.com/noble-assets/halo/x/halo"
4953
halokeeper "github.com/noble-assets/halo/x/halo/keeper"
5054
halotypes "github.com/noble-assets/halo/x/halo/types"
@@ -59,13 +63,15 @@ var (
5963
genutil.AppModuleBasic{},
6064
params.AppModuleBasic{},
6165
staking.AppModuleBasic{},
66+
ftf.AppModuleBasic{},
6267
halo.AppModuleBasic{},
6368
)
6469

6570
permissions = map[string][]string{
6671
authtypes.FeeCollectorName: nil,
6772
stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking},
6873
stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking},
74+
ftftypes.ModuleName: {authtypes.Burner, authtypes.Minter},
6975
halotypes.ModuleName: {authtypes.Burner, authtypes.Minter},
7076
}
7177
)
@@ -95,6 +101,7 @@ type SimApp struct {
95101
ParamsKeeper paramskeeper.Keeper
96102
StakingKeeper stakingkeeper.Keeper
97103
// Custom Modules
104+
FTFKeeper *ftfkeeper.Keeper
98105
HaloKeeper *halokeeper.Keeper
99106
}
100107

@@ -128,7 +135,7 @@ func NewSimApp(
128135

129136
keys := sdk.NewKVStoreKeys(
130137
authtypes.StoreKey, banktypes.StoreKey, paramstypes.StoreKey, stakingtypes.StoreKey,
131-
halotypes.ModuleName,
138+
ftftypes.StoreKey, halotypes.ModuleName,
132139
)
133140
tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey)
134141

@@ -154,7 +161,7 @@ func NewSimApp(
154161
)
155162

156163
app.HaloKeeper = halokeeper.NewKeeper(
157-
appCodec, keys[halotypes.ModuleName], "uusyc", "uusdc", app.AccountKeeper, nil, interfaceRegistry,
164+
appCodec, keys[halotypes.ModuleName], "uusyc", "uusdc", app.AccountKeeper, nil, nil, interfaceRegistry,
158165
)
159166
app.BankKeeper = bankkeeper.NewBaseKeeper(
160167
appCodec, keys[banktypes.StoreKey], app.AccountKeeper, app.GetSubspace(banktypes.ModuleName), app.ModuleAccountAddrs(),
@@ -165,6 +172,11 @@ func NewSimApp(
165172
appCodec, keys[stakingtypes.StoreKey], app.AccountKeeper, app.BankKeeper, app.GetSubspace(stakingtypes.ModuleName),
166173
)
167174

175+
app.FTFKeeper = ftfkeeper.NewKeeper(
176+
appCodec, keys[ftftypes.StoreKey], app.GetSubspace(ftftypes.ModuleName), app.BankKeeper,
177+
)
178+
app.HaloKeeper.SetFTFKeeper(app.FTFKeeper)
179+
168180
app.mm = module.NewManager(
169181
auth.NewAppModule(appCodec, app.AccountKeeper, nil),
170182
bank.NewAppModule(appCodec, app.BankKeeper.(bankkeeper.BaseKeeper), app.AccountKeeper),
@@ -174,20 +186,23 @@ func NewSimApp(
174186
),
175187
params.NewAppModule(app.ParamsKeeper),
176188
staking.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper),
189+
ftf.NewAppModule(appCodec, app.FTFKeeper, app.AccountKeeper, app.BankKeeper),
177190
halo.NewAppModule(app.HaloKeeper),
178191
)
179192

180193
app.mm.SetOrderBeginBlockers(
181194
stakingtypes.ModuleName, authtypes.ModuleName, banktypes.ModuleName, genutiltypes.ModuleName, paramstypes.ModuleName,
182-
halotypes.ModuleName,
195+
ftftypes.ModuleName, halotypes.ModuleName,
183196
)
184197
app.mm.SetOrderEndBlockers(
185198
stakingtypes.ModuleName, authtypes.ModuleName, banktypes.ModuleName, genutiltypes.ModuleName, paramstypes.ModuleName,
186-
halotypes.ModuleName,
199+
ftftypes.ModuleName, halotypes.ModuleName,
187200
)
201+
// NOTE: FiatTokenFactory has to be initialized before x/genutils, so that
202+
// the Halo send restrictions can execute on the gentxs.
188203
app.mm.SetOrderInitGenesis(
189-
authtypes.ModuleName, banktypes.ModuleName, stakingtypes.ModuleName, genutiltypes.ModuleName, paramstypes.ModuleName,
190-
halotypes.ModuleName,
204+
authtypes.ModuleName, banktypes.ModuleName, stakingtypes.ModuleName, ftftypes.ModuleName, genutiltypes.ModuleName,
205+
paramstypes.ModuleName, halotypes.ModuleName,
191206
)
192207

193208
app.mm.RegisterRoutes(app.Router(), app.QueryRouter(), encodingConfig.Amino)
@@ -295,6 +310,7 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
295310
paramsKeeper.Subspace(authtypes.ModuleName)
296311
paramsKeeper.Subspace(banktypes.ModuleName)
297312
paramsKeeper.Subspace(stakingtypes.ModuleName)
313+
paramsKeeper.Subspace(ftftypes.ModuleName)
298314

299315
return paramsKeeper
300316
}

simapp/go.mod

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ module github.com/noble-assets/halo/simapp
33
go 1.21
44

55
require (
6+
github.com/circlefin/noble-fiattokenfactory v0.0.0-20240502160322-738932cb316d
67
github.com/cosmos/cosmos-sdk v0.45.16
78
github.com/noble-assets/halo v1.0.0
89
github.com/spf13/cast v1.5.1
@@ -16,6 +17,7 @@ require (
1617
cosmossdk.io/core v0.5.1 // indirect
1718
cosmossdk.io/depinject v1.0.0-alpha.3 // indirect
1819
cosmossdk.io/errors v1.0.0 // indirect
20+
cosmossdk.io/math v1.0.0-beta.4 // indirect
1921
filippo.io/edwards25519 v1.0.0 // indirect
2022
github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect
2123
github.com/99designs/keyring v1.2.2 // indirect
@@ -29,6 +31,7 @@ require (
2931
github.com/cenkalti/backoff/v4 v4.1.1 // indirect
3032
github.com/cespare/xxhash v1.1.0 // indirect
3133
github.com/cespare/xxhash/v2 v2.2.0 // indirect
34+
github.com/circlefin/noble-cctp v0.0.0-20240409141251-69ee090808c0 // indirect
3235
github.com/cockroachdb/errors v1.9.1 // indirect
3336
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect
3437
github.com/cockroachdb/pebble v0.0.0-20230209160836-829675f94811 // indirect
@@ -42,6 +45,7 @@ require (
4245
github.com/cosmos/go-bip39 v1.0.0 // indirect
4346
github.com/cosmos/gorocksdb v1.2.0 // indirect
4447
github.com/cosmos/iavl v0.19.5 // indirect
48+
github.com/cosmos/ibc-go/v4 v4.5.1 // indirect
4549
github.com/cosmos/ledger-cosmos-go v0.12.2 // indirect
4650
github.com/creachadair/taskgroup v0.4.2 // indirect
4751
github.com/danieljoos/wincred v1.1.2 // indirect
@@ -53,6 +57,7 @@ require (
5357
github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect
5458
github.com/dustin/go-humanize v1.0.1 // indirect
5559
github.com/dvsekhvalnov/jose2go v1.5.0 // indirect
60+
github.com/ethereum/go-ethereum v1.12.0 // indirect
5661
github.com/felixge/httpsnoop v1.0.2 // indirect
5762
github.com/fsnotify/fsnotify v1.6.0 // indirect
5863
github.com/getsentry/sentry-go v0.18.0 // indirect
@@ -79,6 +84,7 @@ require (
7984
github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d // indirect
8085
github.com/hashicorp/hcl v1.0.0 // indirect
8186
github.com/hdevalence/ed25519consensus v0.1.0 // indirect
87+
github.com/holiman/uint256 v1.2.2-0.20230321075855-87b91420868c // indirect
8288
github.com/improbable-eng/grpc-web v0.15.0 // indirect
8389
github.com/inconshreveable/mousetrap v1.1.0 // indirect
8490
github.com/jmhodges/levigo v1.0.0 // indirect
@@ -96,8 +102,6 @@ require (
96102
github.com/minio/highwayhash v1.0.2 // indirect
97103
github.com/mitchellh/mapstructure v1.5.0 // indirect
98104
github.com/mtibben/percent v0.2.1 // indirect
99-
github.com/onsi/gomega v1.28.0 // indirect
100-
github.com/otiai10/copy v1.11.0 // indirect
101105
github.com/pelletier/go-toml/v2 v2.0.8 // indirect
102106
github.com/petermattis/goid v0.0.0-20230317030725-371a4b8eda08 // indirect
103107
github.com/pkg/errors v0.9.1 // indirect
@@ -148,7 +152,7 @@ replace (
148152
github.com/ChainSafe/go-schnorrkel => github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d
149153

150154
// use send restriction compatible cosmos/cosmos-sdk
151-
github.com/cosmos/cosmos-sdk => github.com/noble-assets/cosmos-sdk v0.45.17-0.20240525075530-8fac7fa77ac6
155+
github.com/cosmos/cosmos-sdk => github.com/noble-assets/cosmos-sdk v0.45.16-send-restrictions
152156

153157
// use macos sonoma compatible cosmos/ledger-cosmos-go
154158
github.com/cosmos/ledger-cosmos-go => github.com/cosmos/ledger-cosmos-go v0.12.4

simapp/go.sum

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ cosmossdk.io/depinject v1.0.0-alpha.3 h1:6evFIgj//Y3w09bqOUOzEpFj5tsxBqdc5CfkO7z
5050
cosmossdk.io/depinject v1.0.0-alpha.3/go.mod h1:eRbcdQ7MRpIPEM5YUJh8k97nxHpYbc3sMUnEtt8HPWU=
5151
cosmossdk.io/errors v1.0.0 h1:nxF07lmlBbB8NKQhtJ+sJm6ef5uV1XkvPXG2bUntb04=
5252
cosmossdk.io/errors v1.0.0/go.mod h1:+hJZLuhdDE0pYN8HkOrVNwrIOYvUGnn6+4fjnJs/oV0=
53+
cosmossdk.io/math v1.0.0-beta.4 h1:JtKedVLGzA0vv84xjYmZ75RKG35Kf2WwcFu8IjRkIIw=
54+
cosmossdk.io/math v1.0.0-beta.4/go.mod h1:An0MllWJY6PxibUpnwGk8jOm+a/qIxlKmL5Zyp9NnaM=
5355
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
5456
filippo.io/edwards25519 v1.0.0-rc.1/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns=
5557
filippo.io/edwards25519 v1.0.0 h1:0wAIcmJUqRdI8IJ/3eGi5/HwXZWPujYXXlkrQogz0Ek=
@@ -240,6 +242,10 @@ github.com/chavacava/garif v0.1.0/go.mod h1:XMyYCkEL58DF0oyW4qDjjnPWONs2HBqYKI+U
240242
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
241243
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
242244
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
245+
github.com/circlefin/noble-cctp v0.0.0-20240409141251-69ee090808c0 h1:bgfsdlSW1b42l+n0Qa+MO5u5XQh5pDyQzemddP7wlI4=
246+
github.com/circlefin/noble-cctp v0.0.0-20240409141251-69ee090808c0/go.mod h1:ssEHJqFI1f4a5sLtZ7qeYJ7/75LzDgzbBv4C9as3y3w=
247+
github.com/circlefin/noble-fiattokenfactory v0.0.0-20240502160322-738932cb316d h1:fjoPjY5XAEuppXXf86zstq35B+87tUA94aRUkX9lQNk=
248+
github.com/circlefin/noble-fiattokenfactory v0.0.0-20240502160322-738932cb316d/go.mod h1:0Imc1/GSaR8Ic2ssKJGN4EmNbyDGuTGY8AEvmWeao7w=
243249
github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag=
244250
github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I=
245251
github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE=
@@ -295,6 +301,8 @@ github.com/cosmos/gorocksdb v1.2.0 h1:d0l3jJG8M4hBouIZq0mDUHZ+zjOx044J3nGRskwTb4
295301
github.com/cosmos/gorocksdb v1.2.0/go.mod h1:aaKvKItm514hKfNJpUJXnnOWeBnk2GL4+Qw9NHizILw=
296302
github.com/cosmos/iavl v0.19.5 h1:rGA3hOrgNxgRM5wYcSCxgQBap7fW82WZgY78V9po/iY=
297303
github.com/cosmos/iavl v0.19.5/go.mod h1:X9PKD3J0iFxdmgNLa7b2LYWdsGd90ToV5cAONApkEPw=
304+
github.com/cosmos/ibc-go/v4 v4.5.1 h1:+P73X7aIikGAXBUJ9vP9rEbvdSuekt3KGXmAWCSYets=
305+
github.com/cosmos/ibc-go/v4 v4.5.1/go.mod h1:2EOi40Bx/j6rJrtP1ui8k8yUAMpGybmL1EjakYqYv5U=
298306
github.com/cosmos/ledger-cosmos-go v0.12.4 h1:drvWt+GJP7Aiw550yeb3ON/zsrgW0jgh5saFCr7pDnw=
299307
github.com/cosmos/ledger-cosmos-go v0.12.4/go.mod h1:fjfVWRf++Xkygt9wzCsjEBdjcf7wiiY35fv3ctT+k4M=
300308
github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE=
@@ -374,6 +382,8 @@ github.com/esimonov/ifshort v1.0.4 h1:6SID4yGWfRae/M7hkVDVVyppy8q/v9OuxNdmjLQStB
374382
github.com/esimonov/ifshort v1.0.4/go.mod h1:Pe8zjlRrJ80+q2CxHLfEOfTwxCZ4O+MuhcHcfgNWTk0=
375383
github.com/etcd-io/bbolt v1.3.3/go.mod h1:ZF2nL25h33cCyBtcyWeZ2/I3HQOfTP+0PIEvHjkjCrw=
376384
github.com/ethereum/go-ethereum v1.10.17/go.mod h1:Lt5WzjM07XlXc95YzrhosmR4J9Ahd6X2wyEV2SvGhk0=
385+
github.com/ethereum/go-ethereum v1.12.0 h1:bdnhLPtqETd4m3mS8BGMNvBTf36bO5bx/hxE2zljOa0=
386+
github.com/ethereum/go-ethereum v1.12.0/go.mod h1:/oo2X/dZLJjf2mJ6YT9wcWxa4nNJDBKDBU6sFIpx1Gs=
377387
github.com/ettle/strcase v0.1.1 h1:htFueZyVeE1XNnMEfbqp5r67qAN/4r6ya1ysq8Q+Zcw=
378388
github.com/ettle/strcase v0.1.1/go.mod h1:hzDLsPC7/lwKyBOywSHEP89nt2pDgdy+No1NBA9o9VY=
379389
github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c h1:8ISkoahWXwZR41ois5lSJBSVw4D0OV19Ht/JSTzvSv0=
@@ -701,6 +711,8 @@ github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUq
701711
github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg=
702712
github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA=
703713
github.com/holiman/uint256 v1.2.0/go.mod h1:y4ga/t+u+Xwd7CpDgZESaRcWy0I7XMlTMA25ApIH5Jw=
714+
github.com/holiman/uint256 v1.2.2-0.20230321075855-87b91420868c h1:DZfsyhDK1hnSS5lH8l+JggqzEleHteTYfutAiVlSUM8=
715+
github.com/holiman/uint256 v1.2.2-0.20230321075855-87b91420868c/go.mod h1:SC8Ryt4n+UBbPbIBKaG9zbbDlp4jOru9xFZmPzLUTxw=
704716
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
705717
github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg=
706718
github.com/huin/goupnp v1.0.3-0.20220313090229-ca81a64b4204/go.mod h1:ZxNlw5WqJj6wSsRK5+YfflQGXYfccj5VgQsMNixHM7Y=
@@ -945,8 +957,8 @@ github.com/nishanths/exhaustive v0.11.0 h1:T3I8nUGhl/Cwu5Z2hfc92l0e04D2GEW6e0l8p
945957
github.com/nishanths/exhaustive v0.11.0/go.mod h1:RqwDsZ1xY0dNdqHho2z6X+bgzizwbLYOWnZbbl2wLB4=
946958
github.com/nishanths/predeclared v0.2.2 h1:V2EPdZPliZymNAn79T8RkNApBjMmVKh5XRpLm/w98Vk=
947959
github.com/nishanths/predeclared v0.2.2/go.mod h1:RROzoN6TnGQupbC+lqggsOlcgysk3LMK/HI84Mp280c=
948-
github.com/noble-assets/cosmos-sdk v0.45.17-0.20240525075530-8fac7fa77ac6 h1:OQaEHkr9WFtqM08NBFdYtazuH/OAreBhclte3QOekvc=
949-
github.com/noble-assets/cosmos-sdk v0.45.17-0.20240525075530-8fac7fa77ac6/go.mod h1:bScuNwWAP0TZJpUf+SHXRU3xGoUPp+X9nAzfeIXts40=
960+
github.com/noble-assets/cosmos-sdk v0.45.16-send-restrictions h1:oQwbCoejkXp2/ozQSwc//A6UW9wJl71YgP7o04MsYq0=
961+
github.com/noble-assets/cosmos-sdk v0.45.16-send-restrictions/go.mod h1:bScuNwWAP0TZJpUf+SHXRU3xGoUPp+X9nAzfeIXts40=
950962
github.com/nunnatsa/ginkgolinter v0.14.0 h1:XQPNmw+kZz5cC/HbFK3mQutpjzAQv1dHregRA+4CGGg=
951963
github.com/nunnatsa/ginkgolinter v0.14.0/go.mod h1:cm2xaqCUCRd7qcP4DqbVvpcyEMkuLM9CF0wY6VASohk=
952964
github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78=
@@ -1808,4 +1820,6 @@ rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
18081820
rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
18091821
rsc.io/tmplfunc v0.0.3/go.mod h1:AG3sTPzElb1Io3Yg4voV9AGZJuleGAwaVRxL9M49PhA=
18101822
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
1823+
sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo=
1824+
sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8=
18111825
sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU=

utils/mocks/fiattokenfactory.go

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package mocks
2+
3+
import (
4+
"bytes"
5+
6+
ftftypes "github.com/circlefin/noble-fiattokenfactory/x/fiattokenfactory/types"
7+
sdk "github.com/cosmos/cosmos-sdk/types"
8+
"github.com/noble-assets/halo/x/halo/types"
9+
)
10+
11+
var _ types.FiatTokenFactoryKeeper = FTFKeeper{}
12+
13+
type FTFKeeper struct {
14+
Paused bool
15+
Blacklist [][]byte
16+
}
17+
18+
func (k FTFKeeper) GetBlacklisted(_ sdk.Context, bz []byte) (ftftypes.Blacklisted, bool) {
19+
for _, addrBytes := range k.Blacklist {
20+
if bytes.Equal(addrBytes, bz) {
21+
return ftftypes.Blacklisted{AddressBz: bz}, true
22+
}
23+
}
24+
return ftftypes.Blacklisted{AddressBz: bz}, false
25+
}
26+
27+
func (k FTFKeeper) GetPaused(_ sdk.Context) ftftypes.Paused {
28+
return ftftypes.Paused{Paused: k.Paused}
29+
}
30+
31+
func (k FTFKeeper) GetMintingDenom(_ sdk.Context) ftftypes.MintingDenom {
32+
return ftftypes.MintingDenom{Denom: "uusdc"}
33+
}

utils/mocks/halo.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,13 @@ func HaloKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) {
2020
BankKeeper{
2121
Restriction: NoOpSendRestrictionFn,
2222
},
23+
FTFKeeper{
24+
Paused: false,
25+
},
2326
)
2427
}
2528

26-
func HaloKeeperWithKeepers(_ testing.TB, account AccountKeeper, bank BankKeeper) (*keeper.Keeper, sdk.Context) {
29+
func HaloKeeperWithKeepers(_ testing.TB, account AccountKeeper, bank BankKeeper, ftf FTFKeeper) (*keeper.Keeper, sdk.Context) {
2730
key := storetypes.NewKVStoreKey(types.ModuleName)
2831
tkey := storetypes.NewTransientStoreKey("transient_halo")
2932
ctx := testutil.DefaultContext(key, tkey)
@@ -39,6 +42,7 @@ func HaloKeeperWithKeepers(_ testing.TB, account AccountKeeper, bank BankKeeper)
3942
"uusdc",
4043
account,
4144
nil,
45+
ftf,
4246
registry,
4347
)
4448

0 commit comments

Comments
 (0)