# 5. Withdraw DAI from Public Pool

## Description

Withdraw DAIs from public liquidity pool. Once you retrieve your DAIs from the public pool, your reDAIs will be switched to DAIs.

**TBD: Narratives**

**TBD: Lock/Unlock Period Explanation**

## User Interface

![Withdrawal Panel](/files/-Mf6tR2CELoXrCoUP8dA)

## Function Description

|                 Item                |                                             Description                                             |
| :---------------------------------: | :-------------------------------------------------------------------------------------------------: |
|         **Contract Address**        |                 Public pool contract (referenced by Smart Contract Overview section)                |
|          **Contract Name**          |                                           SLDDAIPools1.sol                                          |
|             **Function**            |                               function withdraw(uint256 reTokenAmount)                              |
|        **Function Selector**        |                                              0x3c264195                                             |
|         **Invocation Type**         |                                         Ethereum Transaction                                        |
|        **Passing Parameters**       |            Amount of DAIs to withdraw from public pool; actual number multiplied by 1E18            |
|           **Return Value**          |                                                 None                                                |
|          **Event Emitted**          |                       event Withdraw(address indexed account, uint256 amount);                      |
|         **Event Signature**         |                  0x884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364                 |
| **Transaction Sample(BSC testnet)** | <https://testnet.bscscan.com/tx/0x32b4fc3be4d017b0f3025a2228201324559219f71c91518beea7943da9f967ed> |

## ABI Description

```
{
	"inputs": [{
		"internalType": "uint256",
		"name": "reTokenAmount",
		"type": "uint256"
	}],
	"name": "withdraw",
	"outputs": [{
		"internalType": "uint256",
		"name": "reAmount",
		"type": "uint256"
	}],
	"stateMutability": "nonpayable",
	"type": "function"
}
```

## Examples

### Calling Examples

{% tabs %}
{% tab title="JavaScript" %}

```javascript
var Web3 = require('web3');
const BigNumber = require('bignumber.js');

// BSC Mainnet: https://bsc-dataseed.binance.org
// BSC Testnet: https://data-seed-prebsc-1-s1.binance.org:8545
const  web3 = new Web3("https://data-seed-prebsc-1-s1.binance.org:8545");

const CONTRACT_ADDRESS = "Replace with Public Pool Contract Address";
const ABI = [{
	"inputs": [{
		"internalType": "uint256",
		"name": "reTokenAmount",
		"type": "uint256"
	}],
	"name": "withdraw",
	"outputs": [{
		"internalType": "uint256",
		"name": "reAmount",
		"type": "uint256"
	}],
	"stateMutability": "nonpayable",
	"type": "function"
}];

// Withdraw Deposit 1 DAI to public pool.
const DEPOSIT_AMOUNT = 1e18;

var contract = new web3.eth.Contract(ABI, CONTRACT_ADDRESS);

contract.methods.withdrawvide(new BigNumber(DEPOSIT_AMOUNT).toString()).send({
    from: "CALLER_ADDRESS",
}, function(error, result){
    if(!error) {
      console.log('Response:', result);
    } else {
      console.log(error);
    }
});
```

{% endtab %}

{% tab title="Python" %}

```
# This example is written by using Web3.py
# More details on Web3.py could be found here - https://web3py.readthedocs.io/


```

{% endtab %}
{% endtabs %}

### HTTP Request Example

## Send a Deposit Transaction

<mark style="color:green;">`POST`</mark> `(BSC Mainnet) https://bsc-dataseed.binance.org/`

Make a deposit transaction to Shield Protocol V1 on BSC network.\
More details on how to send a transaction via BSC RPC could be found here, <https://ethereum.org/en/developers/docs/apis/json-rpc/#eth\\_sendrawtransaction>

#### Request Body

| Name    | Type   | Description                                           |
| ------- | ------ | ----------------------------------------------------- |
| jsonrpc | string | "2.0"                                                 |
| method  | string | "eth\_sendRawTransaction"                             |
| params  | array  | the signed transaction data coerced into string array |
| id      | number | request sequence id, you could use timestamp as id    |

{% tabs %}
{% tab title="200 Success response." %}

```
{
  "id":64,
  "jsonrpc": "2.0",
  "result": "0x146695866343024d1ad9854a72904d16abec8b1597e098619d2addbd44b14e4c"
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.shieldex.io/tutorials/trading-api-references/interfaces/5.-withdraw-dai-from-public-pool.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
