← Bright Union

Bright Union

Solidity Crypto Insurance Aggregator Protocol

Client: Bright Union (@bright_union) ↗

One contract and one ABI that resells decentralised insurance cover from multiple risk markets — Nexus Mutual, Bridge Mutual, and InsurAce — across Ethereum, BNB Chain, and Polygon.

github.com/danielles0xG/distributors-docs ↗

Stack & integrations

  • Solidity 0.7.4
  • ABIEncoderV2
  • Upgradeable proxies (OpenZeppelin)
  • ERC-165 introspection
  • ERC-721 (Nexus cover NFT)
  • Truffle · truffle-upgrades
  • Nexus Mutual
  • Bridge Mutual
  • InsurAce
  • The Graph (subgraph)
  • VueJS
  • NPM SDK
  • Ethereum · BNB Chain · Polygon

Context

Bright Union is a DeFi cover aggregator. Buying crypto insurance normally means learning each protocol separately — Nexus Mutual, Bridge Mutual, InsurAce — each with its own contracts, quote mechanics, and cover representation. The distributors protocol puts them behind a single Solidity aggregator: one entry-point contract, one interface, so a dApp can compare, quote, buy, and read cover from any supported market through the same calls.

What it does — the product

The aggregator is a single storefront for on-chain cover. A user (or a dApp integrating the SDK) hits one contract to compare quotes, buy a policy, and list their active covers — while the protocol routes each call to whichever risk market actually underwrites it. New markets can be onboarded without changing the entry-point, so the catalogue grows without the integrator ever re-wiring. It runs on Ethereum, BNB Chain, and Polygon and their testnets.

A dApp user reaches one Bright Union aggregator contract to compare, quote, and buy cover, which resells cover from Nexus Mutual, Bridge Mutual, and InsurAce; deployed on Ethereum, BNB Chain, and Polygon
One aggregator entry-point resells cover from many decentralised risk markets

Architecture — registry + a common interface + adapters

Three pieces make the aggregation independent of any single provider. A Distributors contract is the entry-point every client calls. A DistributorRegistry maps a lower-case name ("nexus", "bridge", "insurace") to the adapter address — the only owner-controlled seam. And IDistributor — the “Bright interface” — is the common ABI (getQuote · buyCover · getCovers) that every adapter implements. Before it forwards a call, the aggregator resolves the name to an adapter and gates it through an ERC-165 supportsInterface check, so only contracts honouring the Bright interface can be reached. Adding a risk platform is writing one new adapter and registering it — no change to the aggregator.

Clients call the Distributors aggregator; owner registers adapters in the DistributorRegistry (name to address); the aggregator resolves the name, ERC-165 gates against the IDistributor Bright interface, then delegates to per-protocol adapters (NexusDistributorWrapper, BridgeDistributor, InsuraceDistributor) which call Nexus Gateway, Bridge PolicyBook, and InsurAce Cover
Blue = control (registry lookup, interface gate, admin) · green = value (premium in, cover out)

Flow — buy a cover

A buyer calls buyCover(name, …) once. The aggregator resolves the name in the registry, checks the adapter implements the Bright interface, forwards the premium, and lets the adapter talk to the underlying protocol — Nexus’ Gateway, Bridge’s PolicyBook, or InsurAce’s Cover. The Nexus path is the richest: its adapter is an ERC-721 that mints the cover as an NFT (using the protocol’s coverId as the token id) and skims a configurable fee to a treasury. Every purchase emits a BuyCoverEvent the off-chain layer listens on.

Buy-cover sequence: user calls buyCover on Distributors; Distributors resolves the adapter in DistributorRegistry, runs the supportsInterface gate, forwards the premium to the adapter, which prices and buys from the risk protocol; Nexus mints an ERC-721 and sends a fee to treasury; Distributors emits BuyCoverEvent and the subgraph/alerts notify
One buyCover call, resolved and gated, then routed to the right protocol

Flow — quote & read a portfolio

Reads go through the same entry-point. getQuote returns a normalised CoverQuote (Nexus prices on-chain via the Gateway; Bridge via its PolicyBook; InsurAce quotes off-chain through api.insurace.io). getCovers loops an owner’s positions on a given market and maps each into a common IDistributor.Cover struct — so wildly different cover representations across three protocols read identically in the UI, with a _limitLoop guard to bound gas.

Read paths: user calls Distributors view functions getQuote and getCovers, which fan out to NexusDistributorWrapper, BridgeDistributor, and InsuraceDistributor and normalise results into IDistributor.Cover and CoverQuote structs so every protocol reads the same in the UI
Quotes and portfolios normalised to shared structs across every protocol

Off-chain layer — indexing, alerts, and a resale SDK

The BuyCoverEvent is the hook the rest of the product hangs off. A subgraph on The Graph indexes it to render the BRI token price and cover data in a VueJS front-end; a bot fires Telegram and Slack alerts on every sale; and a published NPM module lets third-party dApps embed the aggregator and resell cover through the same contract calls.

Off-chain layer: the Distributors contract's BuyCoverEvent is indexed by a subgraph on The Graph that feeds a VueJS front-end rendering the BRI token price; a Telegram and Slack bot alerts the team on every sale; and third-party dApps embed the @brightunion NPM SDK to resell cover through the aggregator
Events drive the subgraph, sale alerts, and an NPM SDK for resellers

On-chain deployment

Every component ships as an upgradeable proxy (truffle-upgrades deployProxy): the registry is deployed first, adapters are registered against the live risk protocols on each network, then the aggregator is deployed with the registry address. The reference deployment below is on Kovan (now-deprecated testnet); mainnet, BNB Chain, and Polygon follow the same migration.

  • Aggregator (Distributors) — proxy 0x75D6a3a2eC3593982551dC10615ba9fFFbD3c050 · impl 0x7C4661aFceB003aDcD126c7f3A1eBD29962BC01D
  • DistributorRegistry — proxy 0x6F7F00699ecE297e6FAbd136e1dfd1A371742352 · impl 0x91B8b5501b38943C09EAD48406daa1D9445fE782
  • Nexus adapter (NexusDistributorWrapper) — impl 0x761fc75a7b9746fdad8470dacb36ea9dc6463264

My contribution

Designed and built the aggregation protocol — the Distributors entry-point, the name-keyed DistributorRegistry, and the IDistributor “Bright interface” with its ERC-165 gate — plus the three per-protocol adapters that normalise Nexus Mutual, Bridge Mutual, and InsurAce onto one ABI (including the Nexus ERC-721 cover-NFT wrapper with treasury fees, and the InsurAce signed-quote buy path). Wired Telegram and Slack alerts on every sale, deployed a subgraph on The Graph to render the BRI token price in a VueJS front-end, and published an NPM module so third parties can resell cover through the aggregator. Shipped as upgradeable proxies across Ethereum, BNB Chain, and Polygon.