-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Docs/lk exploration [SLT-170] (#3141)
* Refactor of docs * folder organization * sidebar organization * refactor of CCTP and RFQ docs pages * Bridge SDK and Synapse Router * Brand assets page * animated logo v1 * interactive animated logo --------- Co-authored-by: abtestingalpha <[email protected]> Co-authored-by: defi-moses <[email protected]> Co-authored-by: Moses <[email protected]>
- Loading branch information
1 parent
8f1899d
commit de34cf0
Showing
93 changed files
with
4,191 additions
and
1,900 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--- | ||
title: Synapse DAO | ||
--- | ||
|
||
# Synapse DAO | ||
|
||
Since launch of the Synapse Protocol, a number of governance initiatives have been put forward and voted on by the Synapse DAO. | ||
|
||
## Governance Model | ||
|
||
SYN holders with more than 100,000 SYN tokens can put forward proposals to be voted on by the DAO. SYN holders can vote using SYN on multiple chains, or delegate their votes to other token holders. | ||
|
||
In order to be adopted by the DAO, a proposal must gather at least `50% + 1` of all votes and reach the minimum quorum of 5 million SYN tokens. | ||
|
||
## Governance Components | ||
|
||
* **[Forum](https://forum.synapseprotocol.com/)**: A Platform to post proposals for discussion before an official vote | ||
* **[Snapshot](https://snapshot.org/#/synapseprotocol.eth)**: A decentralized governance platform for conducting official votes. | ||
* **[Discord](https://discord.gg/synapseprotocol)**: Discussion channel for general Synapse matters |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Brand Assets | ||
|
||
### [synapse-brand-assets.zip](/brand-assets/synapse-brand-assets.zip) | ||
|
||
## Logo | ||
|
||
| Name | Image | | ||
|----------------------------------------------------------------------|- | ||
| [`synapse-logo-onLight.svg`](/brand-assets/synapse-logo-onLight.svg) | ![Synapse logo](/brand-assets/synapse-logo-onLight.svg) | ||
| [`synapse-logo-onDark.svg`](/brand-assets/synapse-logo-onDark.svg) | ![Synapse logo](/brand-assets/synapse-logo-onDark.svg) | ||
| [`synapse-logo-black.svg`](/brand-assets/synapse-logo-black.svg) | ![Synapse logo](/brand-assets/synapse-logo-black.svg) | ||
| [`synapse-logo-white.svg`](/brand-assets/synapse-logo-white.svg) | ![Synapse logo](/brand-assets/synapse-logo-white.svg) | ||
|
||
## Mark | ||
|
||
| Name | Image | | ||
|--------------------------------------------------------------------|- | ||
| [`synapse-mark.svg`](/brand-assets/synapse-mark.svg) | ![Synapse logo](/brand-assets/synapse-mark.svg) | ||
| [`synapse-mark-white.svg`](/brand-assets/synapse-mark-white.svg) | ![Synapse logo](/brand-assets/synapse-mark-white.svg) | ||
| [`synapse-mark-black.svg`](/brand-assets/synapse-mark-black.svg) | ![Synapse logo](/brand-assets/synapse-mark-black.svg) | ||
| [`synapse-border-mark.svg`](/brand-assets/synapse-border-mark.svg) | ![Synapse logo](/brand-assets/synapse-border-mark.svg) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import Routes from '@site/src/components/Routes' | ||
|
||
# Chains & Tokens | ||
|
||
This page contains a list of supported tokens, listed per-chain. For a given pair, use the [Synapse Bridge](https://synapseprotocol.com) to see if a route between them exists. | ||
|
||
<Routes /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
--- | ||
title: About | ||
--- | ||
|
||
import AnimatedLogo from '@site/src/components/AnimatedLogo' | ||
import SVGBridge from '@site/src/components/SVGBridge' | ||
import { BridgeFlow } from '@site/src/components/BridgeFlow' | ||
import { CCTPFlow } from '@site/src/components/CCTPFlow' | ||
import { RFQFlow } from '@site/src/components/RFQFlow' | ||
|
||
<AnimatedLogo /> | ||
|
||
# Use Synapse | ||
|
||
Synapse is an Interchain Programming Interface. Developers read and write interchain data with Synapse, which has settled $50B in transactions between 2M+ users, and generated $30M+ in fees. | ||
|
||
Source: [Synapse Explorer analytics](https://explorer.synapseprotocol.com). | ||
|
||
## Interchain Bridge | ||
|
||
<figure> | ||
<SVGBridge /> | ||
<figcaption>Synapse Bridge</figcaption> | ||
</figure> | ||
|
||
* [Overview](/docs/Bridge) | ||
* [Bridge guide](/docs/Bridge#how-to-bridge) | ||
<!-- * [Supported routes](/docs/Bridge#how-to-bridge) --> | ||
|
||
## Developers | ||
|
||
Embed or build a custom Bridge application. | ||
|
||
* **[SDK](/docs/Bridge/SDK)** – Call Synapse Router functions from your frontend or backend application. | ||
* **[REST API](/docs/Bridge/REST-API)** – Endpoints and example code | ||
* **[Widget](/docs/Bridge/Widget)** – Embed a customized Synapse Bridge in your application. | ||
|
||
## Synapse Routers | ||
|
||
Synapse Router automatically determines the appropriate router for each Bridge transaction. | ||
|
||
* **[Synapse Router](/docs/Routers/Synapse-Router)** – Returns and executes quotes for supported interchain transactions. | ||
* **[CCTP](/docs/Routers/CCTP)** – Native router for USDC transactions. | ||
* **[RFQ](/docs/Routers/RFQ)** – Relayers bid for the right to provide immediate delivery. | ||
|
||
<figure id="flowGroup"> | ||
<figure> | ||
<BridgeFlow /> | ||
<figcaption>Synapse Router – Mint and burn any token between chains</figcaption> | ||
</figure> | ||
<figure> | ||
<CCTPFlow /> | ||
<figcaption>CCTP – Use Circle contracts to mint and burn native USDC</figcaption> | ||
</figure> | ||
<figure> | ||
<RFQFlow /> | ||
<figcaption>RFQ – Take Immediate delivery from a destination relayer, who receives your origin chain assets on confirmation.</figcaption> | ||
</figure> | ||
</figure> | ||
|
||
## Community & Support | ||
|
||
Connect with other developers and the Synapse team | ||
|
||
* **[Discord](https://discord.gg/synapseprotocol)** | ||
* **[Twitter](https://twitter.com/SynapseProtocol)** | ||
* **[Telegram](https://t.me/synapseprotocol)** | ||
* **[Forum](https://forum.synapseprotocol.com/)** | ||
|
||
## Additional Links | ||
|
||
Synapse transactions can be observed confirmed via the following methods: | ||
|
||
* **[Synapse Bridge](https://synapseprotocol.com)** – Bridge, Swap, and Stake via Synapse's cross-chain pools. | ||
* **[Synapse Explorer](https://explorer.synapseprotocol.com)** – Public explorer for Synapse Bridge transactions. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,222 @@ | ||
--- | ||
title: Bridge SDK | ||
--- | ||
|
||
# Bridge SDK | ||
|
||
The Synapse Bridge SDK is the easiest way to integrate cross-chain token & liquidity transfers into your application. It is fully isomorphic and can be used on both client and server sides. | ||
|
||
The Synapse Bridge SDK is built on top of the [Synapse Router](/docs/Routers/Synapse-Router) contract. | ||
|
||
### Use cases | ||
|
||
* Integrate your front-end application with the Synapse Bridge. | ||
* Provide bridge liquidity. | ||
* Perform cross-chain arbitrage. | ||
* Integrate the Synapse Javascript SDK with your non-Javascript application. | ||
|
||
## Install | ||
|
||
:::note requires Node v16+ | ||
|
||
The SDK has only been fully tested on Node 16+ or greater. Earlier versions are not guaranteed to work. | ||
|
||
::: | ||
|
||
Requires either the `npx` or `yarn` package manager. | ||
|
||
| Options | ||
|- | ||
| `npx install @synapsecns/sdk-router` | ||
| `yarn install @synapsecns/sdk-router` | ||
|
||
## Configure Ethers | ||
|
||
The SDK package relies on the `@ethersproject` and `ethers` dependencies, installed from `npm`. | ||
|
||
To begin constructing bridge-related transactions, first set up your environment wiht your providers, and format them, along with the `chainIds` you will be using, to set up a `SynapseSDK` instance. | ||
|
||
#### Ethers v5 | ||
|
||
```js | ||
//Set up providers (RPCs) for each chain desired | ||
const arbitrumProvider: Provider = new ethers.providers.JsonRpcProvider( | ||
'https://arb1.arbitrum.io/rpc' | ||
) | ||
const avalancheProvider: Provider = new ethers.providers.JsonRpcProvider( | ||
'https://api.avax.network/ext/bc/C/rpc' | ||
) | ||
|
||
//Structure arguments properly | ||
const chainIds = [42161, 43114] | ||
const providers = [arbitrumProvider, avalancheProvider] | ||
|
||
//Set up a SynapseSDK instance | ||
const Synapse = new SynapseSDK(chainIds, providers) | ||
``` | ||
|
||
#### Ethers v6 | ||
|
||
:::tip Ethers v6 | ||
|
||
Use of Ethers v6 requires the `@ethersproject/providers` dependency to be installed via `npm` or `yarn`: | ||
* `npm install @ethersproject/providers@^5.7.2` | ||
* `yarn add @ethersproject/providers@^5.7.2` | ||
|
||
::: | ||
|
||
```js | ||
import { JsonRpcProvider } from '@ethersproject/providers' | ||
|
||
//Set up providers (RPCs) for each chain desired | ||
const arbitrumProvider: Provider = new JsonRpcProvider( | ||
'https://arb1.arbitrum.io/rpc' | ||
) | ||
const avalancheProvider: Provider = new JsonRpcProvider( | ||
'https://api.avax.network/ext/bc/C/rpc' | ||
) | ||
|
||
//Structure arguments properly | ||
const chainIds = [42161, 43114] | ||
const providers = [arbitrumProvider, avalancheProvider] | ||
|
||
//Set up a SynapseSDK instance | ||
const Synapse = new SynapseSDK(chainIds, providers) | ||
``` | ||
|
||
## Functions | ||
|
||
:::tip Query Data Type | ||
|
||
`originQuery` and `destQuery`, returned by `bridgeQuote()` and required for `bridge()`, are [`Query`](https://synapserouter.gitbook.io/untitled/) objects, which contain: | ||
|
||
* `swapAdapter`: (string): 0x address of the swap adapter. | ||
* `tokenOut`: (string): 0x address of the outputted token on that chain. | ||
* `minAmountOut`: (Ethers BigNumber): The min amount of value exiting the transaction. | ||
* `deadline`: (Ethers BigNumber): The deadline for the potential transaction. | ||
* `rawParams`: (string): 0x params for the potential transaction. | ||
|
||
::: | ||
|
||
### `bridgeQuote()` | ||
|
||
Get all relevant information regarding a possible transaction. | ||
|
||
#### Parameters | ||
|
||
`bridgeQuote()` requires the following arguments: | ||
|
||
* `fromChain` (number): Origin chain id. | ||
* `toChain` (number): Destination chain id. | ||
* `fromToken` (string): 0x token address on the origin chain. | ||
* `toToken` (string): 0x token address on the destination chain. | ||
* `amount` (Ethers BigNumber): The amount (with the correct amount of decimals specified by the token on the origin chain) | ||
* `object` (three seperate args): | ||
* `deadline` (Ethers BigNumber): Deadline for the transaction to be initiated on the origin chain, in seconds (optional) | ||
* `originUserAddress` (string): Address of the user on the origin chain, optional, mandatory if a smart contract is going to initiate the bridge operation | ||
* `excludedModules` (array): (optional) List of bridge modules to exclude from the result | ||
|
||
#### Return value | ||
|
||
`bridgeQuote` returns the following information | ||
|
||
* `feeAmount` (Ethers BigNumber): The calculated amount of fee to be taken. | ||
* `bridgeFee` (number): The percentage of fee to be taken. | ||
* `maxAmountOut` (Ethers BigNumber): The maximum output amount resulting from the bridge transaction. | ||
* `originQuery` (`Query`): The query to be executed on the origin chain. | ||
* `destQuery` (`Query`): The query to be executed on the destination chain. | ||
|
||
### `bridge()` | ||
|
||
Use `bridgeQuote` to request a Bridge transaction | ||
|
||
#### Parameters | ||
|
||
* `toAddress` (number): The 0x wallet address on the destination chain. | ||
* `routerAddress` (string): The 0x contract address on the origin chain of the bridge router contract. | ||
* `fromChain` (number): The origin chain id. | ||
* `toChain` (number): The destination chain id. | ||
* `fromToken` (string): The 0x token address on the origin chain. | ||
* `amount` (Ethers BigNumber): The amount (with the correct amount of decimals specified by the token on the origin chain) | ||
* `originQuery` (`Query`): The query to be executed on the origin chain. | ||
* `destQuery` (`Query`): The query to be executed on the destination chain. | ||
|
||
#### Return value | ||
|
||
* `to` (string): 0x wallet address on the destination chain. | ||
* `data` (string): Output data in 0x hex format | ||
|
||
### `allBridgeQuotes()` | ||
|
||
#### Return value | ||
|
||
Returns an array all possible bridge quotes, with the first item in the array being the cheapest route. | ||
|
||
Quotes are returned from various Bridge "types" such as [CCTP](/docs/Routers/CCTP) or [RFQ](/docs/Routers/RFQ). More information is available on the [Synapse Router](/docs/Routers/Synapse-Router) page, or [SynapseCNS](https://github.com/synapsecns/sdk-router) Github repository. | ||
|
||
## Examples | ||
|
||
### Get a quote | ||
|
||
```js | ||
const quotes = await Synapse.bridgeQuote( | ||
routerAddress | ||
42161, // Origin Chain | ||
43114, // Destination Chain | ||
'0xff970a61a04b1ca14834a43f5de4533ebddb5cc8', // Origin Token Address | ||
'0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664', // Destination Token Address | ||
BigNumber.from('20000000') // Amount in | ||
{ | ||
// Deadline for the transaction to be initiated on the origin chain, in seconds (optional) | ||
deadline: 1234567890, | ||
// List of bridge modules to exclude from the result, optional. | ||
// Empty list means that all modules are included. | ||
excludedModules: ['SynapseBridge', 'SynapseCCTP', 'SynapseRFQ'], | ||
// Address of the user on the origin chain, optional. | ||
// MANDATORY if a smart contract is going to initiate the bridge operation on behalf of the user. | ||
originUserAddress: '0x1234567890abcdef1234567890abcdef12345678', | ||
} | ||
) | ||
``` | ||
|
||
### Request a transaction | ||
|
||
```js | ||
await Synapse.bridge( | ||
'0x0AF91FA049A7e1894F480bFE5bBa20142C6c29a9', // To Address | ||
bridgeQuote.routerAddress, // address of the contract to route the txn | ||
42161, // Origin Chain | ||
43114, // Destination Chain | ||
'0xff970a61a04b1ca14834a43f5de4533ebddb5cc8', // Origin Token Address | ||
BigNumber.from('20000000'), // Amount | ||
quote.originQuery, // Origin query from bridgeQuote() | ||
quote.destQuery // Destination query from bridgeQuote() | ||
) | ||
``` | ||
|
||
## Version 0.10.0 breaking changes | ||
|
||
### Options object | ||
|
||
* `deadline`, `excludeCCTP` (now `excludedModules`), and `originUserAddress` parameters are now found in an (optional) options object at the end of the arguments list for `bridgeQuote()`, and `allBridgeQuotes()`. | ||
* `excludedModules` excludes one or more modules with an array of the module names. Supported names are `SynapseBridge`, `SynapseCCTP`, and `SynapseRFQ`. | ||
* `originUserAddress` is required as part of the options object to initiate a bridge transaction on behalf of a user. | ||
|
||
### Examples | ||
```js | ||
bridgeQuote(...arguments, { | ||
deadline: 1234567890, | ||
excludedModules: ["SynapseCCTP"], | ||
originUserAddress: "0x1234...", | ||
}) | ||
|
||
allBridgeQuotes({ | ||
deadline: 1234567890, | ||
excludedModules: ["SynapseCCTP"], | ||
originUserAddress: "0x1234...", | ||
}) | ||
``` | ||
|
||
### `FastBridgeRouter` | ||
|
||
The previous `FastBridgeRouter` deployment is deprecated, if your integration is using the hardcoded address, please see the router deployments/deprecated deployments table [here](https://github.com/synapsecns/sanguine/tree/master/packages/sdk-router#router-deployments) |
Oops, something went wrong.