Protocolink is an infrastructural solution which enables developers to build user-oriented applications across web3 protocols. For those who do not know how to write smart contracts, Protocolink provides a SDK interface that allows anyone to integrate their projects with blockchains seamlessly.
Protocolink provides an easy way for developers to interact with blockchain protocols. For example, if developers want to help users repay their debt on Compound V3, they can create the repay logic from Protocolink in only two calls.
const repayQuotation = await protocolink.protocols.compoundv3.getRepayQuotation(chainId, {
marketId,
tokenIn: baseToken,
borrower: userAddress,
});
const repayLogic = protocolink.protocols.compoundv3.newRepayLogic(repayQuotation);
Protocolink also organizes configuration of all the supported protocols. Developers no longer need to maintain protocol token lists, contract addresses, and market information. Through utilizing our back end services, it allows them to focus on creating better user experiences and more integrated front-ends. From our experience with the Furucombo, it allowed the team to save 77% development hours by leveraging Protocolink to build the Furucombo Lending Dashboard.
Protocolink charges fees from users and shares the fees with developers who initiate transactions with a 50:50 split. The fees are automatically distributed in real time after the transaction is confirmed by the blockchain.
Yes. Protocolink contracts were also audited by PeckShield in November 2023 to protect developers from malicious behaviors. Another useful tip with Protocolink is that developers can send the transaction data to a simulated environment, like Tenderly, before sending the transaction to a real blockchain. Developers can verify the transaction results, and decide whether or not to send it if there are any modifications required beforehand.
All the protocols and blockchains integrated by Protocolink can be found below.
Protocols: AAVE-V2, AAVE-V3, Balancer-V2, Compound-V3, Morphoblue, OpenOcean-V2, Paraswap-V5, Radiant-V2, Spark, Syncswap, Uniswap-V3
Blockchains: Ethereum, Optimism, Gnosis Chain, Polygon, zkSync Era, Metis, Base, Arbitrum, Avalanche
Reference: https://docs.protocolink.com/networks-and-protocols
Protocolink is employed by the Furucombo team to manage their Lending Dashboard which allows users to adjust their lending positions in just a few clicks. The Furucombo Lending Dashboard focused on how to build complex logics, such as leverage collateral positions, and utilize Protocolink for the rest of the transaction parameters like token list, user approvals, and batch transactions. Thanks to Protocolink, the Furucombo team saved development hours in building the Furucombo Lending Dashboard.
In this paragraph, we will show you how to use Protocolink in personal projects, lending protocols, and/or wallets.
We will show you how to do a swap and supply on Compound V3 for your personal project, lending protocol, and wallet.
1. Create a swap logic
const paraswapV5 = protocolink.protocols.paraswapv5;
const swapTokenQuotation = await paraswapV5.getSwapTokenQuotation(chainId, {
input: {
token: mainnetTokens.USDC,
amount: '5000',
},
tokenOut: mainnetTokens.WETH,
slippage: 100,
});
const swapTokenLogic = paraswapV5.newSwapTokenLogic(swapTokenQuotation)
2. Create a Compound V3 supply logic. Note that the real supply amount is equal to the WETH amount from the previous swap, which is supported by the BalanceLink feature.
const compoundV3 = protocolink.protocols.compoundv3;
const supplyCollateralLogic = compoundV3.newSupplyCollateralLogic({
marketId: 'USDC',
input: {
token: mainnetTokens.WETH,
amount: '1',
},
balanceBps: 10000, // 100%
});
3. Batch the logics into one tx, send the user approval data and the tx on-chain
// initialize params
const chainId = 1;
const account = user.address;
const logics = [];
// batch logics
logics.push(swapTokenLogic);
logics.push(supplyCollateralLogic);
// get user approval data and send it on-chain
const estimateResult = await protocolink.estimateRouterData({ chainId, account, logics });
for (const approval of estimateResult.approvals) {
await expect(user.sendTransaction(approval)).to.not.be.reverted;
}
// user sign permit data for Protocolink User Agent
const { domain, types, values } = estimateResult.permitData;
const permitSig = await user._signTypedData(domain, types, values);
// user send the tx data on-chain
const transactionRequest = await protocolink.buildRouterTransactionRequest({
chainId,
account,
logics,
permitData,
permitSig,
});
await expect(user.sendTransaction(transactionRequest)).to.not.be.reverted;
In this example, If you are working on a lending protocol, Protocolink can help your users to leverage their collateral positions to get a better APY.
1. Create a flash loan
const balancerV2 = protocolink.protocols.balancerv2;
const [flashLoanLoanLogic, flashLoanRepayLogic] = balancerV2.newFlashLoanLogicPair([
{
token: mainnetTokens.WETH,
amount: '1',
},
]);
2. Create a supply logic, a borrow logic, and a swap logic
const compoundV3 = protocolink.protocols.compoundv3;
const supplyCollateralLogic = compoundV3.newSupplyCollateralLogic({
marketId: 'USDC',
input: {
token: mainnetTokens.WETH,
amount: '1',
},
});
const borrowLogic = compoundV3.newBorrowLogic({
marketId: 'USDC',
output: {
token: mainnetTokens.USDC,
amount: '4000',
},
});
const paraswapV5 = protocolink.protocols.paraswapv5;
const swapTokenQuotation = await paraswapV5.getSwapTokenQuotation(chainId, {
input: {
token: mainnetTokens.USDC,
amount: '4000',
},
tokenOut: mainnetTokens.WETH,
slippage: 100,
});
const swapTokenLogic = paraswapV5.newSwapTokenLogic(swapTokenQuotation);
3. Batch the logics together
logics.push(flashLoanLoanLogic);
logics.push(supplyCollateralLogic);
logics.push(borrowLogic);
logics.push(swapTokenLogic);
logics.push(flashLoanRepayLogic);
After the logics are batched to one transaction, and the user approval data is on-chain, the transaction can be sent on-chain like the previous example.
In this example, If you are working on a wallet, Protocolink can help your users to send multiple tokens simultaneously. For those who have on-chain positions, Protocolink can close their positions in a single transaction. Letโs see how to close positions in Protocolink.
1. Create a flash loan
const balancerV2 = protocolink.protocols.balancerv2;
const [flashLoanLoanLogic, flashLoanRepayLogic] = balancerV2.newFlashLoanLogicPair([
{
token: mainnetTokens.WETH,
amount: '1',
},
]);
2. Create a swap logic, a repay logic, a pull token logic and a withdraw logic
const paraswapV5 = protocolink.protocols.paraswapv5;
const swapTokenQuotation = await paraswapV5.getSwapTokenQuotation(chainId, {
input: {
token: mainnetTokens.WETH,
amount: '1',
},
tokenOut: mainnetTokens.USDC,
slippage: 100,
});
const swapTokenLogic = paraswapV5.newSwapTokenLogic(swapTokenQuotation);
const aaveV3 = protocolink.protocols.aavev3;
const repayQuotation = await aaveV3.getRepayQuotation(chainId, {
borrower: user.address,
tokenIn: mainnetTokens.USDC,
interestRateMode: 2, // InterestRateMode.variable
});
const repayLogic = aaveV3.newRepayLogic(repayQuotation);
const permit2 = protocolink.protocols.permit2;
const aEthWETH = {
chainId,
address: '0x4d5F47FA6A74757f35C14fD3a6Ef8E3C9BC514E8',
decimals: 18,
symbol: 'aEthWETH',
name: 'Aave Ethereum WETH',
};
const addFundsLogic = permit2.newPullTokenLogic({
input: {
token: aEthWETH,
amount: '1',
},
});
const withdrawQuotation = await aaveV3.getWithdrawQuotation(chainId, {
input: {
token: aEthWETH,
amount: '1',
},
tokenOut: mainnetTokens.WETH,
});
const withdrawLogic = aaveV3.newWithdrawLogic(withdrawQuotation);
After the logics are batched to one transaction and the user approval data is on-chain, the transaction can be sent on-chain to close user positions (like the steps shown in the previous examples).
If you want to have a quick taste of how Protocolink works without composing the logics in the previous examples, you can check out the Protocolink Lending SDK. The Protocolink Lending SDK is a toolkit built upon Protocolink and we will show how to use it to close user positions.
1. Close user positions
const portfolio = await lendingSDK.getPortfolio(user.address, 'aave-v3', 'mainnet');
const closeInfo = await lendingSDK.close({
account: user.address,
portfolio,
withdrawalToken: mainnetTokens.WETH,
slippage: 100,
});
console.log(closeInfo.logics);// the composed logics
As you can see, all the complex logics we composed in example 3 are done in only 2 function calls. Developers can build their tool like the Protocolink Lending SDK for specific user scenarios, OR leverage the Protocolink Lending SDK without reinventing the wheel again!
As some developers may ask, what if Protocolink does not support the protocols that they want to interact with? Does it mean they need to go back to the old ways to interact with blockchains by themselves? The answer is no. Protocolink provides another two ways for helping developers to interact with the protocols that Protocolink does not provide.
Protocolink provides a utility logic called CustomDataLogic. Developers can utilize this logic to interact with the protocols that Protocolink currently does not support. You can find how to use this logic in Protocolink Custom Data.
As some developers may be interested in contributing to Protocolink, we encourage these developers to follow our guidelines to publish a Github Pull Request. Once the pull request gets approved, others can easily leverage the new integration to serve more user scenarios.

