-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from ThomasJ0nes/listing-connection-attester-co…
…ntract add ListingConnectionAttester contract and createListingConnection func
- Loading branch information
Showing
5 changed files
with
278 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity >=0.8.0 <0.9.0; | ||
|
||
import { IEAS, AttestationRequest, AttestationRequestData } from "@ethereum-attestation-service/eas-contracts/contracts/IEAS.sol"; | ||
import { NO_EXPIRATION_TIME, EMPTY_UID } from "@ethereum-attestation-service/eas-contracts/contracts/Common.sol"; | ||
|
||
contract ListingConnectionAttester { | ||
IEAS public immutable _eas; | ||
bytes32 public immutable _listingConnectionSchemaUID; | ||
|
||
error InvalidEAS(); | ||
|
||
constructor(IEAS eas, bytes32 listingConnectionSchemaUID) { | ||
if (address(eas) == address(0)) { | ||
revert InvalidEAS(); | ||
} | ||
|
||
_eas = eas; | ||
_listingConnectionSchemaUID = listingConnectionSchemaUID; | ||
} | ||
|
||
function attestListingConnection( | ||
uint256 listingConnectionId, | ||
address seller, | ||
address buyer | ||
) external returns (bytes32 attestationUID) { | ||
// return | ||
// _eas.attest( | ||
// AttestationRequest({ | ||
// schema: _listingConnectionSchemaUID, | ||
// data: AttestationRequestData({ | ||
// recipient: seller, | ||
// expirationTime: NO_EXPIRATION_TIME, // No expiration time | ||
// revocable: true, | ||
// refUID: EMPTY_UID, // No references UI | ||
// data: abi.encode(listingConnectionId, seller, buyer), | ||
// value: 0 // No value/ETH | ||
// }) | ||
// }) | ||
// ); | ||
return | ||
0x0d455486a3dadeacfba5f340fe5bf84d1f6678b2e2af53536acc8a4274626f82; // Return sample value for local testing | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
packages/hardhat/deploy/01_deploy_listing_connection_attester.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { HardhatRuntimeEnvironment } from "hardhat/types"; | ||
import { DeployFunction } from "hardhat-deploy/types"; | ||
|
||
const deployListingConnectionAttester: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { | ||
const { deployer } = await hre.getNamedAccounts(); | ||
const { deploy } = hre.deployments; | ||
|
||
await deploy("ListingConnectionAttester", { | ||
from: deployer, | ||
args: [ | ||
"0x4200000000000000000000000000000000000021", | ||
"0xa844aad897e631c5200bc2a0f5c093eeb3e96baa4f8428d93dbcb76e775906a9", // Sample SchemaUID | ||
], | ||
log: true, | ||
autoMine: true, | ||
}); | ||
}; | ||
|
||
export default deployListingConnectionAttester; | ||
|
||
deployListingConnectionAttester.tags = ["ListingConnectionAttester"]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters