Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Finalize poster schema #8

Open
dekanbro opened this issue Apr 19, 2023 · 2 comments
Open

Finalize poster schema #8

dekanbro opened this issue Apr 19, 2023 · 2 comments

Comments

@dekanbro
Copy link
Collaborator

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

@dekanbro
Copy link
Collaborator Author

dekanbro commented May 2, 2023

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> <msg.sender>

@bitbeckers
Copy link
Collaborator

bitbeckers commented May 23, 2023

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

  • Set UID on contract init (string)
  • Emit UID during summon event
  • Add UID to GiveCookie event
  • Render tags on init/summon
  • Method for CookieID

@bitbeckers bitbeckers transferred this issue from bitbeckers/moloch-safe-modules Jun 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants