Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasgrusz committed Jun 1, 2024
2 parents a913c4d + 0a23689 commit 2546063
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
20 changes: 10 additions & 10 deletions packages/hardhat/contracts/Think2Earn.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ interface Think2EarnBountyRegistry {

interface Think2EarnBountyFactoryV1 {
// seller methods
function submitEEGData(uint256 _bountyId, bytes32 _eegDataHash) external returns (uint256 submissionId);
function submitEEGData(uint256 _bountyId, bytes calldata _eegDataHash) external returns (uint256 submissionId);

// buyer methods
function createBounty(
string memory _name,
string memory _description,
string memory mediaURIHash, // Hash of the media URI
string memory mediaURI, // Hash of the media URI
uint256 _duration,
uint256 _judgeTime,
uint256 _maxProgress
Expand Down Expand Up @@ -45,7 +45,7 @@ interface Think2EarnBountyFactoryV1 {
function getVersion() external view returns (uint256);
struct Submission {
address submitter;
bytes32 eegDataHash; // Hash of the EEG data
bytes eegDataHash; // Hash of the EEG data
}
}

Expand All @@ -54,7 +54,7 @@ contract Think2Earn is Think2EarnBountyFactoryV1, ReentrancyGuard {
struct Bounty {
string name;
string description; // IPFS hash or YouTube link
string mediaURIHash; // Hash of the media URI
string mediaURI; // media URI
uint256 reward;
uint256 duration; // in blocks
uint256 judgeTime; // in blocks
Expand All @@ -69,7 +69,7 @@ contract Think2Earn is Think2EarnBountyFactoryV1, ReentrancyGuard {
mapping(uint256 => Bounty) public bounties;
uint256 public bountyCount = 0; // Start counting bounties from 0

event EEGDataSubmitted(uint256 bountyId, uint256 submissionId, address submitter, bytes32 eegDataHash);
event EEGDataSubmitted(uint256 bountyId, uint256 submissionId, address submitter, bytes eegDataHash);
event EtherDeposited(address sender, uint256 amount);
event PaymentMade(uint256 bountyId, uint256 submissionId, uint256 amount);
event BountyCreated(uint256 bountyId, string name, string description, string mediaURI, uint256 reward, uint256 duration, uint256 judgeTime, uint256 maxProgress, address creator);
Expand All @@ -83,8 +83,8 @@ contract Think2Earn is Think2EarnBountyFactoryV1, ReentrancyGuard {
createBounty("Cat", "is nice?", "https://cat.info/", 150, 10, 5);
}

function submitEEGData(uint256 _bountyId, bytes32 _eegDataHash) external returns (uint256 submissionId) {
require(_eegDataHash != 0, "Invalid EEG data hash");
function submitEEGData(uint256 _bountyId, bytes calldata _eegDataHash) external returns (uint256 submissionId) {
require(_eegDataHash.length > 0, "Invalid EEG data hash");

bounties[_bountyId].submissions.push(Submission({
submitter: msg.sender,
Expand All @@ -100,7 +100,7 @@ contract Think2Earn is Think2EarnBountyFactoryV1, ReentrancyGuard {
function createBounty(
string memory _name,
string memory _description,
string memory _mediaURI, // Hash of the media URI
string memory _mediaURI, // media URI
uint256 _duration,
uint256 _judgeTime,
uint256 _maxProgress
Expand All @@ -112,7 +112,7 @@ contract Think2Earn is Think2EarnBountyFactoryV1, ReentrancyGuard {
Bounty storage newBounty = bounties[bountyCount];
newBounty.name = _name;
newBounty.description = _description;
newBounty.mediaURIHash = _mediaURI;
newBounty.mediaURI = _mediaURI;
newBounty.reward = msg.value;
newBounty.duration = _duration;
newBounty.judgeTime = _judgeTime;
Expand Down Expand Up @@ -194,7 +194,7 @@ contract Think2Earn is Think2EarnBountyFactoryV1, ReentrancyGuard {
return (
bounty.name,
bounty.description,
bounty.mediaURIHash,
bounty.mediaURI,
bounty.reward,
bounty.duration,
bounty.judgeTime,
Expand Down
2 changes: 1 addition & 1 deletion packages/subgraph/build/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ type Bounty @entity {
id: ID!
name: String!
description: String!
mediaURIHash: String!
mediaURI: String!
reward: BigInt!
duration: BigInt!
judgeTime: BigInt!
Expand Down
2 changes: 1 addition & 1 deletion packages/subgraph/src/mapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export function handleBountyCreated(event: BountyCreated): void {
let bounty = new Bounty(event.params.bountyId.toString());
bounty.name = event.params.name;
bounty.description = event.params.description;
bounty.mediaURIHash = event.params.mediaURI;
bounty.mediaURI = event.params.mediaURI;
bounty.reward = event.params.reward;
bounty.duration = event.params.duration;
bounty.judgeTime = event.params.judgeTime;
Expand Down
2 changes: 1 addition & 1 deletion packages/subgraph/src/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ type Bounty @entity {
id: ID!
name: String!
description: String!
mediaURIHash: String!
mediaURI: String!
reward: BigInt!
duration: BigInt!
judgeTime: BigInt!
Expand Down
2 changes: 1 addition & 1 deletion packages/subgraph/subgraph.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ dataSources:
eventHandlers:
- event: BountyCreated(uint256,string,string,string,uint256,uint256,uint256,uint256,address)
handler: handleBountyCreated
- event: EEGDataSubmitted(uint256,uint256,address,bytes32)
- event: EEGDataSubmitted(uint256,uint256,address,bytes)
handler: handleEEGDataSubmitted
- event: BountyCompleted(uint256,uint256)
handler: handleBountyCompleted
Expand Down

0 comments on commit 2546063

Please sign in to comment.