Crypto Native Insurance

By CPix | Everything Crypto | 25 Aug 2020


Crypto native insurance is a unique but integral part of the DeFi ecosystem. Without a proper insurance system, most people wouldn’t feel safe locking their funds in a smart contract. The DAO Hack back in 2016 is a prime example. The DAO raised a few hundred million dollars worth of Ether about 4 years ago and was subject to a reentrancy attack allowing a hacker to keep resubmitting withdrawals from the contract before it had the chance to update the user’s balance to 0. Since then several platforms/protocols have been subject to attacks but none as catastrophic as The DAO.

This is where a protocol like Nexus Mutual comes in handy, they provide on-chain (transparent & verifiable) insurance cover for several smart contracts on the Ethereum platform. Users buy a membership to the Mutual where they buy x amount of NXM for Ether which then sends the Ether to the insurance fund. Since this is crypto they have an interesting token model to help the NXM token accrue value while incentivizing the pool to grow at the pace of innovation in DeFi.

As you can see above quite a bit of value (Ether and Dai) has been staked in the Nexus Mutual Insurance pool over the past year or so. Insurance protocols like Nexus Mutual will continue to proliferate in DeFi as the space grows.

Market Update (Monday 8:30 AM EST)

Percent Change (Rounded) Based on Last Monday Open (8:30 AM EST)

Bitcoin- $11,772 (-3%)

Ether- $406 (-5%)

Gold- $1,937 (-2%)

DJI Average- 28,077 (+1%)

NYSE Composite Index- 12,905 (-1%)

NASDAQ Composite Index- 11,449 (+4%)

S&P500 Index- 3,418 (+3%)

New Developments

  1. Golem decides to adopt Layer 2 scaling with zkSync, Golem Blog

  2. A Global Look at Central Bank Digital Currencies, The Block

  3. More than $11,000,000,000 USDT on Ethereum

  4. Synthetix Futures Primer, Synthetix Blog

Industry Insights

For Developers

  1. OMG Network Docs: Plasma Framework Contracts, Child Chain and Watcher

  2. Compound Docs: How to Mint, Redeem, Borrow, Repay, and so much more

  3. 2-of-3 inputs using Pay-to-Taproot, Murch

Blockchain Activity

Compound Supply ETH to Mint cETH Contract:
*Tools: Metamask/Brave wallet, Remix IDE, Ganache/Connection to Ethereum Testnet (Kovan/Ropsten)

# set pragma

pragma solidity ^0.5.12;

# interface

interface Erc20 {
    function approve(address, uint256) external returns (bool);

    function transfer(address, uint256) external returns (bool);
}


interface CErc20 {
    function mint(uint256) external returns (uint256);

    function exchangeRateCurrent() external returns (uint256);

    function supplyRatePerBlock() external returns (uint256);

    function redeem(uint) external returns (uint);

    function redeemUnderlying(uint) external returns (uint);
}


interface CEth {
    function mint() external payable;

    function exchangeRateCurrent() external returns (uint256);

    function supplyRatePerBlock() external returns (uint256);

    function redeem(uint) external returns (uint);

    function redeemUnderlying(uint) external returns (uint);
}

# create contract

contract Compound {
    
    address payable private owner;
    uint256 balance;
    
    constructor () 
    public
        {
            owner = msg.sender;
        }
    
    event MyLog(string, uint256);

    function supplyEthToCompound(address payable _cEtherContract)
        public
        payable
        returns (bool)
    {
        // Create a reference to the corresponding cToken contract
        CEth cToken = CEth(_cEtherContract);

        // Amount of current exchange rate from cToken to underlying
        uint256 exchangeRateMantissa = cToken.exchangeRateCurrent();
        emit MyLog("Exchange Rate (scaled up by 1e18): ", exchangeRateMantissa);

        // Amount added to you supply balance this block
        uint256 supplyRateMantissa = cToken.supplyRatePerBlock();
        emit MyLog("Supply Rate: (scaled up by 1e18)", supplyRateMantissa);

        cToken.mint.value(msg.value).gas(250000)();
        return true;
    }

    function redeemCEth(
        uint256 amount,
        bool redeemType,
        address _cEtherContract
    ) public returns (bool) {
        require (msg.sender == owner, "You must be owner to do redeem.");
        // Create a reference to the corresponding cToken contract
        CEth cToken = CEth(_cEtherContract);

        // `amount` is scaled up by 1e18 to avoid decimals

        uint256 redeemResult;

        if (redeemType == true) {
            // Retrieve your asset based on a cToken amount
            redeemResult = cToken.redeem(amount);
        } else {
            // Retrieve your asset based on an amount of the asset
            redeemResult = cToken.redeemUnderlying(amount);
        }
        
        balance = address(this).balance;
        owner.transfer(balance);

        // Error codes are listed here:
        // https://compound.finance/docs/ctokens#ctoken-error-codes
        emit MyLog("If this is not 0, there was an error", redeemResult);

        return true;
    }

// This is needed to receive ETH when calling `redeemCEth`
    function() external payable {}
}

Earn Opportunity

Earn $ZEN, the native cryptocurrency behind Horizen public blockchain, by playing a game called “BloxJump”. It’s a fun and easy way to earn crypto so you can experiment with Horizen payments, sidechains, and staking.

How do you rate this article?

6


CPix
CPix

Goal is simple. Speed up mass adoption!


Everything Crypto
Everything Crypto

In this blog I cover major public blockchain developments, cryptocurrency shifting from speculation to utility, and personal opinions as to how the space will develop going forward.

Send a $0.01 microtip in crypto to the author, and earn yourself as you read!

20% to author / 80% to me.
We pay the tips from our rewards pool.