Skip to content

Latest commit

 

History

History
72 lines (35 loc) · 26.2 KB

chainlink.md

File metadata and controls

72 lines (35 loc) · 26.2 KB

Integration details for Chainlink, Avalanche | Polygon and The Graph.

In WorldWideLink (WWL) we have used different Chainlink products including 1) CCIP 2) Chain Automation 3) Data Feeds 4) VRF 5) Proof of Reserves 6) Functions 7) Chainlink Node-External adapter. Below are the details of the integration:

Service Name Blockchain | Contract | Code implementation
CCIP
Using CCIP we Implemented, Cross-Chain Escrow,
Lending / Borrowing, Liquid Staking and asset transfer among Ethereum/Avalnche/ Polygon.
Avalanche -
(Escrow)
https://testnet.snowtrace.io/address/0x52C1da029735C798Ef0B94ba85C2C30ef378D5f4

Code:
https://github.com/jaydippatel83/worldwidelink/blob/master/smart_contracts/escrow/Escrow.sol

Line No: 1 to 726

(Lending/Borrowing)
Sender:
https://testnet.snowtrace.io/address/0xD9902C09d1104f068772623F91dC9555545192dd

Code:
https://github.com/jaydippatel83/worldwidelink/blob/master/smart_contracts/lending-borrowing/Sender.sol

Line No: 1 - 260

Receiver Protocol: https://testnet.snowtrace.io/address/0x2123e642A12d6Ce9B292B9F166971DFa97319b2D

Code:
https://github.com/jaydippatel83/worldwidelink/blob/master/smart_contracts/lending-borrowing/WorldWideLinkProtocol.sol

Line No: 1 - 474

(Liquid staking)
Staking:
https://testnet.snowtrace.io/address/0x670936746cF7ab5Eec356e81E9a62556140CDfB5

Code:
https://github.com/jaydippatel83/worldwidelink/blob/master/smart_contracts/Liquid-Stake/LiquidStaking.sol

Line No: 1 - 185

Unstake:
https://testnet.snowtrace.io/address/0xC3ED8D3Ddef66cea43e9D3d74981869aE2C8718F

Code:
https://github.com/jaydippatel83/worldwidelink/blob/master/smart_contracts/Liquid-Stake/UnStake.sol

Line No: 1 - 204

Sepolia -
(Escrow)
https://sepolia.etherscan.io/address/0xbb5fd7e998526c64F8CBa3C3Cc526E510Dd6BdC4

(Lending/Borrowing)
Sender:
https://sepolia.etherscan.io/address/0x53cc33bCb8f54BD041210Be871b7b3FAF3884ac2

Receiver Protocol:
https://sepolia.etherscan.io/address/0x67179faFCB5Fbf8F106DaFFA3fb70e1369c1Fc3f

(Liquid staking)

(Asset Transfer)
https://sepolia.etherscan.io/address/0x253b3b4807076Cf51c3Cda5Ebd5DA290DdD89f13

Code:
https://github.com/jaydippatel83/worldwidelink/blob/master/smart_contracts/transfer/Transfer.sol

Mumbai -
(Escrow)
https://mumbai.polygonscan.com/address/0x9519db24fE1FfB1Be531D4c66eA01Eb61B51F82a

(Lending/Borrowing)
Sender:
https://mumbai.polygonscan.com/address/0x3Db45de715929b76E0570d01815F20eEe576B9E7

Receiver Protocol:
https://mumbai.polygonscan.com/address/0x9c29a12d441757AcF45aa106A3905E85C008dFA2

(Liquid staking)

(Asset Transfer)
https://mumbai.polygonscan.com/address/0xFf72875645e3a6DFAc819a14a98c93b01D3f449B
Automation
logic-based automation in 1) Automated SOS email and 2) SOS-triggered automated crypto asset transfers.
Note: Detailed information for implementation is covered in the next section.


Mumbai
(Sos Alert)
https://mumbai.polygonscan.com/address/0xdC1A55051B529e23B67f621332a0D0953771c3Fc

Code:
https://github.com/jaydippatel83/worldwidelink/blob/master/smart_contracts/sos-alert-contracts/SosTokenTransfer.sol

Line No: 1 to 131
Data Feeds To fetch real-time Ethereum and Matic prices, enabling users to peg 1 CCIP to 1 Eth on Ethereum and 1 CCIP to 1 Matic on Polygon for lending/borrowing. Avalanche
https://testnet.snowtrace.io/address/0x040Dd256A46e8fFdD5Ffeb6F95FE9b5c02828D88

Sepolia
https://sepolia.etherscan.io/address/0xd1B48c231eE234C89BC02E6E7C80F75115DFD04D

Mumbai
https://mumbai.polygonscan.com/address/0x6e4563C4F0FE668196C8878Cb89bdEF15b66e9B2

Code:
https://github.com/jaydippatel83/worldwidelink/blob/master/smart_contracts/price_feed/Price_feed.sol

Line No: 1 - 57

Code:
https://github.com/jaydippatel83/worldwidelink/blob/master/smart_contracts/lending-borrowing/WorldWideLinkProtocol.sol

Line No: 209 - 230
VRF (Airdrop) To airdrop WWL tokens to an early user who interacted with any of the contracts from Escrow, Lend/Borrow, and Liquid Staking Avalanche
https://testnet.snowtrace.io/address/0xA7a9cB2a4b88a5C85431808F6a3292b35d3dF337

Sepolia
https://sepolia.etherscan.io/address/0x2998C45406341386a5c25d523c7A500841b3E307

Code
https://github.com/jaydippatel83/worldwidelink/blob/master/smart_contracts/airdrop/AirdropFactory.sol

Line No: 1 - 126
Proof of Reserve Monitoring BTC.b's PoR triggers alerts and maintains on-chain reputation by tracking Avalanche's collateral ratio. Users receive email alerts for low ratios, and frequent imbalances reduce the pool's reputation. Avalanche
(Proof of Reserve)
https://testnet.snowtrace.io/address/0xe28F1cfe684e907fdb9cC815b50a5dBF5350d007

Code:
https://github.com/jaydippatel83/worldwidelink/blob/master/smart_contracts/sos-alert-contracts/ProofOfReserve.sol

Line No: 1 - 105
Functions We attempted using functions for email notifications via a POST API but faced a "custom error" when calling the function consumer contract. To resolve, we implemented the desired functionality through a Chainlink Node. Mumbai
https://mumbai.polygonscan.com/address/0x6Cf0473b429fE9919a6443D9fFF2c6A1aC897A5e

Code:
https://github.com/jaydippatel83/worldwidelink/blob/master/smart_contracts/sos-alert-contracts/FunctionsConsumerExample.sol

Line No: 1 - 112
Node-External Adapter We created an external adapter, bridged it with the node, and generated a job ID for the POST API of email and automated it as per Chainlink Automation - Keeper. Mumbai(External Request)
https://mumbai.polygonscan.com/address/0x403227Ba96250eaD0f12ba77951d7f65F9E5962d

Code:
https://github.com/jaydippatel83/worldwidelink/blob/master/smart_contracts/sos-alert-contracts/ExternalRequestContract.sol

Line No: 1 - 122

https://github.com/mansijoshi17/cl-external-adapter
The GraphCreated a subgraph to retrieve user transactions from cross-chain lending/borrowing contracts and rewarded them with an airdrop of WWL tokens. Sub Graph:
https://api.studio.thegraph.com/query/44401/wwl/0.0.1

Code:
https://github.com/jaydippatel83/worldwidelink/blob/master/src/jsx/components/Dashboard/widgets/Airdrop.js

Line No: 15 to 30

Implementation Details:

Chainlink CCIP:

- Cross-Chain Escrow allows buyers and sellers to stake crypto assets in Ethereum, Avalanche, or Polygon without the need to have assets on the same chain as the other party.
- Cross-Chain Lending and Borrowing allow users to lend assets on Avalanche, Ethereum, or Polygon. Users can borrow assets on other chains based on the collateral ratio, eliminating the need for bridges or concerns about managing native gas tokens.
- Cross-Chain Liquid Staking enables users to stake assets, such as CCIP, on Avalanche Fuji and receive StCCIP on Polygon. Users can utilize their liquid assets for various DeFi use cases.
- Cross-Chain asset transfer between CCIP supported chains: Ethereum, Avalanche, or Polygon.

Chainlink Automation:

  • We have used logic-based automation in 1) Automated SOS email and 2) SOS-triggered automated crypto asset transfers. Chainlink Automation in WWL involves logic-based alerts and transfers. Trigger 2 sends email alerts to specified loved ones if no Dapp interaction within days. Triggers 3 auto-transfer assets to loved ones' addresses if no WWL activity after user-configured time, preventing crypto wealth from being locked for a lifetime in case of emergencies.

Chainlink Data Feeds:

  • Currently, CCIP supports only CCIP token so we have used price feeds in the Lending / Borrowing part of Dapp to fetch a price of Ethereum and Matic and peg 1 CCIP:1 Eth in Ethereum network and 1 CCIP: 1 Matic in the Polygon network and allow the user to borrow WDai accordingly supplied collateral of CCIP.

Chainlink VRF:

  • To airdrop WWL tokens to an early user who interacted with any of the contracts from Escrow, Lend/Borrow, and Liquid Staking.

Chainlink Proof of Reserves:

  • We monitor PoR for BTC.b to trigger vital alerts and maintain the on-chain reputation score by fetching the collateral ratio of Bitcoin on Avalanche. Users receive email alerts if the collateral ratio falls below the predefined percentage. Frequent imbalances lower the reputation score of the specific pool.

Chainlink Functions:

  • We tried to utilize functions to implement notifications through a POST API for sending emails. However, we encountered a "custom error" when calling the function consumer contract. To address this issue, we created a Chainlink Node to implement the desired functionality.

Chainlink Node - External Adapter:

  • We created an external adapter, bridged it with the node, and generated a job ID for the POST API of email and automated it as per Chainlink Automation - Keeper.
Screenshot 2023-12-08 at 5 42 14 PM Screenshot 2023-12-08 at 12 21 35 PM

WWL Pitch - Logo change

Pwered By