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.:
1
function sell(
2
bool _private,
3
address _collateral,
4
address _underlying,
5
uint _strikePrice,
6
uint _expiry,
7
uint volume,
8
address settleToken,
9
uint price
10
)
11
virtual
12
public
13
returns (uint askID);
Copied!
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
1
OptionOrder.sell(
2
false,
3
0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c,
4
0x4E76DfeA6Fb3726e9A77628AAa23839E3298BC37,
5
10000000000000000000,
6
1609459200,
7
123000000000000000000,
8
0x4E76DfeA6Fb3726e9A77628AAa23839E3298BC37,
9
200000000000000000);
Copied!

Buy a policy

Using the buy function of the OptionOrder contract.:
1
function buy(uint askID, uint volume)
2
virtual
3
public
4
returns (uint bidID, uint vol, uint amt);
Copied!
Example
ID
Policy price
456
123bnb
1
OptionOrder.buy(456, 123000000000000000000);
Copied!

Activate the policy

Using the exercise function of the OptionOrder contract.:
1
function exercise(
2
uint bidID,
3
uint volume,
4
address[] memory path
5
)
6
virtual
7
public
8
returns (uint vol, uint fee, uint amt);
Copied!
Example:
if it's a cover off policy
1
OptionOrder.exercise(789, 123000000000000000000, []);
Copied!
If it's a cover up policy
1
OptionOrder.exercise(
2
789,
3
123000000000000000000,
4
[0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c,
5
0x4E76DfeA6Fb3726e9A77628AAa23839E3298BC37]);
Copied!

Get back the settlement

Using the settle function of the OptionFactory contract:
1
function settle(
2
address _creator,
3
address _collateral,
4
address _underlying,
5
uint _strikePrice,
6
uint _expiry,
7
uint volume
8
)
9
external
10
returns (uint vol, uint col, uint fee, uint und);
Copied!
Example
1
OptionFactory.settle(
2
address(0),
3
0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c,
4
0x4E76DfeA6Fb3726e9A77628AAa23839E3298BC37,
5
10000000000000000000,
6
1609459200,
7
123000000000000000000);
Copied!
Last modified 11mo ago