Anyone who has NEP tokens can create a cover contract. To avoid spam, questionable, and confusing cover contracts, a creator has to burn 1000 NEP tokens. Additionally, the contract creator also needs to stake 4000 NEP tokens or more. The higher the sake, the more visibility the contract gets if there are multiple cover contracts with the same name or similar terms.
The contract creator will earn a steady income of 1% of all cover fees paid by the users. Initial contract creators will also earn additional 1% of the cover fees in NEP.
About Reporting Questionable or Invalid Contracts
The governance system allows NEP holders to vote to invalidate and remove any cover contract.
- The staked NEP tokens of the contract creator will be burned.
- The users having non-expired covers can withdraw their cover fee.
- The liquidity providers can withdraw their staked NEP tokens, stable-coins, and cover fees.
The liquidity providers can evaluate a cover contract and ensure that it is up to their satisfaction. One can then provide liquidity in BUSD or other supported cryptocurrency. A liquidity provider needs to also stake 250 NEP or higher.
To maximize return on investment, 25% of the idle/uncovered assets in the liquidity pool is supplied to Venus Protocol for lending. The interest received on loan is capitalized back into the liquidity pool, shared amongst all liquidity providers. The platform will deduct 2% of the profit generated to purchase (and burn) NEP tokens from decentralized exchange(s).
This feature will be available starting from the Neptune Mutual Protocol v2.
The liquidity providers collectively earn cover fees paid by the platform users. Initial liquidity provider will receive additional 10% rewards in NEP tokens.
View Source: contracts/core/lifecycle/Cover.sol
↗ Extends: CoverBase
Cover
The cover contract facilitates you create and update covers
- constructor(IStore store)
- updateCover(bytes32 key, bytes32 info)
- addCover(bytes32 key, bytes32 info, uint256 reportingPeriod, uint256 stakeWithFee, address assuranceToken, uint256 initialAssuranceAmount, uint256 initialLiquidity)
- _addCover(bytes32 key, bytes32 info, uint256 reportingPeriod, uint256 fee, address assuranceToken)
- _validateAndGetFee(bytes32 key, bytes32 info, uint256 stakeWithFee)
Constructs this contract
function (IStore store) public nonpayable CoverBase
Arguments
Name | Type | Description |
---|---|---|
store | IStore | Enter the store |
Source Code
constructor(IStore store) CoverBase(store) {
this;
}
Updates the cover contract. This feature is accessible only to the cover owner or protocol owner (governance).
function updateCover(bytes32 key, bytes32 info) external nonpayable nonReentrant
Arguments
Name | Type | Description |
---|---|---|
key | bytes32 | Enter the cover key |
info | bytes32 | Enter a new IPFS URL to update |
Source Code
function updateCover(bytes32 key, bytes32 info) external override nonReentrant {
_mustBeUnpaused();
s.mustBeValidCover(key); // Ensures the key is valid cover
s.mustBeCoverOwner(key, super._msgSender(), owner()); // Ensures the sender is either the owner or cover owner
require(s.getBytes32ByKeys(ProtoUtilV1.NS_COVER_INFO, key) != info, "Duplicate content");
s.setBytes32ByKeys(ProtoUtilV1.NS_COVER_INFO, key, info);
emit CoverUpdated(key, info);
}
Adds a new coverage pool or cover contract.
To add a new cover, you need to pay cover creation fee
and stake minimum amount of NEP in the Vault.
Through the governance portal, projects will be able redeem
the full cover fee at a later date.
Apply for Fee Redemption
https://docs.neptunemutual.com/covers/cover-fee-redemption
As the cover creator, you will earn a portion of all cover fees
generated in this pool.
Read the documentation to learn more about the fees:
https://docs.neptunemutual.com/covers/contract-creators
function addCover(bytes32 key, bytes32 info, uint256 reportingPeriod, uint256 stakeWithFee, address assuranceToken, uint256 initialAssuranceAmount, uint256 initialLiquidity) external nonpayable nonReentrant
Arguments
Name | Type | Description |
---|---|---|
key | bytes32 | Enter a unique key for this cover |
info | bytes32 | IPFS info of the cover contract |
reportingPeriod | uint256 | The period during when reporting happens. |
stakeWithFee | uint256 | Enter the total NEP amount (stake + fee) to transfer to this contract. |
assuranceToken | address | Optional. Token added as an assurance of this cover. Assurance tokens can be added by a project to demonstrate coverage support for their own project. This helps bring the cover fee down and enhances liquidity provider confidence. Along with the NEP tokens, the assurance tokens are rewarded as a support to the liquidity providers when a cover incident occurs. |
initialAssuranceAmount | uint256 | Optional. Enter the initial amount of assurance tokens you'd like to add to this pool. |
initialLiquidity | uint256 | Optional. Enter the initial stablecoin liquidity for this cover. |
Source Code
function addCover(
bytes32 key,
bytes32 info,
uint256 reportingPeriod,
uint256 stakeWithFee,
address assuranceToken,
uint256 initialAssuranceAmount,
uint256 initialLiquidity
) external override nonReentrant {
require(reportingPeriod >= 7 days, "Insufficent reporting period");
_mustBeUnpaused();
// First validate the information entered
uint256 fee = _validateAndGetFee(key, info, stakeWithFee);
// Set the basic cover info
_addCover(key, info, reportingPeriod, fee, assuranceToken);
// Stake the supplied NEP tokens and burn the fees
s.getStakingContract().increaseStake(key, super._msgSender(), stakeWithFee, fee);
// Add cover assurance
if (initialAssuranceAmount > 0) {
s.getAssuranceContract().addAssurance(key, super._msgSender(), initialAssuranceAmount);
}
// Add initial liquidity
if (initialLiquidity > 0) {
IVault vault = s.getVault(key);
s.getVault(key).addLiquidityInternal(key, super._msgSender(), initialLiquidity);
// Transfer liquidity only after minting the pods
IERC20(s.getLiquidityToken()).ensureTransferFrom(super._msgSender(), address(vault), initialLiquidity);
}
emit CoverCreated(key, info, stakeWithFee, initialLiquidity);
}
function _addCover(bytes32 key, bytes32 info, uint256 reportingPeriod, uint256 fee, address assuranceToken) private nonpayable
Arguments
Name | Type | Description |
---|---|---|
key | bytes32 | Enter a unique key for this cover |
info | bytes32 | IPFS info of the cover contract |
reportingPeriod | uint256 | The period during when reporting happens. |
fee | uint256 | Fee paid to create this cover |
assuranceToken | address | Optional. Token added as an assurance of this cover. |
Source Code
function _addCover(
bytes32 key,
bytes32 info,
uint256 reportingPeriod,
uint256 fee,
address assuranceToken
) private {
// Add a new cover
s.setBoolByKeys(ProtoUtilV1.NS_COVER, key, true);
// Set cover owner
s.setAddressByKeys(ProtoUtilV1.NS_COVER_OWNER, key, super._msgSender());
// Set cover info
s.setBytes32ByKeys(ProtoUtilV1.NS_COVER_INFO, key, info);
s.setUintByKeys(ProtoUtilV1.NS_REPORTING_PERIOD, key, reportingPeriod);
// Set assurance token
s.setAddressByKeys(ProtoUtilV1.NS_COVER_ASSURANCE_TOKEN, key, assuranceToken);
s.setUintByKeys(ProtoUtilV1.NS_COVER_ASSURANCE_WEIGHT, key, 500000000 gwei); // Default 50% weight
// Set the fee charged during cover creation
s.setUintByKeys(ProtoUtilV1.NS_COVER_FEE, key, fee);
// Deploy cover liquidity contract
address deployed = s.getVaultFactoryContract().deploy(s, key);
s.setAddressByKeys(ProtoUtilV1.NS_CONTRACTS, ProtoUtilV1.NS_COVER_VAULT, key, deployed);
s.setBoolByKeys(ProtoUtilV1.NS_MEMBERS, deployed, true);
}
Validation checks before adding a new cover
function _validateAndGetFee(bytes32 key, bytes32 info, uint256 stakeWithFee) private view
returns(uint256)
Arguments
Name | Type | Description |
---|---|---|
key | bytes32 | |
info | bytes32 | |
stakeWithFee | uint256 |
Returns
Returns fee required to create a new cover
Source Code
function _validateAndGetFee(
bytes32 key,
bytes32 info,
uint256 stakeWithFee
) private view returns (uint256) {
require(info > 0, "Invalid info");
(uint256 fee, uint256 minStake) = s.getCoverFee();
require(stakeWithFee > fee + minStake, "NEP Insufficient");
require(s.getBoolByKeys(ProtoUtilV1.NS_COVER, key) == false, "Already exists");
return fee;
}
- Address
- BokkyPooBahsDateTimeLibrary
- Commission
- Context
- Controller
- Cover
- CoverAssurance
- CoverBase
- CoverProvision
- CoverStake
- CoverUtilV1
- cToken
- cTokenFactory
- Destroyable
- ERC20
- FakeStore
- FakeToken
- Governance
- GovernanceUtilV1
- ICommission
- ICover
- ICoverAssurance
- ICoverProvision
- ICoverStake
- ICToken
- ICTokenFactory
- IERC20
- IERC20Metadata
- IGovernance
- IMember
- IPolicy
- IPolicyAdmin
- IPriceDiscovery
- IProtocol
- IReporter
- IStore
- IVault
- IVaultFactory
- IWitness
- MaliciousToken
- Migrations
- NTransferUtilV2
- NTransferUtilV2Intermediate
- Ownable
- Pausable
- Policy
- PolicyAdmin
- PolicyManager
- PriceDiscovery
- Protocol
- ProtoUtilV1
- Recoverable
- ReentrancyGuard
- Reporter
- SafeERC20
- SafeMath
- Store
- StoreBase
- StoreKeyUtil
- Vault
- VaultFactory
- VaultPod
- Witness