github.com/status-im/status-go@v1.1.0/services/wallet/router/pathprocessor/proto_cbridge/gateway.proto (about) 1 syntax = "proto3"; 2 package cbridge; 3 4 import "query.proto"; 5 import "cbridge.proto"; 6 7 option go_package = "../cbridge"; 8 9 10 message Chain { 11 uint32 id = 1; 12 string name = 2; 13 string icon = 3; 14 uint32 block_delay = 4; 15 string gas_token_symbol = 5; 16 string explore_url = 6; 17 reserved 7; // rpc_url removed 18 string contract_addr = 8; // bridge contract addr 19 string drop_gas_amt = 9; // how much gas will be dropped on dst chain when transfer(dst chain gas token) 20 double suggested_base_fee = 10; // only for backend 21 } 22 23 message ChainTokenInfo { 24 repeated TokenInfo token = 1; 25 } 26 27 message TokenInfo { 28 Token token = 1; 29 string name = 2; 30 string icon = 3; 31 } 32 33 message TransferInfo { 34 Chain chain = 1; 35 Token token = 2; 36 string amount = 3; 37 } 38 39 message GetTransferStatusRequest { 40 string transfer_id = 1; 41 } 42 43 message GetTransferStatusResponse { 44 ErrMsg err = 1; 45 TransferHistoryStatus status = 2; 46 bytes wd_onchain = 3; // for refund only 47 repeated bytes sorted_sigs = 4; // for refund only 48 repeated bytes signers = 5; // for refund only 49 repeated bytes powers = 6; // for refund only 50 XferStatus refund_reason = 7; // used only for to_be_refund TransferStatus. BAD_LIQUIDITY, BAD_SLIPPAGE and BAD_TOKEN are used here 51 uint32 block_delay = 8; // waiting 52 string src_block_tx_link = 9; 53 string dst_block_tx_link = 10; 54 } 55 56 message GetTransferConfigsRequest {} 57 58 message GetTransferConfigsResponse { 59 ErrMsg err = 1; 60 repeated Chain chains = 2; 61 map<uint32, ChainTokenInfo> chain_token = 3; // map<chain_id, ChainTokenInfo> 62 string farming_reward_contract_addr = 4; 63 } 64 65 message GetTokenInfoRequest { 66 uint32 chain_id = 1; 67 string token_symbol = 2; 68 } 69 70 message GetTokenInfoResponse { 71 ErrMsg err = 1; 72 TokenInfo token_info = 2; 73 } 74 75 message EstimateAmtRequest { 76 uint32 src_chain_id = 1; 77 uint32 dst_chain_id = 2; 78 string token_symbol = 3; 79 string amt = 4; 80 string usr_addr = 5; 81 uint32 slippage_tolerance = 6; // user setting, for ui only, slippage * 1M, eg. 0.5% is 5000 82 } 83 84 message EstimateAmtResponse { 85 ErrMsg err = 1; 86 string eq_value_token_amt = 2; // on_dst_chain, to cal minimum_received_amt = eq_value_token_amt*(1-slippage_tolerance) - fee 87 float bridge_rate = 3; 88 string perc_fee = 4; // on_dst_chain, percentage fee based on amount 89 string base_fee = 7; // on_dest_chain, independent of amount, to cover relay onchain tx gas cost 90 uint32 slippage_tolerance = 5; // user setting, from request, slippage * 1M, eg. 0.5% is 5000 91 uint32 max_slippage = 6; // param for requesting on chain, slippage * 1M, eg. 0.5% is 5000 92 } 93 94 message WithdrawInfo { 95 uint32 chain_id = 1; 96 string amount = 2; 97 uint32 slippage_tolerance = 3; // user setting, for ui only, slippage * 1M, eg. 0.5% is 5000 98 } 99 100 message EstimateWithdrawAmtRequest { 101 repeated WithdrawInfo src_withdraws = 1; 102 uint32 dst_chain_id = 2; 103 string token_symbol = 3; 104 string usr_addr = 4; 105 } 106 107 message EstimateWithdrawAmtResponse { 108 ErrMsg err = 1; 109 map<uint32, EstimateWithdrawAmt> req_amt = 2; // map<src_chain_id, EstimateWithdrawAmt> 110 } 111 112 message EstimateWithdrawAmt { 113 string eq_value_token_amt = 1; // on_dst_chain, to cal minimum_received_amt = eq_value_token_amt*(1-slippage_tolerance) - fee 114 float bridge_rate = 2; 115 string perc_fee = 3; // on_dst_chain, percentage fee based on amount 116 string base_fee = 4; // on_dest_chain, independent of amount, to cover relay onchain tx gas cost 117 uint32 slippage_tolerance = 5; // user setting, for ui only, slippage * 1M, eg. 0.5% is 5000 118 uint32 max_slippage = 6; // param for requesting on chain, slippage * 1M, eg. 0.5% is 5000 119 } 120 121 message WithdrawLiquidityRequest { 122 bytes withdraw_req = 1; // serialized WithdrawReq in sgn/cbridge/v1/tx.proto 123 bytes sig = 2; 124 string estimated_received_amt = 3; // on dst chain 125 WithdrawMethodType method_type = 4; // record which type it is 126 } 127 128 message WithdrawLiquidityResponse { 129 ErrMsg err = 1; 130 uint64 seq_num = 2; // same as WithdrawLiquidityRequest.reqid 131 } 132 133 message TransferHistory { 134 string transfer_id = 1; 135 TransferInfo src_send_info = 2; 136 TransferInfo dst_received_info = 3; 137 uint64 ts = 4; 138 string src_block_tx_link = 5; 139 string dst_block_tx_link = 6; 140 TransferHistoryStatus status = 7; 141 XferStatus refund_reason = 8; // used only for to_be_refund TransferStatus. BAD_LIQUIDITY, BAD_SLIPPAGE and BAD_TOKEN are used here 142 } 143 144 message TransferHistoryRequest { 145 string next_page_token = 1; // for first page, it's "" 146 uint64 page_size = 2; 147 string addr = 3; 148 } 149 150 message TransferHistoryResponse { 151 ErrMsg err = 1; 152 repeated TransferHistory history = 2; 153 string next_page_token = 3; 154 uint64 current_size = 4; 155 } 156 157 enum WithdrawMethodType { 158 WD_METHOD_TYPE_UNDEFINED = 0; 159 WD_METHOD_TYPE_ONE_RM = 1; // for lp one chain liquidity remove 160 WD_METHOD_TYPE_ALL_IN_ONE = 2; // for lp multi-chain -> one chain liquidity remove 161 WD_METHOD_TYPE_STAKING_CLAIM = 3; // for staking claim lp reward, these entries will not be shown in lp history 162 } 163 164 message ErrMsg { 165 ErrCode code = 1; 166 string msg = 2; 167 } 168 169 enum ErrCode { 170 ERROR_CODE_UNDEFINED = 0; 171 ERROR_CODE_COMMON = 500; 172 ERROR_NO_TOKEN_ON_DST_CHAIN = 1001; 173 ERROR_NO_TOKEN_ON_SRC_CHAIN = 1002; 174 ERROR_INIT_WITHDRAW_FAILED = 1003; 175 }