Contract Guide

These guidelines are fully hardcoded into the Helemet Smart Contract(s).The various parameters of the helmet platform are fully market-priced and contracts are automatically executed. Helmet team will not intervene in the policy price at any time or make changes to the contract unless it is necessary.

Guide book to Helmet Smart Contracts

Helmet.insurance's smart contracts are divided into core and peripheral two parts. The option logic is implemented in the core, including the OptionFactory, LongOption, and ShortOption contracts, the periphery implements policy buying and selling and flat-rate farming and harvesting, including the OptionOrder, HELMET Token, and Farm contracts.

OptionFactory is used for creating insurance policy contracts, minting Tokens, destroying Tokens, enabling policy activated and settlement.

  • LongOption is the buyer's certificate to activate the policy.

  • ShortOption is the seller's certificate for clearing back the denominated and the underlying assets.

  • OptionOrder is the policy marketplace, where supplier publish policies and holders buy policies, as well as the entry point for buyers to activate policy.

OptionFactory main function:

function createOption(bool _private, address _collateral, address _underlying, uint _strikePrice, uint _expiry) public returns (address long, address short);

function mint(bool _private, address _collateral, address _underlying, uint _strikePrice, uint _expiry, uint volume) public returns (address long, address short, uint vol);

function burn(address _creator, address _collateral, address _underlying, uint _strikePrice, uint _expiry, uint volume) public returns (address long, address short, uint vol);

function calcExerciseAmount(address _long, uint volume) public view returns (uint);

function exercise(address _long, uint volume, address[] memory path) public returns (uint vol, uint fee, uint amt);

function settleable(address short, uint volume) public view returns (uint vol, uint col, uint fee, uint und);

function settle(address short, uint volume) public returns (uint vol, uint col, uint fee, uint und);

LongOption main function:

function exercise(uint volume, address[] memory path) public returns (uint vol, uint fee, uint amt);

ShortOption main function:

function settleable(address seller) public view returns (uint vol, uint col, uint fee, uint und);

function settle(uint volume) external returns (uint vol, uint col, uint fee, uint und);

OptionOrder main function:

function sell(bool _private, address _collateral, address _underlying, uint _strikePrice, uint _expiry, uint volume, address settleToken, uint price) virtual public returns (uint askID);

function reprice(uint askID, uint newPrice) virtual external returns (uint newAskID);

function cancel(uint askID) virtual external returns (uint vol);

function buy(uint askID, uint volume) virtual public returns (uint bidID, uint vol, uint amt);

function exercise(uint bidID, uint volume, address[] memory path) virtual public returns (uint vol, uint fee, uint amt);

function waive(uint bidID, uint volume) virtual public returns (uint vol);

Buy&Sell

sell a policy

Using the sell function of the OptionOrder contract.:

 function sell(
     bool _private, 
     address _collateral, 
     address _underlying, 
     uint _strikePrice, 
     uint _expiry, 
     uint volume, 
     address settleToken, 
     uint price
 ) 
     virtual 
     public 
     returns (uint askID);

Example

Denominated

Asset

Underlying

Asset

Policy

Price

Premium

Amount

Expeir

At

BNB

HELMET

0.1BNB

0.2 Helmet

10 BNB

2021/1/1 0:0:0 UMT

OptionOrder.sell(
    false, 
    0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c, 
    0x4E76DfeA6Fb3726e9A77628AAa23839E3298BC37, 
    10000000000000000000, 
    1609459200, 
    123000000000000000000, 
    0x4E76DfeA6Fb3726e9A77628AAa23839E3298BC37, 
    200000000000000000);

Buy a policy

Using the buy function of the OptionOrder contract.:

function buy(uint askID, uint volume) 
    virtual 
    public 
    returns (uint bidID, uint vol, uint amt);

Example

ID

Policy price

456

123bnb

OptionOrder.buy(456, 123000000000000000000);

Activate the policy

Using the exercise function of the OptionOrder contract.:

function exercise(
    uint bidID, 
    uint volume, 
    address[] memory path
) 
    virtual 
    public 
    returns (uint vol, uint fee, uint amt);

Example:

if it's a cover off policy

OptionOrder.exercise(789, 123000000000000000000, []);

If it's a cover up policy

OptionOrder.exercise(
    789, 
    123000000000000000000, 
    [0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c,
    0x4E76DfeA6Fb3726e9A77628AAa23839E3298BC37]);

Get back the settlement

Using the settle function of the OptionFactory contract:

function settle(
    address _creator, 
    address _collateral, 
    address _underlying, 
    uint _strikePrice, 
    uint _expiry, 
    uint volume
) 
    external 
    returns (uint vol, uint col, uint fee, uint und);

Example

OptionFactory.settle(
    address(0), 
    0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c, 
    0x4E76DfeA6Fb3726e9A77628AAa23839E3298BC37, 
    10000000000000000000, 
    1609459200, 
    123000000000000000000);

Last updated