DA0-DA0 / polytone

An account on every blockchain for every smart contract.
42 stars 5 forks source link

Add listener contract to listen to voice callbacks #44

Closed NoahSaso closed 1 year ago

NoahSaso commented 1 year ago

This creates a listener contract that expects callbacks from the note contract on ack'd messages.

It is currently set up to be paired with exactly one note. This is nice because we can easily restrict it to exactly one note with authorization. The alternative is to maintain an allowlist of contracts that can submit callbacks and index by (note, initiator, initiator_msg).

Maintaining an allowlist sounds annoying, and as we will be continuously adding more notes, I prefer the solution of instantiating a note and listener pair over using one giga-listener.

Instantiate

It requires one field, the note contract address that can register callbacks, which is immutable.

Execute

It supports one message, which accepts the callback from a note contract and stores it in a Map, indexed by (initiator, initiator_msg).

Query

It supports two queries. One returns the note contract authorized to execute its callback message. The other allows querying for a callback given an initiator and initiator_msg.

0xekez commented 1 year ago

it occurs to me that a more descriptive name might be listener

NoahSaso commented 1 year ago

it occurs to me that a more descriptive name might be listener

hehe i'm down for whatever you think fits the aesthetic

i feel like ear is equally as descriptive as note and voice (as opposed to sender, executor, and listener for example), but i will not die on this hill

0xekez commented 1 year ago

i just feel like the vibes of ear are more 🥩 while the vibes of note, voice, proxy are 🌌

0xekez commented 1 year ago

i, also, will not die on this hill 😂

NoahSaso commented 1 year ago

i just feel like the vibes of ear are more 🥩 while the vibes of note, voice, proxy are 🌌

fantastic. this is true

ear is to listener as mouth is to voice. listener is goooooooood with me 🌌👌