Closed PavelInjective closed 2 months ago
The changes introduce a compliance mechanism that checks Ethereum addresses against the Office of Foreign Assets Control (OFAC) sanctions list. A new JSON file containing sanctioned addresses is added, along with an OfacChecker
class responsible for loading and verifying these addresses. Modifications are made to the codebase to incorporate checks for blacklisted addresses during authorization and broadcasting processes, enhancing regulatory compliance.
Files | Change Summary |
---|---|
ofac.json |
Added a JSON file containing a list of sanctioned Ethereum addresses. |
pyinjective/composer.py |
Introduced OfacChecker for blacklisting checks in MsgGrantGeneric and MsgGrantTyped methods. |
pyinjective/core/broadcaster.py |
Added OfacChecker in BroadcasterAccountConfig to validate trading addresses. |
pyinjective/ofac.py |
Implemented OfacChecker class for managing the OFAC list, including methods for downloading and checking addresses. |
tests/core/test_broadcaster.py |
Created a unit test to verify broadcasting behavior with addresses in the OFAC list. |
sequenceDiagram
participant User
participant Composer
participant OfacChecker
participant Broadcaster
User->>Composer: Request MsgGrantGeneric
Composer->>OfacChecker: Check if granter is blacklisted
OfacChecker-->>Composer: Return blacklist status
alt Not Blacklisted
Composer-->>User: Grant authorization
else Blacklisted
Composer-->>User: Raise exception
end
User->>Broadcaster: Request to broadcast message
Broadcaster->>OfacChecker: Validate trading address
OfacChecker-->>Broadcaster: Return blacklist status
alt Not Blacklisted
Broadcaster-->>User: Broadcast message
else Blacklisted
Broadcaster-->>User: Raise exception
end
🐇 In the code, we now check,
For addresses that might wreck.
With OFAC's list in hand,
Compliance takes a stand.
No more sneaky trades to find,
Just safe paths for all, so kind! 🌟
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
@PavelInjective I am reviewing now the PR. In the meantime, could you please move the ofac.json
file inside pyinjective
folder? (like the denoms .ini files)
Summary by CodeRabbit
New Features
Bug Fixes
Tests