Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
@paraswap/dex-lib
Advanced tools
**DexLib** is a library used by ParaSwap backend to integrate with decentralized exchanges. This library enables external DEX developers to integrate their DEX with ParaSwap by creating pull requests to this repository.
DexLib is a library used by ParaSwap backend to integrate with decentralized exchanges. This library enables external DEX developers to integrate their DEX with ParaSwap by creating pull requests to this repository.
feature/super-dex
)yarn install
param-case
:yarn init-integration <your-dex-name>
You can find template code for newly integrated Dex in src/dex/<your-dex-name>
Complete the template code by filling the functions implementations. Template code is highly documented which should help you build the implementation. You should look into existing DEX implementation in src/dex/
to understand the interfaces. Please refer below for detailed explainations and good practices.
Add <your-dex-name>
to Dexes
list in src/dex/index.ts
Complete the test templates (All files with src/dex/<your-dex-name>/*.test.ts
). Each DEX implementation should have thorough testing. We have multiple kinds of tests each dex must have. You can refer to Writing Tests for detailed explaination. You can run all the tests using
yarn test-integration <your-dex-name>
One of the most important features of ParaSwap is to serve prices efficiently and quickly. As the number of requests grow, and blockchain get faster, it's not feasible to perform fullnode rpc calls to hundreds of pools for every pricing request. To solve this issue ParaSwap uses a novel event based pricing approach which allows to create pricing without performing the fullnode calls everytime. Event
are triggers released by the smart contract when certain changes happen. External services can easily subscribe to these events by websocket connection to a fullnode rpc.
To follow ParaSwap's event based approach DEX should fetch the required on chain state to do pricing once, subscribe to events, update state when events are released, and on price request only use in memory state to create prices.To make the whole event based approach easy to implement and optimized on backend, most of the implementation logic is abstracted and developers have to only obey a simple interface.
TODO: explain the blockmanager and stateful event subscriber
<you-dex-name>-integration.test.ts
): Tests the basic validity of the integration like prices are valid, obeys the limit pools, etc.<you-dex-name>-events.test.ts
): Unit tests the event based system. This is done by fetching the state on-chain before the event, manually pushing the block logs to the event subsriber, comparing the local state with on-chain state.<you-dex-name>-e2e.test.ts
): End to end test the intergation which involves pricing, transaction building and simulating the transaction on chain using tenderly fork simulations.FAQs
**DexLib** is a library used by ParaSwap backend to integrate with decentralized exchanges. This library enables external DEX developers to integrate their DEX with ParaSwap by creating pull requests to this repository.
The npm package @paraswap/dex-lib receives a total of 1,216 weekly downloads. As such, @paraswap/dex-lib popularity was classified as popular.
We found that @paraswap/dex-lib demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 9 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.