/CatBonds_HardhatSetup

Hardhat Setup for CatastropheBonds Protocol Smart Contracts.

Primary LanguageSolidity

Catastrophe Bonds Protocol

To setup this protocol, you mainly have to deploy 2 smart contracts:

  1. CatastropheBondsCollateralPool: That acts as a pool containing and managing the collateral for the created Catastrophe Bonds and their respective posiions.

  2. CatastropheBondsFactory: That acts as a factory for deployment/creation of Catastrophe Bonds with different specifications.

And, in order to serve its functionality cross-chain, you need to deploy these contracts to Avalanche Fuji (having ETH-ChainId as 43113) and Polygon Amoy (having ETH-ChainId as 80002) networks.


Deployment using Hardhat

1. Deploy & Verify CatastropheBondsCollateralPool contract

On Avalanche Fuji:

npx hardhat deployCollateralPool --network avalancheFujiTestnet
npx hardhat verify ${CatastropheBondsCollateralPool_Address} --network avalancheFujiTestnet

On Polygon Amoy:

npx hardhat deployCollateralPool --network polygonAmoy
npx hardhat verify ${CatastropheBondsCollateralPool_Address} --network polygonAmoy
2. Deploy & Verify CatastropheBondsFactory contract

On Avalanche Fuji:

npx hardhat deployFactory ${CatastropheBondsCollateralPool_Address} --network avalancheFujiTestnet
npx hardhat verify ${CatastropheBondsFactory_Address} ${CatastropheBondsCollateralPool_Address} --network avalancheFujiTestnet

On Polygon Amoy:

npx hardhat deployFactory ${CatastropheBondsCollateralPool_Address} --network polygonAmoy
npx hardhat verify ${CatastropheBondsFactory_Address} ${CatastropheBondsCollateralPool_Address} --network polygonAmoy

Deployment using Remix

You can open and interact with this protocol in Remix IDE:

Open In Remix

Detailed walkthrough video showcasing the deployment and interaction using Remix:

Deployment and Interaction with CatBonds Protocol using Remix IDE


CatBonds dApp UI

You can also use the minimal dApp to interact with the Catastrophe Bonds Protocol.

The dApp is using the following deployed and verified CatastropheBondsCollateralPool and CatastropheBondsFactory contracts:

On Avalanche Fuji:

- CatastropheBondsCollateralPool

- CatastropheBondsFactory

On Polygon Amoy:

- CatastropheBondsCollateralPool

- CatastropheBondsFactory

And, the corresponding CatastropheBondsFactory contract has been registered as Custom Logic Upkeep at automation.chain.link and added as consumer to the respective subscriptions at functions.chain.link on both the networks, so as to utilise the automated request sending to the oracle and contract settlement based on the value received from the oracle.

Also, the CatastropheBondsFactory contract is utilising CCIP to create the Catastrophe Bonds across chains i.e., if one Catastrophe Bond contract is being created and deployed on Avalanche Fuji, then a copy of the same will be created and deployed on Polygon Amoy and vice versa, and the same can be explored on ccip.chain.link using the corresponding message id or transaction hash.

And, similarly the CatastropheBondsCollateralPool contract is utilising CCIP for cross-chain minting and redeeming of position tokens for Catastrophe Bonds, as well as for moving USDC Collateral back and forth across chains depending on the requirement in terms of the favour of settlement.


Detailed walkthrough videos showcasing the interaction with the UI of the CatBonds dApp

Part-1 | Showcasing the "WILD FIRE" being detected in "Tshuapa, Democratic Republic of the Congo":

Part-1


Part-2 | Showcasing the "WILD FIRE" not being detected in "Marsabit, Kenya":

Part-2


Part-3 | Showcasing the "HEATWAVE" being detected in "Delhi, India":

Part-3