# Failed to transfer the received BNB in Proxy Contract A to Proxy Contract B

**URL:** https://forum.bnbchain.org/t/failed-to-transfer-the-received-bnb-in-proxy-contract-a-to-proxy-contract-b/2882
**Category:** BNB Smart Chain
**Tags:** evm
**Created:** [June 29, 2024, 7:27pm UTC](https://forum.bnbchain.org/t/failed-to-transfer-the-received-bnb-in-proxy-contract-a-to-proxy-contract-b/2882 "2024-06-29T19:27:28Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![koifarm-office](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.bnbchain.org/koifarm-office/32/2505_2.png) [@koifarm-office](https://forum.bnbchain.org/u/koifarm-office)
#### Post date: [June 29, 2024, 7:27pm UTC](https://forum.bnbchain.org/t/failed-to-transfer-the-received-bnb-in-proxy-contract-a-to-proxy-contract-b/2882/1 "2024-06-29T19:27:28Z")

</div>

Please help me find out what is the cause, thank you very much  
Failed to transfer the received BNB in ​​Proxy Contract A to Proxy Contract B  
ProxyContractA:[TransparentUpgradeableProxy | Address 0x11EeC0063C95Cf9314208294562007248D570F05 | BscScan](https://www.bscscan.com/address/0x11EeC0063C95Cf9314208294562007248D570F05#writeProxyContract)

```auto
    function buySlot(address payable toUser) public payable {
        toUser.transfer(msg.value);
    }

```

ProxyContractB:[TransparentUpgradeableProxy | Address 0xAd9b283B7E745AA1A4ad058f9E5437fA462E2fF8 | BscScan](https://www.bscscan.com/address/0xAd9b283B7E745AA1A4ad058f9E5437fA462E2fF8#writeProxyContract)  
The proxy contract has a function to accept tokens

```auto
	receive() external payable {
		if(msg.sender != founderSaleAddress){
			buy();
		}
	}

```

I can successfully transfer BNB to the proxy contract B using my wallet. The following is the successful record

But when I used proxy contract A to transfer BNB to proxy contract B, it failed. The following is 1 failure record, but most of them failed during gas estimation. I deliberately forced a transaction and it was rolled back.

The proxy contracts of both contracts are compiled with 0.8.10 and have been open sourced in the blockchain browser. The implementation contracts of both contracts are compiled with 0.8.25 and have been open sourced in the blockchain browser.

My test case using hardhat locally is success

```auto
  describe("购买", function () {

    it("购买", async function () {
      const tcpAddress = await tcp314.getAddress()
      await sale.buySlot(tcpAddress, { value: ethers.parseEther("1") });
      expect(await ethers.provider.getBalance(tcpAddress)).to.equal(ethers.parseEther("1"));
    });
  });

```

```auto
yarn test ./test/SaleTest.ts 

  SaleTest
    购买
      ✓ 购买

·-------------------------------|---------------------------|-------------|-----------------------------·
| Solc version: 0.8.25 · Optimizer enabled: true · Runs: 200 · Block limit: 30000000 gas │
································|···························|·············|······························
| Methods │
·················|··············|·············|·············|·············|···············|··············
| Contract · Method · Min · Max · Avg · # calls · eur (avg) │
·················|··············|·············|·············|·············|···············|··············
| SaleTest · buySlot · - · - · 33200 · 1 · - │
·················|··············|·············|·············|·············|···············|··············
| Token314Test · initialize · - · - · 383353 · 1 · - │
·················|··············|·············|·············|·············|···············|··············
| Deployments · · % of limit · │
································|·············|·············|·············|···············|··············
| SaleTest · - · - · 90791 · 0.3 % · - │
································|·············|·············|·············|···············|··············
| Token314Test · - · - · 2536187 · 8.5 % · - │
·-------------------------------|-------------|-------------|-------------|---------------|-------------·

  1 passing (6s)

```

Thanks

Already solved  
Change the transfer method to the following

```auto
    function buySlot(address payable toUser) public payable {
        (bool sent, ) = toUser.call{value: msg.value}("");
        require(sent, "Failed to send Ether");
    }

```

---

<div class="post-metadata">

### Author: ![koifarm-office](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.bnbchain.org/koifarm-office/32/2505_2.png) [@koifarm-office](https://forum.bnbchain.org/u/koifarm-office)
#### Post date: [June 29, 2024, 7:28pm UTC](https://forum.bnbchain.org/t/failed-to-transfer-the-received-bnb-in-proxy-contract-a-to-proxy-contract-b/2882/2 "2024-06-29T19:28:55Z")

</div>

Since new users can only send up to two links, I attach them here.  
I can successfully transfer BNB to the proxy contract B using my wallet. The following is the successful record

> **[BNB Smart Chain Transaction Hash (Txhash) Details | BscScan](https://www.bscscan.com/tx/0xedef869a472b33ec5ba072cf407ef4e172880679386788c1bc520d09cf9c727a)**
>
> Binance (BNB) detailed transaction info for txhash 0xedef869a472b33ec5ba072cf407ef4e172880679386788c1bc520d09cf9c727a. The transaction status, block confirmation, gas fee, Binance, and token transfer are shown.

But when I used proxy contract A to transfer BNB to proxy contract B, it failed. The following is 1 failure record, but most of them failed during gas estimation. I deliberately forced a transaction and it was rolled back.

> **[BNB Smart Chain Transaction Hash (Txhash) Details | BscScan](https://www.bscscan.com/tx/0x659c97f440dd0b22a2220fd8987e5b516e7bd41dbbf9ab5d0247670a605c652e)**
>
> Binance (BNB) detailed transaction info for txhash 0x659c97f440dd0b22a2220fd8987e5b516e7bd41dbbf9ab5d0247670a605c652e. The transaction status, block confirmation, gas fee, Binance, and token transfer are shown.

---

<div class="post-metadata">

### Author: ![koifarm-office](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.bnbchain.org/koifarm-office/32/2505_2.png) [@koifarm-office](https://forum.bnbchain.org/u/koifarm-office)
#### Post date: [June 29, 2024, 8:08pm UTC](https://forum.bnbchain.org/t/failed-to-transfer-the-received-bnb-in-proxy-contract-a-to-proxy-contract-b/2882/4 "2024-06-29T20:08:00Z")

</div>

Already solved  
Change the transfer method to the following

```auto
    function buySlot(address payable toUser) public payable {
        (bool sent, ) = toUser.call{value: msg.value}("");
        require(sent, "Failed to send Ether");
    }

```
