Skip to content

Latest commit

 

History

History
597 lines (514 loc) · 9.8 KB

lb-factory.md

File metadata and controls

597 lines (514 loc) · 9.8 KB

lb-factory

Instantiate Message

secretcli tx compute instantiate 1 '{
  "admin_auth": {
    "address": "secret1...foobar",
    "code_hash": "0123456789ABCDEF"
  },
  "query_auth": {
    "address": "secret1...foobar",
    "code_hash": "0123456789ABCDEF"
  },
  "owner": "secret1...owner",
  "fee_recipient": "secret1...recipient",
  "recover_staking_funds_receiver": "secret1...fundsrecipient",
  "max_bins_per_swap": 500
}'

Execute Messages

set_lb_pair_implementation

secretcli tx compute execute secret1foobar '{
  "set_lb_pair_implementation": {
    "implementation": {
      "id": 1,
      "code_hash": "0123456789ABCDEF"
    }
  }
}'

set_lb_token_implementation

secretcli tx compute execute secret1foobar '{
  "set_lb_token_implementation": {
    "implementation": {
      "id": 1,
      "code_hash": "0123456789ABCDEF"
    }
  }
}'

create_lb_pair

secretcli tx compute execute secret1foobar '{
  "create_lb_pair": {
    "token_x": {
      "custom_token": {
        "contract_addr": "secret1...foobar",
        "token_code_hash": "0123456789ABCDEF"
      }
    },
    "token_y": {
      "custom_token": {
        "contract_addr": "secret1...foobar",
        "token_code_hash": "0123456789ABCDEF"
      }
    },
    "active_id": 8388608,
    "bin_step": 100,
    "viewing_key": "api_key_etc",
    "entropy": "shade rocks"
  }
}'

set_pair_preset

secretcli tx compute execute secret1foobar '{
  "set_pair_preset": {
    "bin_step": 100,
    "base_factor": 100,
    "filter_period": 100,
    "decay_period": 100,
    "reduction_factor": 100,
    "variable_fee_control": 100,
    "protocol_share": 100,
    "max_volatility_accumulator": 100,
    "total_reward_bins": 10,
    "rewards_distribution_algorithm": "time_based_rewards",
    "epoch_staking_index": 1,
    "epoch_staking_duration": 100,
    "expiry_staking_duration": null,
    "is_open": true
  }
}'

set_preset_open_state

secretcli tx compute execute secret1foobar '{
  "set_preset_open_state": {
    "bin_step": 100,
    "is_open": true
  }
}'

remove_preset

secretcli tx compute execute secret1foobar '{
  "remove_preset": {
    "bin_step": 100
  }
}'

set_fee_parameters_on_pair

secretcli tx compute execute secret1foobar '{
  "set_fee_parameters_on_pair": {
    "token_x": {
      "custom_token": {
        "contract_addr": "secret1...foobar",
        "token_code_hash": "0123456789ABCDEF"
      }
    },
    "token_y": {
      "custom_token": {
        "contract_addr": "secret1...foobar",
        "token_code_hash": "0123456789ABCDEF"
      }
    },
    "bin_step": 100,
    "base_factor": 100,
    "filter_period": 100,
    "decay_period": 100,
    "reduction_factor": 100,
    "variable_fee_control": 100,
    "protocol_share": 100,
    "max_volatility_accumulator": 100
  }
}'

set_fee_recipient

secretcli tx compute execute secret1foobar '{
  "set_fee_recipient": {
    "fee_recipient": "secret1...recipient"
  }
}'

add_quote_asset

secretcli tx compute execute secret1foobar '{
  "add_quote_asset": {
    "asset": {
      "custom_token": {
        "contract_addr": "secret1...foobar",
        "token_code_hash": "0123456789ABCDEF"
      }
    }
  }
}'

remove_quote_asset

secretcli tx compute execute secret1foobar '{
  "remove_quote_asset": {
    "asset": {
      "custom_token": {
        "contract_addr": "secret1...foobar",
        "token_code_hash": "0123456789ABCDEF"
      }
    }
  }
}'

force_decay

secretcli tx compute execute secret1foobar '{
  "force_decay": {
    "pair": {
      "token_x": {
        "custom_token": {
          "contract_addr": "secret1...foobar",
          "token_code_hash": "0123456789ABCDEF"
        }
      },
      "token_y": {
        "custom_token": {
          "contract_addr": "secret1...foobar",
          "token_code_hash": "0123456789ABCDEF"
        }
      },
      "bin_step": 100,
      "contract": {
        "address": "secret1...foobar",
        "code_hash": "0123456789ABCDEF"
      }
    }
  }
}'

Query Messages with responses

get_min_bin_step

secretcli query compute query secret1foobar '{
  "get_min_bin_step": {}
}'

Response

{
  "min_bin_step": 100
}

get_fee_recipient

secretcli query compute query secret1foobar '{
  "get_fee_recipient": {}
}'

Response

{
  "fee_recipient": "secret1...recipient"
}

get_lb_pair_implementation

secretcli query compute query secret1foobar '{
  "get_lb_pair_implementation": {}
}'

Response

{
  "lb_pair_implementation": {
    "id": 1,
    "code_hash": "0123456789ABCDEF"
  }
}

get_lb_token_implementation

secretcli query compute query secret1foobar '{
  "get_lb_token_implementation": {}
}'

Response

{
  "lb_token_implementation": {
    "id": 1,
    "code_hash": "0123456789ABCDEF"
  }
}

get_number_of_lb_pairs

secretcli query compute query secret1foobar '{
  "get_number_of_lb_pairs": {}
}'

Response

{
  "lb_pair_number": 1
}

get_lb_pair_at_index

secretcli query compute query secret1foobar '{
  "get_lb_pair_at_index": {
    "index": 0
  }
}'

Response

{
  "lb_pair": {
    "token_x": {
      "custom_token": {
        "contract_addr": "secret1...foobar",
        "token_code_hash": "0123456789ABCDEF"
      }
    },
    "token_y": {
      "custom_token": {
        "contract_addr": "secret1...foobar",
        "token_code_hash": "0123456789ABCDEF"
      }
    },
    "bin_step": 100,
    "contract": {
      "address": "secret1...foobar",
      "code_hash": "0123456789ABCDEF"
    }
  }
}

get_number_of_quote_assets

secretcli query compute query secret1foobar '{
  "get_number_of_quote_assets": {}
}'

Response

{
  "number_of_quote_assets": 10
}

get_quote_asset_at_index

secretcli query compute query secret1foobar '{
  "get_quote_asset_at_index": {
    "index": 0
  }
}'

Response

{
  "asset": {
    "custom_token": {
      "contract_addr": "secret1...foobar",
      "token_code_hash": "0123456789ABCDEF"
    }
  }
}

is_quote_asset

secretcli query compute query secret1foobar '{
  "is_quote_asset": {
    "token": {
      "custom_token": {
        "contract_addr": "secret1...foobar",
        "token_code_hash": "0123456789ABCDEF"
      }
    }
  }
}'

Response

{
  "is_quote": true
}

get_lb_pair_information

secretcli query compute query secret1foobar '{
  "get_lb_pair_information": {
    "token_x": {
      "custom_token": {
        "contract_addr": "secret1...foobar",
        "token_code_hash": "0123456789ABCDEF"
      }
    },
    "token_y": {
      "custom_token": {
        "contract_addr": "secret1...foobar",
        "token_code_hash": "0123456789ABCDEF"
      }
    },
    "bin_step": 100
  }
}'

Response

{
  "lb_pair_information": {
    "bin_step": 100,
    "info": {
      "token_x": {
        "custom_token": {
          "contract_addr": "secret1...foobar",
          "token_code_hash": "0123456789ABCDEF"
        }
      },
      "token_y": {
        "custom_token": {
          "contract_addr": "secret1...foobar",
          "token_code_hash": "0123456789ABCDEF"
        }
      },
      "bin_step": 100,
      "contract": {
        "address": "secret1...foobar",
        "code_hash": "0123456789ABCDEF"
      }
    },
    "created_by_owner": true,
    "ignored_for_routing": false
  }
}

get_preset

secretcli query compute query secret1foobar '{
  "get_preset": {
    "bin_step": 100
  }
}'

Response

{
  "base_factor": 100,
  "filter_period": 100,
  "decay_period": 100,
  "reduction_factor": 100,
  "variable_fee_control": 100,
  "protocol_share": 100,
  "max_volatility_accumulator": 100,
  "is_open": false
}

get_all_bin_steps

secretcli query compute query secret1foobar '{
  "get_all_bin_steps": {}
}'

Response

{
  "bin_step_with_preset": [
    20,
    50,
    100
  ]
}

get_open_bin_steps

secretcli query compute query secret1foobar '{
  "get_open_bin_steps": {}
}'

Response

{
  "open_bin_steps": [
    20,
    50,
    100
  ]
}

get_all_lb_pairs

secretcli query compute query secret1foobar '{
  "get_all_lb_pairs": {
    "token_x": {
      "custom_token": {
        "contract_addr": "secret1...foobar",
        "token_code_hash": "0123456789ABCDEF"
      }
    },
    "token_y": {
      "custom_token": {
        "contract_addr": "secret1...foobar",
        "token_code_hash": "0123456789ABCDEF"
      }
    }
  }
}'

Response

{
  "lb_pairs_available": [
    {
      "bin_step": 100,
      "info": {
        "token_x": {
          "custom_token": {
            "contract_addr": "secret1...foobar",
            "token_code_hash": "0123456789ABCDEF"
          }
        },
        "token_y": {
          "custom_token": {
            "contract_addr": "secret1...foobar",
            "token_code_hash": "0123456789ABCDEF"
          }
        },
        "bin_step": 100,
        "contract": {
          "address": "secret1...foobar",
          "code_hash": "0123456789ABCDEF"
        }
      },
      "created_by_owner": true,
      "ignored_for_routing": false
    },
    {
      "bin_step": 100,
      "info": {
        "token_x": {
          "custom_token": {
            "contract_addr": "secret1...foobar",
            "token_code_hash": "0123456789ABCDEF"
          }
        },
        "token_y": {
          "custom_token": {
            "contract_addr": "secret1...foobar",
            "token_code_hash": "0123456789ABCDEF"
          }
        },
        "bin_step": 100,
        "contract": {
          "address": "secret1...foobar",
          "code_hash": "0123456789ABCDEF"
        }
      },
      "created_by_owner": true,
      "ignored_for_routing": false
    }
  ]
}