Make a Quotation for New Round

Description

Make a new quotation for next round.

User Interface

TODO(Snapshots)

Function Description

Contract Address

MVault contract (referenced by General Info section)

Contract Name

MVault.sol

Function

function quote(

uint256 _strikePrice,

uint256 _APY,

uint256 _maxVolume,

uint256 _minDeposit,

uint256 _endTime

) public

Function Selector

0xcf408eb1

Invocation Type

Ethereum Transaction

Passing Parameters

uint256 _strikePrice: strike price for MVault, actual number multiplied by 1E18

uint256 _APY: APY for MVault, actual number multiplied by 1E18(1e18 means 100%)

uint256 _maxVolume: Maximum volume for MVault, actual number multiplied by 1E(token precision)

uint256 _minDeposit: Minimum deposit amount for user, actual number multiplied by 1E(token precision)

uint256 _endTime: End Timestamp for next round MVault

Return Value

None

Event Emitted

None

Event Signature

None

Transaction Sample(Kovan testnet)

ABI Description

    {
      "inputs": [
        {
          "internalType": "uint256",
          "name": "_strikePrice",
          "type": "uint256"
        },
        {
          "internalType": "uint256",
          "name": "_APY",
          "type": "uint256"
        },
        {
          "internalType": "uint256",
          "name": "_maxVolume",
          "type": "uint256"
        },
        {
          "internalType": "uint256",
          "name": "_minDeposit",
          "type": "uint256"
        },
        {
          "internalType": "uint256",
          "name": "_endTime",
          "type": "uint256"
        }
      ],
      "name": "quote",
      "outputs": [],
      "stateMutability": "nonpayable",
      "type": "function"
    }

Examples

Calling Examples

var Web3 = require('web3');
const BigNumber = require('bignumber.js');

// BSC Mainnet: https://bsc-dataseed.binance.org
// BSC Testnet: https://data-seed-prebsc-1-s1.binance.org:8545
const  web3 = new Web3("https://data-seed-prebsc-1-s1.binance.org:8545");

// Need MVault contract address
const CONTRACT_ADDRESS = "";
const ABI = [    {
      "inputs": [
        {
          "internalType": "uint256",
          "name": "_strikePrice",
          "type": "uint256"
        },
        {
          "internalType": "uint256",
          "name": "_APY",
          "type": "uint256"
        },
        {
          "internalType": "uint256",
          "name": "_maxVolume",
          "type": "uint256"
        },
        {
          "internalType": "uint256",
          "name": "_minDeposit",
          "type": "uint256"
        },
        {
          "internalType": "uint256",
          "name": "_endTime",
          "type": "uint256"
        }
      ],
      "name": "quote",
      "outputs": [],
      "stateMutability": "nonpayable",
      "type": "function"
    }];

var contract = new web3.eth.Contract(ABI, CONTRACT_ADDRESS);

contract.methods.quote(
    BigNumber(60000).times(1e18).toString(10),
    BigNumber(0.1).times(1e18).toString(10),
    BigNumber(100).times(1e18).toString(10),
    BigNumber(0.01).times(1e18).toString(10),
    parseInt(Date.now() / 1000) + 60 * 60 * 24 * 7  ).send({
    from: "CALLER_ADDRESS",
}, function(error, result){
    if(!error) {
      console.log('Response:', result);
    } else {
      console.log(error);
    }
});

HTTP Request Example

Make a quotation

POST (BSC Mainnet) https://bsc-dataseed.binance.org/

Pay token margin for MVault. More details on how to send a transaction via BSC RPC could be found here, https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendrawtransaction

Request Body

Name
Type
Description

jsonrpc*

string

"2.0"

method*

string

"eth_sendRawTransaction"

params*

array

the signed transaction data coerced into string array

id*

number

request sequence id, you could use timestamp as id

{
  "id":64,
  "jsonrpc": "2.0",
  "result": "0x146695866343024d1ad9854a72904d16abec8b1597e098619d2addbd44b14e4c"
}

Last updated