GithubHelp home page GithubHelp logo

chouandy / protocolink-contract Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dinngo/protocolink-contract

0.0 1.0 0.0 2.62 MB

Core contracts of Protocolink

Home Page: https://docs.protocolink.com/smart-contract/overview

License: GNU General Public License v3.0

Solidity 100.00%

protocolink-contract's Introduction

Protocolink Contract

test

This contract is still in the testing phase and has not been audited. Please do not use it in production.

Overview

  • 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.

Contract

When a user tries to execute a transaction:

  1. ERC-20 tokens are transferred through the Permit2.
  2. The data is passed to an exclusive Agent through the Router.
  3. The Agent transfers tokens from the user and executes the data.
  4. 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.

Developer Guide

Prerequisites

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.

Build

forge build

Test

forge test –fork-url ${FOUNDRY_ETH_RPC_URL} --no-match-path 'test/invariants/*' --no-match-contract Radiant -vvv

Invariant Test

forge test --match-path 'test/invariants/*' -vvv

Coverage

forge coverage --rpc-url ${FOUNDRY_ETH_RPC_URL} --report summary

Deploy Contract(s)

Fill out parameters in script/Deploy<network>.s.sol

  • This script deploys all contracts whose deployedAddress equals UNDEPLOYED.
forge script --broadcast \
--rpc-url <RPC-URL> \
--private-key <PRIVATE-KEY> \
--sig 'run()' \
script/Deploy<network>.s.sol:Deploy<network> \
--slow

Deploy and Verify

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

protocolink-contract's People

Contributors

zodahu avatar hihiben avatar mussinalin avatar jeff-cch avatar ksin751119 avatar javanc avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.