Skip to content

Commit

Permalink
Add Facet (full) (l2beat#6256)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucadonnoh authored Jan 3, 2025
1 parent dcd263a commit 78e4b72
Show file tree
Hide file tree
Showing 28 changed files with 15,643 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// SPDX-License-Identifier: Unknown
pragma solidity 0.8.18;

contract EthscriptionsSafeModule {
address public constant ethscriptionsProxyAddress = 0xeEd444Fc821b866b002f30f502C53e88E15d5095;

function createEthscription(address to, string calldata dataURI) external {
require(
GnosisSafe(msg.sender).execTransactionFromModule(
ethscriptionsProxyAddress,
0,
abi.encodeWithSignature(
"createEthscription(address,string)",
to,
dataURI
),
Enum.Operation.DelegateCall
),
"execTransactionFromModule failed"
);
}

function transferEthscription(address to, bytes32 ethscriptionId) external {
require(
GnosisSafe(msg.sender).execTransactionFromModule(
ethscriptionsProxyAddress,
0,
abi.encodeWithSignature(
"transferEthscription(address,bytes32)",
to,
ethscriptionId
),
Enum.Operation.DelegateCall
),
"execTransactionFromModule failed"
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"$schema": "../../../../../discovery/schemas/contract.v2.schema.json",
"displayName": "EthscriptionsSafeModule",
"description": "Module that allows the Safe to interact with Ethscriptions."
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// SPDX-License-Identifier: Unknown
pragma solidity 0.8.18;

contract EthscriptionsSafeProxy {
address internal immutable deployedAddress;

event ethscriptions_protocol_CreateEthscription(
address indexed initialOwner,
string contentURI
);

event ethscriptions_protocol_TransferEthscription(
address indexed recipient,
bytes32 indexed ethscriptionId
);

constructor() {
deployedAddress = address(this);
}

function createEthscription(address to, string calldata dataURI) external {
require(deployedAddress != address(this), "Only Delegate Call");
emit ethscriptions_protocol_CreateEthscription(to, dataURI);
}

function transferEthscription(address to, bytes32 ethscriptionId) external {
require(deployedAddress != address(this), "Only Delegate Call");
emit ethscriptions_protocol_TransferEthscription(to, ethscriptionId);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"$schema": "../../../../../discovery/schemas/contract.v2.schema.json",
"displayName": "EthscriptionsSafeProxy",
"description": "Helper of the Safe Module that allows to send Ethscriptions transactions."
}
Loading

0 comments on commit 78e4b72

Please sign in to comment.