-
Notifications
You must be signed in to change notification settings - Fork 76
/
RecoveryFactory.sol
29 lines (22 loc) · 969 Bytes
/
RecoveryFactory.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
import '../BaseLevel.sol';
import './Recovery.sol';
contract RecoveryFactory is Level {
mapping (address => address) lostAddress;
function createInstance(address _player) override public payable returns (address) {
Recovery recoveryInstance;
recoveryInstance = new Recovery();
// create a simple token
recoveryInstance.generateToken("InitialToken", uint(100000));
// the lost address
lostAddress[address(recoveryInstance)] = address(uint160(uint256(keccak256(abi.encodePacked(uint8(0xd6), uint8(0x94), recoveryInstance, uint8(0x01))))));
// Send it some ether
(bool result,) = lostAddress[address(recoveryInstance)].call{value:0.001 ether}("");
require(result);
return address(recoveryInstance);
}
function validateInstance(address payable _instance, address) override public returns (bool) {
return address(lostAddress[_instance]).balance == 0;
}
}