Note Contract

NoteV2

Interface

contract NoteV2{
	mapping(uint256 => mapping(uint8 => mapping(uint256 => uint256)))
        public optionOrder;
    uint8[3] public cycleDay;
	   struct Fund {uint256 buyTime;uint256 investTime;uint256 endTime;uint256 balance;uint256 optionPercent;uint256[2] funds;uint256[2] position;uint256 totalFunds;uint256 profitPerShare;address manager;uint8 status;}
    Fund[] public fundList;
	mapping(address => mapping(uint256 => uint256)) public userBalance;
	mapping(address => bool) public manager;
    uint256[4] public rate;
	event Subscription(
        uint256 fundId,
        address user,
        uint256 amount,
        uint256 fee
    );
    event EarlyRedemption(uint256 fundId, address user, uint256 amount);
    event Redemption(uint256 fundId, address user, uint256 amount);
    event FixedInvestmentMint(
        uint256 fundId,
        uint256 payAmount,
        uint256 cToken
    );
    event FixedInvestmentRedeem(
        uint256 fundId,
        uint256 payAmount,
        uint256 cToken
    );
    event OptionOpen(uint256 fundId, uint256 orderNo);
    event OptionClose(
        uint256 fundId,
        uint256 orderNo,
        uint256 position,
        uint256 income
    );
    event OptionExercise(
        uint256 fundId,
        uint256 orderNo,
        uint256 position,
        uint256 income,
        bool isKnockout
    );
    event NewFund(uint256 fundId);
    event FundClosed(
        uint256 fundId,
        uint256 totalIncome,
        uint256[2] managerProfit
    );
    event FundCanceled(uint256 fundId);
    event SetManager(address manager, bool isManager);
}

Events

  • Subscription(uint256 fundId,address user,uint256 amount,uint256 fee)

User subscription

  • EarlyRedemption(uint256 fundId, address user, uint256 amount)

Redemption before expiration

  • Redemption(uint256 fundId, address user, uint256 amount)

Redemption on maturity

  • FixedInvestmentMint(uint256 fundId, uint256 payAmount, uint256 cToken)

Invest compound

  • FixedInvestmentRedeem(uint256 fundId, uint256 payAmount, uint256 cToken)

Withdraw the amount of invest compound

  • OptionOpen(uint256 fundId,uint256 indexNo,uint8 poolId, uint256 orderNo)

Invest option

  • OptionExercise(uint256 fundId, uint256 orderNo,uint256 position,uint256 income, bool isKnockout)

Withdraw the amount of invest option

Invest option

  • OptionClose(uint256 fundId,uint256 orderNo,uint256 position,uint256 income)

Option exercise

  • NewFund(uint256 fundId)

New fund

  • FundClosed( uint256 fundId, uint256 totalIncome, uint256[2] managerProfit)

Fund closed

  • FundCanceled(uint256 fundId)

Fund canceled

  • SetManager(address manager, bool isManager)

Set manager rights

Methods(Read Contract)

1. User Balance

mapping(address => mapping(uint256 => uint256)) public userBalance

The amount of user invested

1.Pay Token

IERC20 public immutable payToken

View payment token

2. Option Order

mapping(uint256 => mapping(uint8 => mapping(uint256 => uint256))) public optionOrder

View fundId that map with option contract

3. Cycle Day

uint8[3] public cycleDay

**Cycle day,unit/day **

4. Manager

mapping(address => bool) public manager

Whether is manager

5. Fund List

  struct Fund {
        uint256 buyTime;
        uint256 investTime;
        uint256 endTime;
        uint256 balance;
        uint256 optionPercent;
        uint256[2] funds;
        uint256[2] position;
        uint256 totalFunds;
        uint256 profitPerShare; // muti by 1e18;
        address manager;
        uint8 status; //1 Fundraising;2 Investing;3 end;4 cancel;
    }
    Fund[] public fundList;

**Fund details **

6. Get Fund

function getFund(uint256 _fundId) external view returns (uint256[2] memory funds, uint256[2] memory position)

Get fund investment situation

7. Manager

mapping(address => bool) public manager

Whether is fund manager

Methods(Write Contract)

1. Subscription

function subscription(uint256 _fundId, uint256 _amount) external

Invest fund

2. Partial Redemption

function partialRedemption(uint256 _fundId, uint256 _amount) external

Redemotion before closed

3. Redemption

function redemption(uint256 _fundId) external

**Redemption at expiration **

Fund manager operations

4. Add Fund

function addFund( uint256 _buyTime, uint256 _investTime, uint8 _cycleIndex, uint256 _optionPercent )

**Add fund product **

5.Cancel Note

function cancelFund(uint256 _fundId) external

**Cancel note **

6. Close Fund

function closeFund(uint256 _fundId) external

After the expiration, close the fund, and then user can be redeemed, at the same time the fund manager gains

7. Invest Option

function optionOpen( uint256 _fundId, uint256 _indexNo,uint8 _poolId, uint256 _position, bool _isCall, uint256 _price, uint256 _datetime, bytes calldata _signData ) external

Invest option

8.Fixed Investment Mint

function fixedInvestmentMint(uint256 _fundId, uint256 _amount) external

Invest compound

9. Fixed Investment Redeem

function fixedInvestmentRedeem(uint256 _fundId, uint256 _cTokenAmount)

**Withdraw compound **

10. Withdraw Option

function optionClose( uint256 _fundId, uint256 _orderNo, uint256 _position, uint256 _price, uint256 _datetime, bytes calldata _signData ) external

Withdraw option

11. Option Exercise

function optionExercise(uint256 _fundId,uint256 _indexNo, uint8 _poolId, uint256 _orderNo, bool _isKnockOut ) external

Option exercise at expiration

Last updated