GP - Transferring out from a Gas Pump Address
This article covers what steps you need to follow to transfer assets from a "Slave GP Contract Address". The Fee Estimate is also included. Check the full Gas Pump guide at the following link.
Steps
The following steps and examples are based on Ethereum Sepolia (testnet).
Step_1: Gather the transfer parameter details
- Confirm the EVM network where the transaction will be executed.
- Confirm your "Master GP Address" and network match.
- Confirm the "Slave GP Contract Address" and network match.
- Confirm the "Slave GP Contract Address" has been "Activated" - Additional details in the guide.
Step_2: Estimate the transfer fees
Gas Pump is a Smart Contract. As such, a standard transfer fee estimate won't be sufficient. If you want to manually calculate the transfer fees, and set the fee amount, you need to use our dedicated GP Fee Estimate endpoint.
Request example:
- Request Body Schema:
EstimateFeeTransferFromCustodial
- Returns the estimated
GasPrice
andGasLimit
curl --location 'https://api.tatum.io/v3/blockchain/estimate' \
--header 'Content-Type: application/json' \
--header 'x-api-key: {YOUR_API_KEY}' \
--data '{
"chain": "ETH",
"type": "TRANSFER_CUSTODIAL", //For Gas Pump transfers
"tokenType": 0, // ERC-20 token transfer == 0
"recipient": "0x5593549ead3b3bd6e4b049ed607ec0f422208298",
"contractAddress": "0x03cee0939F57855EB95437f4a0EFA7B1AfBFA4c6", //The ERC-20 ContractAddress
"sender": "0xc1eb70a67e8fd5ff1863c22d4f2856cc7953a7d2", // Your "Master GP Address"
"custodialAddress": "0x73b10492E49B7Ce4cc8dD7F80F38147Ad8DA5Bdf",//Your "Slave GP Contract Address"
"amount": "10"
}'
//Response:
{
"gasLimit": 68474,
"gasPrice": 49.863787952
}
Step_3: Check the balance of your "Master Gas Pump Address"
- BSC - v3 REST API endpoint
- Celo - v3 REST API endpoint
- Ethereum - v3 REST API endpoint
- Polygon - v3 REST API endpoint
- ...
Make sure the "Gas Pump Master Address" holds enough Native Assets to pay for the Gas fees for the transaction.
Request example:
curl --location 'https://api.tatum.io/v3/ethereum/account/balance/0xc1eb70a67e8fd5ff1863c22d4f2856cc7953a7d2' \
--header 'x-api-key: {YOUR_API_KEY}'
//Response:
{
"balance": "1.502"
}
Step_4: Check the balance of your "Slave GP Contract Address"
Make sure the "Slave GP Contract Address" from which you want to transfer out holds enough Assets to do so.
Request example:
curl --location 'https://api.tatum.io/v3/blockchain/token/balance/ETH/0x03cee0939F57855EB95437f4a0EFA7B1AfBFA4c6/0x73b10492E49B7Ce4cc8dD7F80F38147Ad8DA5Bdf' \
--header 'x-api-key: {YOUR_API_KEY}'
//Response:
{
"balance": "99870000000000000000000" //Mind the Token Digits, 18 in this case.
}
Mind the Token Digits.
Step_5: Transfer out from a "Slave GP Contract Address" with manual fees
- v3 REST API endpoint - You can send only one asset per API call. If you want to send multiple assets, use the following v3 REST API endpoint
- In your custodial application, implement a mechanism that allows your End-users to send (transfer) assets from their deposit addresses ("Slave GP Contract Address") to outside your Exchange or Application.
Request example:
- Returns the hash (ID) of the transfer transaction
curl --location 'https://api.tatum.io/v3/blockchain/sc/custodial/transfer' \
--header 'Content-Type: application/json' \
--header 'x-api-key: {YOUR_API_KEY}' \
--data '{
"chain": "ETH",
"custodialAddress": "0x73b10492E49B7Ce4cc8dD7F80F38147Ad8DA5Bdf", // Your "Slave GP Contract Address"
"recipient": "0x5593549ead3b3bd6e4b049ed607ec0f422208298",
"contractType": 0, // ERC-20 token transfer == 0
"amount": "10",
"tokenAddress":"0x03cee0939F57855EB95437f4a0EFA7B1AfBFA4c6", // The ContractAddress of the ERC-20 token
"fromPrivateKey": "####" // Your "Master GP Address" PrivateKey
"fee": {
"gasLimit": "68474",
"gasPrice": "50"
}
}'
//Response:
{
"txId": "0x0c6daf3044b562d01c26874e3b1163ed58cc1ba3ce8aa646a01789389e774beb"
}
Good to Know
- Example transactions performed over Ethereum-Sepolia Testnet
- Master GP Address covers the gas fees for sending assets.
- Ensure that Master GP Address always has enough funds to cover gas fees.
- Only activated "Slave GP Contract Address can transfer out assets.
Updated 4 months ago