This contract is still in the testing phase and has not been audited. Please do not use it in production.
- Protocolink is a router system which consolidates protocol interactions within a secure Router/Agent architecture in a single transaction.
- Protocolink is proficient in processing ERC-20, ERC-721, ERC-1155 and lending positions.
- Protocolink is protocol-agnostic. All protocol-related code is defined in the protocolink-logics) repository instead of in the contracts. Protocolink also offers an API and a SDK for developers to create transactions.
More details can be found at Protocolink Overview.
When a user tries to execute a transaction:
- ERC-20 tokens are transferred through the Permit2.
- The data is passed to an exclusive Agent through the Router.
- The Agent transfers tokens from the user and executes the data.
- After the data is executed, the Agent returns tokens back to the user.
Protocolink contracts consist of:
Router
: The single entry point for users to interact with. The Router forwards the data to an Agent when executing a transaction.Agent
: The execution unit of user transactions. The Agent executes the data like token transfer, liquidity provision, and yield farming.Callback
: The entry point for protocol callbacks to re-enter the Agent in a transaction.Utility
: The extensions for the Agent to perform extra actions like interacting with specific protocols, calculating token prices, and managing users data.
The details of each component can be found at Smart Contract Overview.
The code in this repository is built using the Foundry framework. You can follow these setup instructions if you have not set it up yet.
forge build
forge test –fork-url ${FOUNDRY_ETH_RPC_URL} --no-match-path 'test/invariants/*' --no-match-contract Radiant -vvv
forge test --match-path 'test/invariants/*' -vvv
forge coverage --rpc-url ${FOUNDRY_ETH_RPC_URL} --report summary
Fill out parameters in script/Deploy<network>.s.sol
- This script deploys all contracts whose
deployedAddress
equalsUNDEPLOYED
.
forge script --broadcast \
--rpc-url <RPC-URL> \
--private-key <PRIVATE-KEY> \
--sig 'run()' \
script/Deploy<network>.s.sol:Deploy<network> \
--slow
Fill out parameters in script/Deploy<network>.s.sol
forge script --broadcast \
--rpc-url <RPC-URL> \
--private-key <PRIVATE-KEY> \
--sig 'run()' \
script/Deploy<network>.s.sol:Deploy<network> \
--chain-id <CHAIN-ID> \
--etherscan-api-key <ETHERSCAN-API-KEY> \
--verify \
--slow