mirror of
https://github.com/selfxyz/self.git
synced 2026-01-23 13:38:04 -05:00
Merge pull request #5 from yssf-io/safe
added passport recovery safe module
This commit is contained in:
32
contracts/contracts/PassportRecoverySafeModule.sol
Normal file
32
contracts/contracts/PassportRecoverySafeModule.sol
Normal file
@@ -0,0 +1,32 @@
|
||||
pragma solidity ^0.8.13;
|
||||
|
||||
import "zodiac/core/Module.sol";
|
||||
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
|
||||
|
||||
contract PassportRecoverySafeModule is Module {
|
||||
ERC721Enumerable public passportSBT;
|
||||
uint256 public id;
|
||||
|
||||
error NotAuthorized();
|
||||
|
||||
constructor() {
|
||||
_transferOwnership(msg.sender);
|
||||
}
|
||||
|
||||
function setUp(bytes memory initializeParams) public override {}
|
||||
|
||||
function init(address safe, address _passportSBT, uint256 _id) public {
|
||||
setAvatar(safe);
|
||||
setTarget(safe);
|
||||
passportSBT = _passportSBT;
|
||||
id = _id;
|
||||
}
|
||||
|
||||
function claimSafe(bytes memory data) public {
|
||||
if (passportSBT.ownerOf(id) == msg.sender) {
|
||||
exec(avatar, 0, data, Enum.Operation.Call);
|
||||
} else {
|
||||
revert NotAuthorized();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user