olas-protocol / citation-poc

A POC to showcase how Olas Citation System could work with EAS (Ethereum Attestation Service)
2 stars 0 forks source link

Smart Contract Changes for Citation V2 POC #7

Open KohliSuraj opened 6 months ago

KohliSuraj commented 6 months ago

In order to support a UI for https://github.com/olas-protocol/Project-Planning/issues/22 we need to make modifications to existing citation smart contracts.

What all do we need?

User Profile
    - user_address
    - user_email
    - user_image_url
    - primary_speciality_tags
    - secondary_speciality_tags
    - article_published_list
    - article_review_list
    - joined_timestamp_event

TODO: we are not storing AA smart contract address in this, will add later

Article Table
    - uid
    - title
    - author_address
    - slug
    - body_content
    - media_content
    - tips_received
    - funds_raised
    - stake_amount
    - royalty_amount
    - citations_received_list
    - market_type [news&opinion, IJ&S]
    - status [draft, review, published]
    - published_timestamp_event

Technical Details

Currently, we are using EAS contracts (EAS.sol, SchemaRegistry.sol), AuthorStake.sol contract and our custom resolver (RoyaltyResolver.sol) to store attestation details for Olas Citations.

We need to extend these contracts to store additional data as specified above. Let's go through those changes.

OlasHub.sol Main Olas contract - This is what glues together Olas users with off-chain storage along with data stored in EAS.

Olas Hub will contain a mapping to store User Profile details. mapping(address => Profile) public userProfiles;

EAS Contracts Note: An article on Olas is nothing but an attestation by the User on EAS.

We can use user address from OlasHub contract and Olas schema UID to search for Attested events from EAS contracts. This would give us a list of attestations (i.e. articles) published by Olas.

Better would be to have another mapping in OlasHub to store attestation uids (i.e. articles) mapping(address => bytes32[]) public articlesUid;

Search for all articles on Olas For this we can either search for all attestations on EAS with attester address and Olas schemaUID. We can get list of all registered users on Olas from a centralized DB or by listening to the profileCreatedEvent

KohliSuraj commented 6 months ago

Tasks