# 使用Flashbot转移合约的所有权

By [Ericet](https://paragraph.com/@ericet) · 2022-08-01

---

今天有个网友联系到我，说他的钱包的私钥泄露了，按照我之前写的文章[挽救被黑钱包里面的剩余资产](https://mirror.xyz/ericet.eth/Y8VV08jOOFOZY8Z0N--mhrM0ubzTZistxyCjuvExgoo), 顺利把钱包里面的ENS, NFT, 和一些ERC20代币转移到新的钱包

但是那个私钥泄露的钱包创建过一些合约，合约的所有权没有办法转移，所以想让我帮他写个方法把合约的所有权转移到新的地址

看了一下合约，方法不难，就是用ERC20的方式写转移合约所有权的方法

更新了代码，现在支持用Flashbot转移合约的所有权: [https://github.com/ericet/ens-claim-flashbot-example](https://github.com/ericet/ens-claim-flashbot-example)

要使用转移合约的所有权，只需把合约里面的这段代码uncomment掉

![1d8e6d98b2e260656be25d06013a198.png](https://storage.googleapis.com/papyrus_images/1349b6bf5dc0a87f3fa0fb9e84537a31dfe27306424469f5837e877aeaf112c5.png)

1d8e6d98b2e260656be25d06013a198.png

然后tokenAddress改成合约的地址就行了

![image.png](https://storage.googleapis.com/papyrus_images/cd7e1b28cdf8a4cea6f63a41b11710f757f03132ee38de36d2c5ef156325c80f.png)

image.png

---

*Originally published on [Ericet](https://paragraph.com/@ericet/flashbot)*
