From ff37d50d72234d24facb57e421ddeaacb6f17f26 Mon Sep 17 00:00:00 2001 From: kikakkz Date: Tue, 28 Mar 2023 21:39:10 +0800 Subject: [PATCH] Support escape from smart contract to normal address --- contracts/v0.1/OwnerActor.sol | 4 ++-- contracts/v0.1/miner/Miner.sol | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/contracts/v0.1/OwnerActor.sol b/contracts/v0.1/OwnerActor.sol index f7c95ad..f99e778 100644 --- a/contracts/v0.1/OwnerActor.sol +++ b/contracts/v0.1/OwnerActor.sol @@ -67,9 +67,9 @@ contract OwnerActor is Controllable { _miner.exist = true; } - function escapeMiner(address newOwner) public onlyController { + function escapeMiner(uint64 newOwner) public onlyController { require(_miner.exist, "Owner: there is no miner custodied"); - require(newOwner != address(0), "Owner: new owner must set for the miner"); + require(newOwner > 0, "Owner: new owner must set for the miner"); Miner.escape(_miner, newOwner); } diff --git a/contracts/v0.1/miner/Miner.sol b/contracts/v0.1/miner/Miner.sol index e4d1f90..b15a683 100644 --- a/contracts/v0.1/miner/Miner.sol +++ b/contracts/v0.1/miner/Miner.sol @@ -119,9 +119,9 @@ library Miner { MinerAPI.changeOwnerAddress(actorId, ret1.proposed); } - function escape(_Miner storage miner, address newOwner) public { + function escape(_Miner storage miner, uint64 newOwner) public { CommonTypes.FilActorId actorId = CommonTypes.FilActorId.wrap(miner.minerId); - CommonTypes.FilAddress memory addr = FilAddresses.fromEthAddress(newOwner); + CommonTypes.FilAddress memory addr = FilAddresses.fromActorID(newOwner); MinerAPI.changeOwnerAddress(actorId, addr); }