# cBridge Contract Withdraw
## Production
### Query Liquidity
```
curl -X GET 'https://cbridge-prod2.celer.network/v1/getLPInfoList?addr=<your contract address>'
```
### Query Liquidity withdraw
```
curl -X GET 'https://cbridge-prod2.celer.network/v1/queryLiquidityStatus?seq_num=<_wdSeq>&lp_addr=<_receiver>&chain_id=<_toChain>&type=2&tx_hash='
```
### Contracts
#### Mainnet
| | address | link |
|:-------------------- |:------------------------------------------ |:-------------------------------------------------------------------------------:|
| **ethereumOperator** | 0x5268b3c4afb0860D365a093C184985FCFcb65234 | [link](https://etherscan.io/address/0x5268b3c4afb0860D365a093C184985FCFcb65234) |
#### BSC
| | address | link |
|:-------------------- |:------------------------------------------ |:-------------------------------------------------------------------------------:|
| **BSCOperator** | 0x6c69B26fBfdDA4d38e3aE2E32dCE0AB66Ba2C3c9 | [link](https://bscscan.com/address/0x6c69B26fBfdDA4d38e3aE2E32dCE0AB66Ba2C3c9) |
#### Optimism
| | address | link |
|:-------------------- |:------------------------------------------ |:-------------------------------------------------------------------------------:|
| **OpOperator** | 0x70a35414FaD53752C9352401BE211779EC413BD4 | [link](https://optimistic.etherscan.io/address/0x70a35414FaD53752C9352401BE211779EC413BD4) |
#### Polygon
| | address | link |
|:-------------------- |:------------------------------------------ |:-------------------------------------------------------------------------------:|
| **polyOperatorUSX** | 0x99E8352D079326Bc431633a61954F713AafE372C | [link](https://polygonscan.com/address/0x99E8352D079326Bc431633a61954F713AafE372C) |
#### Avalanche
| | address | link |
|:-------------------- |:------------------------------------------ |:-------------------------------------------------------------------------------:|
| **polyOperatorUSX** | 0xcA09A0a386ac213703e7F70f0b468dde39f026BC | [link](https://explorer.kava.io/address/0xcA09A0a386ac213703e7F70f0b468dde39f026BC) |
## Testnet
### Query the liquidity provided by contract
```
curl -X GET 'https://cbridge-v2-test.celer.network/v1/getLPInfoList?addr=0x1CEB4159Cf5106CC4a5746E41D162F6e769E2F66'
```
### Contracts on Goerli
USDT(USX): 0xf4B2cbc3bA04c478F0dC824f4806aC39982Dce73
CBridge: 0x358234B325EF9eA8115291A8b81b7d33A2Fa762D
WithdrawBox: 0x0633baDb283D1e7fbadc5ADd02a62a4F4516e568
### TestOperator Contract Address
`0x1CEB4159Cf5106CC4a5746E41D162F6e769E2F66`
https://goerli.etherscan.io/address/0x1CEB4159Cf5106CC4a5746E41D162F6e769E2F66
100000000 means 100%
### ABI
```
[
{
"inputs": [
{
"internalType": "uint256",
"name": "_amount",
"type": "uint256"
}
],
"name": "depositToCBridge",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint32",
"name": "_ratio",
"type": "uint32"
}
],
"name": "requestWithdrawFromCBridge",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes",
"name": "_wdmsg",
"type": "bytes"
},
{
"internalType": "bytes[]",
"name": "_sigs",
"type": "bytes[]"
},
{
"internalType": "address[]",
"name": "_signers",
"type": "address[]"
},
{
"internalType": "uint256[]",
"name": "_powers",
"type": "uint256[]"
}
],
"name": "withdrawFromCBridge",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "withdrawNonce",
"outputs": [
{
"internalType": "uint64",
"name": "",
"type": "uint64"
}
],
"stateMutability": "view",
"type": "function"
}
]
```
## Submit withdraw request:
nonce = 0 withdraw 50%
https://goerli.etherscan.io/tx/0x07a87ca7c427043f803bfc10d6df39dca1c7bdfce8e41047cb37b40ba6ba452b
nonce = 1 withdraw 100%
https://goerli.etherscan.io/tx/0xed6ec53321b811f9a6d08eeecbd31de5ad252784307184677d0b175b3978657f
## Query the latest nonce of request
```
await operator.withdrawNonce()
withdrawNonce = chainid << 32 + sequenceNumber
```
## Query withdraw request status
- seq_num: withdrawNonce
- lp_addr: OperatorAddress
- chain_id: chainId
Query:
```
curl -X GET 'https://cbridge-v2-test.celer.network/v1/queryLiquidityStatus?seq_num=21474836480&lp_addr=0x1CEB4159Cf5106CC4a5746E41D162F6e769E2F66&chain_id=5&type=2&tx_hash='
```
https://cbridge-docs.celer.network/tutorial/smart-contract-as-lp#query-your-withdrawal-request
Response
```
{
"err": null,
"status": 2,
"wd_onchain": "CAUQARoUSHfbWOt49ti6I70YsphH1nb6MD4iFPSyy8O6BMR48NyCT0gGrDmYLc5zKgUBKgXyAA==",
"sorted_sigs": [
"mEQQe/3av5CIwg79F1OC//tNQYA7Me7C7Lv5+HFyZQ5wflIBDnezrH1v9m4QnCDCcemKwEmgIvNjjw3rcmUN0hw=",
"MXcn+cnKpbMdS4V5lKfEmxeu/O8hivnFFWCAHkBZZ01ap5dlS8fHuwbfgB2wXRvfOPYxkCRavsWZ+2F9pGfX+Rs=",
"4gpuRkPvaOgznpP8Zb+SopN6DX2AzT3BptO4VUvex6pbMaagN7WObJKOkB97J0IVYdHQf8M6yrRPE+gv8leQhBs="
],
"signers": [
"afcdW46iJXHU2+JxPDGns9yk0jQ=",
"pQACNVE4h2O3IICMCwzfAKdStp8=",
"pSItCOb+GXa1jDYzZA/xxl87xcE=",
"pTM822LmU58+waekF8LVXMoYHgA="
],
"powers": [
"j6gjP7LBKAAA",
"iBE/VXM2eAAA",
"UVCuhKjN8AAA",
"UVCuhKjN8AAA"
],
"block_tx_link": "",
"block_delay": 5
}
```
## Submit withdraw on-chain
```
await operator.withdrawFromCBridge(_wdmsg, _sigs, _signers, _powers);
```
https://goerli.etherscan.io/tx/0x080794215ff4291f3c3cc0d01880877937cf345d24f2d3badb622465a2741d8a
https://goerli.etherscan.io/tx/0x102861d24041aa1bbaac722a405f8e4d0bbaa2ca4d3662cf4ca77c1b9493fd0b