|
11 | 11 | from pyinjective.constant import ADDITIONAL_CHAIN_FORMAT_DECIMALS, INJ_DECIMALS, INJ_DENOM |
12 | 12 | from pyinjective.core.market import BinaryOptionMarket, DerivativeMarket, SpotMarket |
13 | 13 | from pyinjective.core.token import Token |
| 14 | +from pyinjective.ofac import OfacChecker |
14 | 15 | from pyinjective.proto.cosmos.authz.v1beta1 import authz_pb2 as cosmos_authz_pb, tx_pb2 as cosmos_authz_tx_pb |
15 | 16 | from pyinjective.proto.cosmos.bank.v1beta1 import bank_pb2 as bank_pb, tx_pb2 as cosmos_bank_tx_pb |
16 | 17 | from pyinjective.proto.cosmos.base.v1beta1 import coin_pb2 as base_coin_pb |
@@ -147,6 +148,7 @@ def __init__( |
147 | 148 | self.derivative_markets = derivative_markets |
148 | 149 | self.binary_option_markets = binary_option_markets |
149 | 150 | self.tokens = tokens |
| 151 | + self._ofac_checker = OfacChecker() |
150 | 152 |
|
151 | 153 | def Coin(self, amount: int, denom: str): |
152 | 154 | """ |
@@ -471,6 +473,8 @@ def MsgBid(self, sender: str, bid_amount: float, round: float): |
471 | 473 |
|
472 | 474 | # region Authz module |
473 | 475 | def MsgGrantGeneric(self, granter: str, grantee: str, msg_type: str, expire_in: int): |
| 476 | + if self._ofac_checker.is_blacklisted(granter): |
| 477 | + raise Exception(f"Address {granter} is in the OFAC list") |
474 | 478 | auth = cosmos_authz_pb.GenericAuthorization(msg=msg_type) |
475 | 479 | any_auth = any_pb2.Any() |
476 | 480 | any_auth.Pack(auth, type_url_prefix="") |
@@ -2125,6 +2129,9 @@ def MsgGrantTyped( |
2125 | 2129 | subaccount_id: str, |
2126 | 2130 | **kwargs, |
2127 | 2131 | ): |
| 2132 | + if self._ofac_checker.is_blacklisted(granter): |
| 2133 | + raise Exception(f"Address {granter} is in the OFAC list") |
| 2134 | + |
2128 | 2135 | auth = None |
2129 | 2136 | if msg_type == "CreateSpotLimitOrderAuthz": |
2130 | 2137 | auth = injective_authz_pb.CreateSpotLimitOrderAuthz( |
|
0 commit comments