⚠️ This repository is archived and read-only.The public Protocolink API and SDK were discontinued on October 2, 2026, and related smart contracts have been permanently disabled. Protocolink now operates as an enterprise integration service by Dinngo.
Enterprise inquiries: support@dinngo.co
An SDK that build protocol logics for Protocolink
- Fork this repository.
- Set up your development environment and install the required dependencies.
- Create a New Logic:
- Add a new folder under
src/logicsnamed after the protocol (protocolId), using Hyphenation format. - Create a new logic file under
src/logics/{protocolId}, named with the action name (logicId). Prefix it withlogic.and use Hyphenation format. The file name should belogic.{logicId}.ts.
- Implement the Logic:
- Implement the Logic class in the logic file using PascalCase. Append
Logicto the action name. - Extend the
core.Logicclass. - Implement the following interfaces based on the requirements:
core.LogicTokenListInterface: The tokens list function.core.LogicOracleInterface: The quotation function.core.LogicBuilderInterface: The txdata encode function for interacting with contracts.
Example:
class LogicExampleLogic
extends core.Logic
implements core.LogicTokenListInterface, core.LogicOracleInterface, core.LogicBuilderInterface {
// Your implementation here
}- Reference Examples:
- Explore reference examples for different categories:
- Lending: Aave V3, Compound V3
- Swap: Uniswap V3, ParaSwap V5
- FlashLoan: Aave V3, Balancer V2
- More: GO
- Unit Testing:
- Write tests that won't fail based on block number increments.
- Test files are in the same path as the logic files, named
logic.{logicId}.test.ts. - Write tests for functions like
getTokenList()andbuild()as needed.
- Integration Testing:
- Write tests that interact with the Router contract in real time.
- Test files are in
test/logics/{protocolId}/, named{logicId}.test.ts. - Utilize Logic's quotation functions to generate Logic Data for contract interactions.
- Verify transaction success and expected changes in user asset balances.
- Submit a Pull Request (PR):
- Use the PR template for PR content. Fill in the template and submit the PR.
- Enable "Allow edits by maintainers" when creating the PR.
- If your PR isn't merged promptly, feel free to ask for assistance on our Discord.
- Discord: Join Our Community
-
Install the required dependencies
yarn install
-
Generate protocol's abi TypeScript classes
# - abi files: src/{protocol}/abis/*.json # - contracts dir: src/{protocol}/contracts yarn cli typechain
-
Run protocol's tests
yarn cli test -
Run protocol's script
yarn cli script
yarn hardhat test [test file]Install the package via npm:
npm install --save-dev @protocolink/logicsor yarn:
yarn add --dev @protocolink/logics