# Amino X Bridge Out Documentation <br/><font color="gray">(Aminio X 出金文件)</font>
According to the Amino X official documentation, bridge out could be accomplish by interact with contract and no API required.
<font color="gray">根據 Amino X 官方文件, 出金流程可以只靠跟合約互動即可完成而無需額外的API</font>
## Withdraw Function <br /><font color="gray">出金函式</font>
```solidity
transferBridgedOut(
address to,
uint256 value,
uint256 targetChainId,
uint256 targetChainType
) external returns (bool) {
...
}
```
## Target Chain ID List <br /><font color="gray">鏈 ID 列表</font>
Binance mainnet: 56
<font color="gray">幣安主鏈: 56</font>
Binance testnet: 97
<font color="gray">幣安測試鏈: 97</font>
Tron mainnet: 11111
<font color="gray">Tron 主鏈: 11111</font>
Tron Shasta testnet: 1
<font color="gray">Tron Shasta 測試鏈: 1</font>
## Target Chain Type List <br /><font color="gray">鏈類型列表</font>
```
0: ethereum
1: binance
2: aminox
3: polygon
4: tron
```
## Some Example <br /><font color="gray">範例</font>
For Example, the following command should be sent if we want to bridge out USDT from Amino X testnet to Binance testnet<br /><font color="gray">舉例說明:如果我們想要從 Amino X 測試鏈出金至幣安測試鏈, 應該要執行以下指令</font>
```shell
cast send --rpc-url https://aminoxtestnet.node.alphacarbon.network \
--private-key 000000000000000000000000000000000000000... \
{token_address} \ *address of USDT, ACT...
"transferBridgedOut(address, uint256, uint256, uint256)" \
{to_address} \ *target addresse you want to withdraw to
{value * decimals of the token} \
97 \
1
```
## Token Address List <br /><font color="gray">Token 地址列表</font>
Mainnet: https://aminox.blockscout.alphacarbon.network/tokens
Testnet: https://aminoxtestnet.blockscout.alphacarbon.network/tokens
## Tron Address Handle
Tron address is quite differnet to Amino X and Binance, we must handle the tron address with different way, here is the example code from Amino X team.<br /><font color="gray">Tron 的地址格式與 Amino X 和幣安鏈不太一樣, 我們必須對Tron 的地址作額外處理, 以下是 Amino X 的團隊提供的程式碼範例</font>
```javascript
const decodeBase58Address = (base58Sting: string) => {
if (typeof base58Sting != 'string') return undefined;
if (base58Sting.length <= 4) return undefined;
return `0x${Buffer.from(bs58.decode(base58Sting))
.toString('hex')
.substring(2, 42)}`;
};
// if to chain is Tron, must decode address
const hexAddress =
toChain === EChainType.tron
? decodeBase58Address(address)
: address;
```
## Bridge abi.json
```json
[
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "BridgeFee",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "to",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "Transfer",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "to",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "amount",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "sourceChainId",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "sourceChainType",
"type": "uint256"
}
],
"name": "TransferBridgedIn",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "bridgeAddress",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "to",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "amount",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "targetChainId",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "targetChainType",
"type": "uint256"
}
],
"name": "TransferBridgedOut",
"type": "event"
},
{
"inputs": [
{
"internalType": "address",
"name": "recipient",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "transfer",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "value",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "sourceChainId",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "sourceChainType",
"type": "uint256"
}
],
"name": "transferBridgedIn",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "value",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "targetChainId",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "targetChainType",
"type": "uint256"
}
],
"name": "transferBridgedOut",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "account",
"type": "address"
}
],
"name": "balanceOf",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "decimals",
"outputs": [
{
"internalType": "uint8",
"name": "",
"type": "uint8"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "name",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "owner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "symbol",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "totalSupply",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
}
]
```