Cookie-Jar-DAO / cookiejar-contracts

Contract for the CookieJar protocol
https://cookiejar-contracts.vercel.app
MIT License
3 stars 1 forks source link

Finalize poster schema #8

Open dekanbro opened 1 year ago

dekanbro commented 1 year ago

add a way to do reactions by people on allow list (like thumbs up and thumbs down)

dekanbro commented 1 year ago

schema

{
controller: string;
target: string;
type: string;
description: string;
link: string;
}

space deliminator

reason: tag: CookieJar <_uid> content:

reaction tag: CookieJar.reaction content: <_uid> <DOWN/UP>

bitbeckers commented 1 year ago

Model

Summon cookie jar

emits:

SummonCookieJar(address(_cookieJar), details, _initializer, uid);

uid:

string uid = bytes32ToString(keccak256(abi.encodePacked(address(cookieJar), chainId)));

String because otherwise it needs to be parsed for every concat

details:

{
  "type":"Baal",
  "name":"Moloch Pastries",
  "description":"This is where you add some more content",
  "link":"app.daohaus.club/0x64/0x0....666"
}

Reach in Jar

emits:

    GiveCookie(cookieMonster, amount, fee, cookieUid);
    IPoster(POSTER_ADDR).post(_reason, tag));

Can infer jarID from event.address and chainId

uid:

string cookieUid = bytes32ToString(keccak256(abi.encodePacked(address(cookieJar), cookieMonster, _reason)));

tag:

        string memory reasonTag = string.concat(POSTER_TAG, ".reason");
        tag = string.concat(reasonTag, ".reason.", cookieUid))`

POSTER_TAG: CookieJar

AssessReason

emits:

if (_isGood) {
    IPoster(POSTER_ADDR).post(string.concat(_uid, " UP ", senderString), tag);
} else {
    IPoster(POSTER_ADDR).post(string.concat(_uid, " DOWN ", senderString), tag);
}

uid: cookieUid provided in call data

senderString:

        string memory senderString = Strings.toHexString(uint256(uint160(msg.sender)), 20);

tag:

        string memory reactionTag = string.concat(POSTER_TAG, ".reaction.", _uid);
        tag = string.concat(reactionTag))`

We could render the tags on init to save gas for future txs

TODO