vegaprotocol / vega

A Go implementation of the Vega Protocol, a protocol for creating and trading derivatives on a fully decentralised network.
https://vega.xyz
GNU Affero General Public License v3.0
37 stars 19 forks source link

Proposal enacts with liquidity provision greater than providers balance #4773

Closed vega-paul closed 2 years ago

vega-paul commented 2 years ago

Submitted a proposal here

{'proposalSubmission': {'reference': '09E4C8C1B5', 'terms': {'closingTimestamp': '1644928948', 'enactmentTimestamp': '1644928950', 'validationTimestamp': '1644928940', 'newMarket': {'changes': {'instrument': {'name': 'Futures System-Tests Market', 'code': 'CRYPTO:VEGA CORE SYS TEST', 'future': {'settlementAsset': '26a0c1d7b4b2c0741f7dd1e810689dafa28c70f7936b82a361bf7b39fc13f993', 'quoteName': 'USD', 'oracleSpecForSettlementPrice': {'pubKeys': ['231da86b4a0bc5cecdeddb5c49555acb32e81e95fabc0b9acfc7d1eac74cf5ee'], 'filters': [{'key': {'name': 'price.BTC.value', 'type': 'TYPE_INTEGER'}, 'conditions': [{'operator': 'OPERATOR_EQUALS', 'value': '100'}]}]}, 'oracleSpecForTradingTermination': {'pubKeys': ['231da86b4a0bc5cecdeddb5c49555acb32e81e95fabc0b9acfc7d1eac74cf5ee'], 'filters': [{'key': {'name': 'trading.termination', 'type': 'TYPE_BOOLEAN'}, 'conditions': [{'operator': 'OPERATOR_EQUALS', 'value': 'True'}]}]}, 'oracleSpecBinding': {'settlementPriceProperty': 'price.BTC.value', 'tradingTerminationProperty': 'trading.termination'}}}, 'decimalPlaces': '5', 'metadata': ['asset_class:fx/crypto', 'product:futures'], 'logNormal': {'riskAversionParameter': 0.001, 'tau': 0.00011407711613050422, 'params': {'r': 0.016, 'sigma': 1.5, 'mu': 0.0}}}, 'liquidityCommitment': {'commitmentAmount': '3905000', 'fee': '0.3', 'sells': [{'reference': 'PEGGED_REFERENCE_BEST_ASK', 'proportion': 13, 'offset': '1'}], 'buys': [{'reference': 'PEGGED_REFERENCE_BEST_BID', 'proportion': 2, 'offset': '1'}], 'reference': '09E4C8C1B5'}}}}, 'propagate': True, 'pubKey': '231da86b4a0bc5cecdeddb5c49555acb32e81e95fabc0b9acfc7d1eac74cf5ee'} with {'txHash': 'F5EFF14C157EA3FD5051ECF602930C674577D8817F05922D73CA9AAD206A7C0F'}

Proposal event

{"id":"21435-20","block":"B19EAC8317F3E40BFF56323882358E06FA46AA2DC35D81E72FD310B897B82117","type":"BUS_EVENT_TYPE_PROPOSAL","proposal":{"id":"34a3fe0d5aea6c042697dc9f1db7e18bd1177bec23c5df7254d1af76f564f402","reference":"09E4C8C1B5","partyId":"231da86b4a0bc5cecdeddb5c49555acb32e81e95fabc0b9acfc7d1eac74cf5ee","state":"STATE_OPEN","timestamp":"1644928939568876300","terms":{"closingTimestamp":"1644928948","enactmentTimestamp":"1644928950","validationTimestamp":"1644928940","newMarket":{"changes":{"instrument":{"name":"Futures System-Tests Market","code":"CRYPTO:VEGA CORE SYS TEST","future":{"settlementAsset":"26a0c1d7b4b2c0741f7dd1e810689dafa28c70f7936b82a361bf7b39fc13f993","quoteName":"USD","oracleSpecForSettlementPrice":{"pubKeys":["231da86b4a0bc5cecdeddb5c49555acb32e81e95fabc0b9acfc7d1eac74cf5ee"],"filters":[{"key":{"name":"price.BTC.value","type":"TYPE_INTEGER"},"conditions":[{"operator":"OPERATOR_EQUALS","value":"100"}]}]},"oracleSpecForTradingTermination":{"pubKeys":["231da86b4a0bc5cecdeddb5c49555acb32e81e95fabc0b9acfc7d1eac74cf5ee"],"filters":[{"key":{"name":"trading.termination","type":"TYPE_BOOLEAN"},"conditions":[{"operator":"OPERATOR_EQUALS","value":"True"}]}]},"oracleSpecBinding":{"settlementPriceProperty":"price.BTC.value","tradingTerminationProperty":"trading.termination"}}},"decimalPlaces":"5","metadata":["asset_class:fx/crypto","product:futures"],"priceMonitoringParameters":{},"liquidityMonitoringParameters":{"targetStakeParameters":{"timeWindow":"10","scalingFactor":5}},"logNormal":{"riskAversionParameter":0.001,"tau":0.00011407711613050422,"params":{"r":0.016,"sigma":1.5}}},"liquidityCommitment":{"commitmentAmount":"3905000","fee":"0.3","sells":[{"reference":"PEGGED_REFERENCE_BEST_ASK","proportion":13,"offset":"1"}],"buys":[{"reference":"PEGGED_REFERENCE_BEST_BID","proportion":2,"offset":"1"}],"reference":"09E4C8C1B5"}}}},"version":1,"chainId":"chain-s0r3uE","txHash":"F5EFF14C157EA3FD5051ECF602930C674577D8817F05922D73CA9AAD206A7C0F"}

The party used to supply the commitment for the liquidity was

'8a3f1186ec9bda1c66a3c11f97568975d925e8b436012f9d7a4848f7beaa68fa'

general balance on this account is

curl "http://0.0.0.0:1013/accounts?party=8a3f1186ec9bda1c66a3c11f97568975d925e8b436012f9d7a4848f7beaa68fa"                               
{
  "accounts": [
    {
      "party": "8a3f1186ec9bda1c66a3c11f97568975d925e8b436012f9d7a4848f7beaa68fa",
      "market": "",
      "balance": "1",
      "asset": "26a0c1d7b4b2c0741f7dd1e810689dafa28c70f7936b82a361bf7b39fc13f993",
      "type": "ACCOUNT_TYPE_GENERAL"
    }
  ]
}
jeremyletang commented 2 years ago

You may get a first event with open, but then the proposal should be cancelled / rejected once we try to instanciate the market with the liquidity as it would not be able to feel the bond.

jeremyletang commented 2 years ago

Also you mention it enacts the proposal. But the events you shared says it's OPEN.

vega-paul commented 2 years ago

WIP

gordsport commented 2 years ago

@vega-paul - can you please update or close this?