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

By [weigr](https://paragraph.com/@hiweigr) · 2022-08-06

---

今天有个网友联系到我，说他的钱包的私钥泄露了，按照我之前写的文章[挽救被黑钱包里面的剩余资产](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掉

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

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

![](https://storage.googleapis.com/papyrus_images/2beba9645f24295ee5d7675cee6fb0c060228776546bd436fd04cf11af47ad77.png)

转自[ericet.eth](https://mirror.xyz/ericet.eth)

---

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