Skip to content

Nexus Mutual uses the power of blockchain technology and Ethereum to allow people from all over the world to share insurance risk together without the need for an insurance company. Nexus Mutual will initially launch with one product, smart contract cover.

License

Notifications You must be signed in to change notification settings

nervehammer/NexusMutual

 
 

Repository files navigation

Build Status

Coverage Status

NEXUS MUTUAL

Nexus Mutual uses blockchain technology to bring the mutual ethos back to insurance by creating aligned incentives through smart contract code on the Ethereum blockchain.

Description

Nexus Mutual is built on the Ethereum blockchain and uses a modular system for grouping of Ethereum smart contracts, allowing logical components of the system to be upgraded without effecting the other components. Following are the key modules of Nexus Mutual.

Token Module

Token contracts maintain details of NXM Members and the NXM Tokens held by each of them. A member of the mutual can buy/sell tokens anytime. NXM tokens can be used to purchase a cover, submit a claim, underwrite smart contracts, assess a claim or transfer tokens to other addresses.

Core Contracts

  • NXMToken.sol - ERC-20 compilant token
  • TokenController.sol - ERC-1132 compilant contract, operator for NXMToken
  • TokenData.sol - Contains all data related to tokens
  • TokenFunctions.sol - contains all token related non-standard functions specific to Nexus Mutual

Note: The smart contracts of this module had to be split in multiple smart contracts to cater to the Ethereum Gas limits. The above mentioned contracts need to be seen in conjunction

Some important functions
  • lockCN : Tokens are locked against a cover note, at the time of cover generation. These can be used to submit a claim and unused tokens can be unlocked for general use once the cover expires.
  • depositCN: Tokens are deposited while submitting a claim against a cover. These are eventually burnt in case of denial and unlocked in case of claim acceptance.
  • lock: Locks a specified amount of tokens against an address for a specified purpose and time
  • addStake: Add amount of token for staking on a smart contract.

Quotation Module

Quotation contracts contain all logic associated with creating and expiring covers. Smart contract cover is the first insurance product supported by the mutual. A member can generate a quotation offchain , and fund the same via NXM tokens / currency assets(currently ETH and DAI). This creates a cover on-chain. Quotation contracts interact with Token Contracts to lock NXM tokens against a cover which are then used at the time of claim submission.

Core Contracts

  • Quotation.sol
  • QuotationData.sol
Some important functions
  • initiateMembershipAndCover : Initiate the process of membership along with cover. Create cover of the quotation, change the status of the quotation, update the total sum assured and lock the tokens of the cover of a quote from Quote member Ethereum address
  • makeCoverUsingNXMTokens : Make Cover using NXM tokens.

Claim Module

Claim contracts manages the entire claim lifecycle starting from submitting a claim against a cover note to taking part in claims assessment to closing a claim.

Core Contracts

  • Claims.sol
  • ClaimsData.sol
Some important functions
  • submitClaim: Submits a claim against a cover note.
  • submitCAVote : Members who have tokens locked under Claims Assessment, can assess a claim, i.e., accept/deny a claim while the locked tokens.
  • submitMemberVote: Submits a member vote for assessing a claim.

Claim Reward Module

Claims Reward Contract contains the methods for rewarding or punishing the Claim assessors/Members based on the vote cast and the final verdict. All rewards in Nexus Mutual, commission to stakers, rewards to Cliams assessors/members for claims assessment, participants in governance are given via this module.

Core Contract

  • ClaimsReward.sol
Some important functions
  • changeClaimStatus: Decides the next/final status of a claim. Decision is taken based on the current state and the votes cast.
  • rewardAgainstClaim: Rewards/Punishes users who participated in claims assessment. NXM tokens are allocated as a reward for assessors who voted with the consensus. NXM tokens are locked as a punishment for assessors who voted against the consensus.
  • claimAllPendingReward: Allows member to claim all pending rewards, claims assessment + underwriting commission + participation in governance

Pool Module

Pool contracts contain all logic associated with calling External oracles through Oraclize and processing the results retrieved from the same. The module also encompasses on-chain investment asset management using 0x-protocol.

Core Contract

  • pool.sol
  • pool2.sol
  • poolData.sol

Note: The smart contracts of this module had to be split in multiple smart contracts to cater to the Ethereum Gas limits. The above mentioned contracts need to be seen in conjunction

Some important functions
  • closeProposalOraclise: Closes Proposal’s voting.
  • closeEmergencyPause: Close Emergency Pause.
  • closeCoverOraclise: Expires a cover.
  • MCROraclise: Initiates Minimum Capital Requirement (MCR) calculation.
  • closeClaimsOraclise: Closes Claim’s voting.
  • sendClaimPayout: Sends payout to cover holder in case claim passes.

MCR Module

MCR contracts contain functions for recording the Minimum Capital Requirement (MCR) of the system, each day, thus determining the NXM token price.

Core Contract

  • MCR.sol
Some important function
  • addMCRData: Records details of (Minimum Capital Requirement)MCR for each day.
    calculateTokenPrice: Calculates the NXM Token Price of a currency.

Governance Module:

Governance contracts contain the logic for creating, editing, categorizing and voting on proposals followed by action implementation, code upgradability. These governance contracts are generated in line with the GovBlocks Protocol.

Core Contract

  • MemberRoles.sol
  • ProposalCategory.sol
  • Governance.sol
Some important functions
  • payJoiningFee: Allows user to pay joining fee and become a member of the mutual
  • kycVerdict: Registers KYC status against ethereum address
  • withdrawMembership: Allows members to terminate membership
  • addCategory: Configures decision point in Nexus Mutual
  • createProposal: Allows user to create proposal for governance
  • categorizeProposal: Allows Advisory board members to whitelist a proposal
  • createProposalwithSolution: Create a proposal that does not require whitelisting
  • submitVote: Allows members to submit a governance vote
  • delegateVote: Allows members to delegate voting rights to other memebrs

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Requirements

Node >= 7.6

Installing

Firstly, you need to clone this repo. You can do so by downloading the repo as a zip and unpacking or using the following git command

git clone https://github.com/somish/NexusMutual.git

Now, It's time to install the dependencies. Enter the NexusMutual directory and use

npm install

Make sure you delete folder bitcore-lib from node_modules inside modules eth-lightwallet and bitcore-mnemonic

We need to compile the contracts before deploying. We'll be using truffle for that (You can use Remix or solc directly).

truffle compile

Now, You should start a private network on port 7545 using Ganache or something similar. To run the private network -
On Windows, Execute file nxdev.bat present in NexusMutual directory
On Linux or Mac OS Systems, run the nxdev.sh file while in NexusMutual directory

./nxdev.sh

Then, you can deploy your Nexus Mutual dApp using the migrate script.

truffle deploy

If you want, you can run the test cases using

truffle test

About

Nexus Mutual uses the power of blockchain technology and Ethereum to allow people from all over the world to share insurance risk together without the need for an insurance company. Nexus Mutual will initially launch with one product, smart contract cover.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 62.4%
  • Solidity 37.4%
  • Other 0.2%