# Arken Bridge v1

[Arken Bridge](https://arken.ag/bridge) currently supports BSC, Arbitrum, Ethereum, and Viction. Support for Optimism and Base are coming soon! Arken Bridge is a bridge interface only, built on top of LayerZero. Please follow the steps below for integration:

1. **Access example code** :

[`https://github.com/0xchimz/bridge-exmaple`](https://github.com/0xchimz/bridge-exmaple)

* Please send your Github account to Arken Team to access this private repo.
* From the example, you will find the smart contract (OFTv2 from LayerZero) and deployment code.

2. **Token deployment** : If you already have a token on any chain, please refer to 2.1. If you do not have a token yet and wish to implement your token with OFT standard, please refer to 2.2.\
   \
   2.1 If you already have a token on any chain (source chain)\
   \- Deploy an adapter to lock your original token, and\
   \- Deploy an OFT token to mint the bridged-token on the destination chain.\
   \
   After deploying the adapter contract and the OFT token, set the trusted address (TrustedRemoteAddress) to release and mint tokens on both the source chain and the destination chain. Please see the configuration in the example code below.<br>

   <figure><img src="https://2430111539-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FED2h0k18LreuSaTeEkkX%2Fuploads%2F3QBhbTImp2CDOZNhKz0Y%2Fimage%20(50).png?alt=media&#x26;token=aa324107-6b6a-4f74-92f2-8e0d3713aa96" alt=""><figcaption></figcaption></figure>

   2.2 If you don’t have a token and want to implement it using OFT standard\
   \- Deploy an OFT token on both the source chain and the destination chain.\ <br>

   <figure><img src="https://2430111539-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FED2h0k18LreuSaTeEkkX%2Fuploads%2FytiwXxKeeO2FpgfIM2Ch%2Fimage%20(51).png?alt=media&#x26;token=0d16abcc-2bda-464f-ad82-9916403ee506" alt=""><figcaption></figcaption></figure>

3. **Setup :**&#x20;
   * Clone the repo linked above.
   * Set `.env` in root folder. Don’t forget to set `PRIVATE_KEY` with your private key.
   * Prepare gas on both the source chain and destination chain.
   * Run `pmpn install`
   * Go to `scripts/deploy/tokenBridge/const.ts` :
     * Add shared decimals per token in `SHARED_DECIMALS_PER_TOKEN` (use the key with your token symbol) — refer to this link for more information: <https://docs.layerzero.network/v1/developers/evm/evm-guides/oft-v1.2-legacy-walkthrough#what-should-i-set-as-shared-decimals>
     * Update `ADMIN` with your wallet address<br>

4. **Deploy an adapter on the source chain** (if you already have a token) :
   * In the example repo, go to `scripts/deploy/tokenBridge/deploy-ProxyOFTV2.ts`
   * Edit constants
     * `chain` — the source chain
     * `metadataTokenSymbol` — token symbol
     * `MAIN_TOKEN_ADDRESS` — deployed token address
     * Enable the necessary functions between lines 26-28:
       * If you want to run the`deploy` function, enable `deploy`
       * If you want to setup your adapter, enable `setConfig`
       * If you want to verify your adapter contract, enable `verify`
     * It’s recommended to enable both `deploy` and `setConfig` for the first time.
   * Then run the command to deploy the adapter (contract name can be changed) `pnpm run run-script deploy/tokenBridge/viction/deploy-ProxyOFTV2.ts [chain]`
   * After deployment, metadata should be stored in `scripts/deploy/metadata/bridge.json`
     * Check the address field → \[chain] : \[token-symbol]-oft<br>

5. **Deploy OFTv2 Token**
   * Go to `deploy/tokenBridge/viction/deploy-OFTV2_VRC25.ts`
   * Edit constants:
     * `tokenName` — token name
     * `tokenSymbol` — token symbol
     * `metadataTokenSymbol` — token symbol in metadata (this should match with `tokenSymbol`)
     * Enable the necessary functions between lines 27-29:
       * If you want to run the`deploy` function, enable `deploy`
       * If you want to setup your adapter, enable `setConfig`
       * If you want to verify your adapter contract, enable `verify`
   * Update the contract factory :
     * `OFTV2_VRC25` — an OFTv2 contract with VRC25 standard (a token standard on Viction)
     * `ArkenTokenOFT` — a example contract with ERC20 standard (can rename the contract to match token name)
   * Then run the command to deploy a OFT token `pnpm run run-script deploy/tokenBridge/viction/deploy-OFTV2_VRC25.ts [chain]`
   * After deployed, metadata should be stored in `scripts/deploy/metadata/bridge.json`
     * check address on field → \[chain] : \[token-symbol]-oft<br>

6. **Testing**
   * Please check `deploy/tokenBridge/viction/test-transfer-example.ts`
   * Edit constants:
     * `TOKEN_ADDRESS` — original token address
     * `SENDER` — wallet address
     * `AMOUNT` — the token amount that want to send
     * `ProxyAddress` — proxy contract address.
   * Update code in lines:
     * line 22 — change the contract name to your deployed adapter contract name or replace it with ABI (eg. ArkenTokenProxyOFT)
     * line 27 — change your original token contract name or replace it with ABI (eg. ERC20)
   * Run the command to bridge the token from \[chain] to Viction (chain id = 196) `pnpm run run-script deploy/tokenBridge/test-transfer.ts [chain]`

7. Once you have deployed the adapter and OFT token, please send the following information to Arken team to integrate your token into Arken's bridge UI.

```
token_name :
symbol :
decimals : 
oftAddress or adapter addres on every chain :
tokenAddress on every chains:
imageUrl :
```
