-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDevouchAttester.sol
79 lines (64 loc) · 2.51 KB
/
DevouchAttester.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0 <0.9.0;
import { IEAS, AttestationRequest, AttestationRequestData, RevocationRequest, RevocationRequestData } from "eas-contracts/contracts/IEAS.sol";
import { NO_EXPIRATION_TIME, EMPTY_UID } from "eas-contracts/contracts/Common.sol";
contract DevouchAttester
{
event Log(string func, uint256 gas);
address public owner;
uint256 public fee = 0.00003 ether;
address multisig = 0x7D52A0Ab02A6A49a1B4b7c4e79C80F977971f700;
bytes32 schema = 0x421da38e6ff5eb5d0402a4e9be70e70f961bce228e8a20d1eca19634556247fd;
/**
* @dev Set contract deployer as owner
*/
constructor() {
owner = msg.sender; // 'msg.sender' is sender of current call, contract deployer for a constructor
}
modifier ownerOnly() {
require(msg.sender == owner, "Only owner can access this function");
_;
}
function updateOwner(address newOwner) public ownerOnly {
owner = newOwner;
emit Log("updateOwner", gasleft());
}
function updateFee(uint256 newFee) public ownerOnly {
fee = newFee;
emit Log("updateFee", gasleft());
}
function updateSchema(bytes32 newSchema) public ownerOnly{
schema = newSchema;
emit Log("updateSchema", gasleft());
}
function attest(address recipient, bytes32 refUID, bytes calldata data) public payable
{
require(address(msg.sender).balance >= fee, "Insufficient balance to pay fee");
require(msg.value == fee, "Must pay the fee amount");
IEAS(0xC2679fBD37d54388Ce493F1DB75320D236e1815e).attest(
AttestationRequest({
schema: schema,
data: AttestationRequestData({
recipient: recipient,
expirationTime: NO_EXPIRATION_TIME,
revocable: true,
refUID: refUID,
data: data,
value:0
})
})
);
emit Log("attested", gasleft());
}
receive() external payable {}
fallback() external payable {
emit Log("fallback", gasleft());
}
// Function to withdraw Ether from the contract (for testing purposes)
function withdraw() public {
// Transfer the Ether to the multisig address
(bool success, ) = multisig.call{value: address(this).balance}("");
require(success, "Failed to send Ether");
emit Log("withdraw", gasleft());
}
}