Skip to content

Commit

Permalink
Merge pull request #128 from valory-xyz/lp_bridging_info
Browse files Browse the repository at this point in the history
doc and chore: Adding LP bridging info
  • Loading branch information
kupermind authored Mar 1, 2024
2 parents 923c312 + 12217f0 commit 242d795
Show file tree
Hide file tree
Showing 9 changed files with 66 additions and 8 deletions.
8 changes: 7 additions & 1 deletion .gitleaksignore
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,10 @@ a6051cf7ad8ee63d9b230f38b1d11153e7799137:scripts/deployment/globals_goerli.json:
9bcfc8f72a4e86c3ab805f95e784252b9a5b63d2:scripts/deployment/globals_goerli.json:generic-api-key:2
9bcfc8f72a4e86c3ab805f95e784252b9a5b63d2:scripts/deployment/globals_goerli.json:generic-api-key:1
abf859641c14531777e357547bbfadb79871c1c4:scripts/deployment/globals_mainnet.json:generic-api-key:1
abf859641c14531777e357547bbfadb79871c1c4:scripts/deployment/globals_mainnet.json:generic-api-key:2
abf859641c14531777e357547bbfadb79871c1c4:scripts/deployment/globals_mainnet.json:generic-api-key:2
197bb349f84d8a2ac281cbf289eecce3f6aaae4e:docs/lp_token_guide.md:generic-api-key:11
197bb349f84d8a2ac281cbf289eecce3f6aaae4e:docs/lp_token_guide.md:generic-api-key:12
589884fb0252f32bd714d08567f933c92763e9c6:docs/lp_token_guide.md:generic-api-key:11
589884fb0252f32bd714d08567f933c92763e9c6:docs/lp_token_guide.md:generic-api-key:12
076a8dd267f19419edbd339d15d8b9673bef6083:docs/lp_token_guide.md:generic-api-key:11
076a8dd267f19419edbd339d15d8b9673bef6083:docs/lp_token_guide.md:generic-api-key:12
16 changes: 13 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ The Tokenomics contract is deployed via the proxy contract, such that it is poss

### Prerequisites
- This repository follows the standard [`Hardhat`](https://hardhat.org/tutorial/) development process.
- The code is written on Solidity `0.8.18`.
- The standard versions of Node.js along with Yarn are required to proceed further (confirmed to work with Yarn `1.22.19` and npm `8.13.2` and node `v18.6.0`);
- The code is written on Solidity starting from version `0.8.18`.
- The standard versions of Node.js along with Yarn are required to proceed further (confirmed to work with Yarn `1.22.19` and npm `10.1.0` and node `v18.6.0`);
- [`Foundry`](https://book.getfoundry.sh/) is required to run the foundry tests.

### Install the dependencies
Expand Down Expand Up @@ -96,7 +96,17 @@ node scripts/audit_chains/audit_contracts_setup.js
```

## LP Token Guide
It is advised to check the following [list of instructions](https://github.com/valory-xyz/autonolas-tokenomics/blob/main/docs/LP_token_guide.md) before enabling OLAS-based LP tokens.
It is advised to check the following [list of instructions](https://github.com/valory-xyz/autonolas-tokenomics/blob/main/docs/lp_token_guide.md) before enabling OLAS-based LP tokens.

## LP Token List
OLAS-based LP tokens eligible for bonding come from various chains. At a minimum, after [OLAS](https://github.com/valory-xyz/autonolas-governance/blob/main/docs/olas_bridging.md)
has been bridged to a specific chain, the `OLAS-XCHAIN_TOKEN` LP token is created to provide the liquidity on that chain.

In order to participate in bonding with LPs from different chains, the LP owner needs to transfer LP tokens to the ETH mainnet
and deposit via a [Depository](https://github.com/valory-xyz/autonolas-tokenomics/blob/main/contracts/Depository.sol) contract
directly, or by using the [Bonding UI](https://tokenomics.olas.network/bonding-products).

For more information about bonding enabled LP tokens and bridging see [here](https://github.com/valory-xyz/autonolas-tokenomics/blob/main/docs/lp_token_bridging.md)

## Acknowledgements
The tokenomics contracts were inspired and based on the following sources:
Expand Down
12 changes: 12 additions & 0 deletions docs/lp_token_bridging.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# LP Token Bridging

In a table below one can find LP token addresses on corresponding chains and bridges to transfer them from L2 to L1
in order to participate in bonding.

| Network | Exchange | Pool Symbol | LP Token Address on Native Chain | Bridged LP Token Address on Ethereum | Bridge (OLAS from Chain to Ethereum) |
|-------------|----------------------------------------------------------------------------------------------------------------------------|-------------|------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------|
| Ethereum | [Uniswap](https://app.uniswap.org/swap?inputCurrency=ETH&outputCurrency=0x0001a500a6b18995b03f44bb040a5ffc28e45cb0) | OLAS-WETH | [0x09D1d767eDF8Fa23A64C51fa559E0688E526812F](https://etherscan.io/token/0x09d1d767edf8fa23a64c51fa559e0688e526812f) | N/A | N/A |
| Gnosis | [Balancer](https://app.balancer.fi/#/gnosis-chain/pool/0x79c872ed3acb3fc5770dd8a0cd9cd5db3b3ac985000200000000000000000067) | OLAS-WXDAI | [0x79C872Ed3Acb3fc5770dd8a0cD9Cd5dB3B3Ac985](https://gnosisscan.io/token/0x79c872ed3acb3fc5770dd8a0cd9cd5db3b3ac985) | [0x27df632fd0dcf191C418c803801D521cd579F18e](https://etherscan.io/token/0x27df632fd0dcf191c418c803801d521cd579f18e) | [OmniBridge](https://omni.gnosischain.com/bridge) |
| Polygon PoS | [Balancer](https://app.balancer.fi/#/polygon/pool/0x62309056c759c36879cde93693e7903bf415e4bc000200000000000000000d5f) | OLAS-WMATIC | [0x62309056c759c36879Cde93693E7903bF415E4Bc](https://polygonscan.com/token/0x62309056c759c36879cde93693e7903bf415e4bc) | [0xf9825A563222f9eFC81e369311DAdb13D68e60a4](https://etherscan.io/token/0xf9825A563222f9eFC81e369311DAdb13D68e60a4) | [Wormhole Portal](https://portalbridge.com/advanced-tools/#/transfer) |
| Solana | [Orca](https://www.orca.so/liquidity?address=5dMKUYJDsjZkAD3wiV3ViQkuq9pSmWQ5eAzcQLtDnUT3) | OLAS-WSOL | TBC | TBC | [Wormhole Portal](https://portalbridge.com/advanced-tools/#/transfer) |
| Arbitrum | [Balancer](https://app.balancer.fi/#/arbitrum/pool/0xaf8912a3c4f55a8584b67df30ee0ddf0e60e01f80002000000000000000004fc) | OLAS-WETH | [0xAF8912a3C4f55a8584B67DF30ee0dDf0e60e01f8](https://arbiscan.io/token/0xaf8912a3c4f55a8584b67df30ee0ddf0e60e01f8) | [0x36B203Cb3086269f005a4b987772452243c0767f](https://etherscan.io/token/0x36B203Cb3086269f005a4b987772452243c0767f) | [Wormhole Portal](https://portalbridge.com/advanced-tools/#/transfer) |
29 changes: 29 additions & 0 deletions docs/lp_token_guide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# LP Token Guide
## UniswapV2
To illustrate the mechanism, the well-known DAI / wETH pair is used: https://app.zerion.io/tokens/UNI-V2-0xa478c2975ab1ea89e8196811f51a7b7ade33eb11

That LP token has the following address: `0xa478c2975ab1ea89e8196811f51a7b7ade33eb11`.

- Get a description of what is inside the LP token pool, one of the tokens has to be [OLAS](https://etherscan.io/address/0x0001A500A6B18995B03f44bb040A5fFc28E45CB0).
In this example, we consider DAI in place of OLAS. DAI token has the following address: `0x6B175474E89094C44Da98b954EedeAC495271d0F`.
- Open an ETH explorer in a chosen network (here the ETH mainnet is used): https://etherscan.io/token/0xa478c2975ab1ea89e8196811f51a7b7ade33eb11#readContract
- Read the output of methods `token0()`, `token1()`:
- `token0: 0x6B175474E89094C44Da98b954EedeAC495271d0F`,
- `token1: 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2`.
In the example, these addresses are DAI and wETH addresses. In the case of OLAS-wETH LP token, these addresses have to match with OLAS and wETH addresses.
- Check the pool address:
- Verification logic (no need to do it every time):
- Open the Uniswap documentation and find its router address: https://docs.uniswap.org/contracts/v2/reference/smart-contracts/router-02.
- On that page, one can find the following text: `UniswapV2Router02 is deployed at 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D address on the Ethereum mainnet, and the Ropsten, Rinkeby, Görli, and Kovan testnets. It was built from commit 6961711.`
- Open the contract reading page: https://etherscan.io/address/0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D#readContract.
- Read the `factory()` method and check that it returns the following address: `0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f`.

- Open the UniswapV2Factory contract: https://etherscan.io/address/0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f#readContract
- Call the `getPair()` method with `OLAS token address` and `wETH token address` as inputs. In our DAT-wETH examples, the inputs are the following:
- `0x6B175474E89094C44Da98b954EedeAC495271d0F`,
- `0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2`.
- The output will be the LP token address. In this example, this is the following address: `0xA478c2975Ab1Ea89e8196811F51A7B7Ade33eB11`.
- If the address match with the given original LP-token address (in this example, `0xa478c2975ab1ea89e8196811f51a7b7ade33eb11`), everything is correct.
- In correctly created LP token, the first internal transaction must be originated by the UniswapV2Factory address: https://etherscan.io/address/0xa478c2975ab1ea89e8196811f51a7b7ade33eb11#internaltx.
- Optionally, the followign link works for well-known LP tokens: https://v2.info.uniswap.org/pair/0xa478c2975ab1ea89e8196811f51a7b7ade33eb11.
However, the absence of requested token information does not mean there is something wrong with the token. In that case just use the verification described above.
2 changes: 1 addition & 1 deletion scripts/proposals/globals_gnosis_mainnet.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"providerName":"gnosis","olasAddress":"0xcE11e14225575945b8E6Dc0D4F2dD4C570f79d9f","XOLAS_WXDAI_PairAddress":"0x79c872ed3acb3fc5770dd8a0cd9cd5db3b3ac985","XOLAS_WXDAI_PoolId":"0x79c872ed3acb3fc5770dd8a0cd9cd5db3b3ac985000200000000000000000067","vaultAddress":"0xba12222222228d8ba445958a75a0704d566bf2c8"}
{"providerName":"gnosis","olasAddress":"0xcE11e14225575945b8E6Dc0D4F2dD4C570f79d9f","OLAS_WXDAI_PairAddress":"0x79c872ed3acb3fc5770dd8a0cd9cd5db3b3ac985","OLAS_WXDAI_PoolId":"0x79c872ed3acb3fc5770dd8a0cd9cd5db3b3ac985000200000000000000000067","vaultAddress":"0xba12222222228d8ba445958a75a0704d566bf2c8"}
1 change: 1 addition & 0 deletions scripts/proposals/globals_polygon_mainnet.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"providerName":"polygon","olasAddress":"0xFEF5d947472e72Efbb2E388c730B7428406F2F95","OLAS_WMATIC_PairAddress":"0x62309056c759c36879Cde93693E7903bF415E4Bc","OLAS_WMATIC_PoolId":"0x62309056c759c36879cde93693e7903bf415e4bc000200000000000000000d5f","vaultAddress":"0xba12222222228d8ba445958a75a0704d566bf2c8"}
2 changes: 1 addition & 1 deletion scripts/proposals/proposal_05_create_bonding_products.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ async function main() {
for (let i = 0; i < pricesLP.length; i++) {
targets.push(depositoryTwoAddress);
values.push(0);
callDatas.push(depository.interface.encodeFunctionData("create", [parsedData.XOLAS_WXDAI_PairAddress, pricesLP[i], supplies[i], vestings[i]]));
callDatas.push(depository.interface.encodeFunctionData("create", [parsedData.OLAS_WXDAI_PairAddress, pricesLP[i], supplies[i], vestings[i]]));
}

const description = "Close old products and create new ones";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ async function main() {
});

// 50OLAS-50DAI pool Id
const poolId = parsedData.XOLAS_WXDAI_PoolId;
const poolId = parsedData.OLAS_WXDAI_PoolId;

// Swap contract tracking
const vaultAddress = parsedData.vaultAddress;
Expand Down

0 comments on commit 242d795

Please sign in to comment.