Skip to content

feat: receptor #600

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

Merged
merged 17 commits into from
Oct 3, 2024
Merged

feat: receptor #600

merged 17 commits into from
Oct 3, 2024

Conversation

tserg
Copy link
Collaborator

@tserg tserg commented Oct 1, 2024

This PR adds the Receptor (open to suggestions for names) module that submits yin's price to Shrine for the Controller to actuate on.

The yin price is taken as the median of CASH-{DAI, USDC, USDT} pairs from Ekubo's oracle extension, based on a TWAP duration that can be adjusted by admin. The quote tokens can also be adjusted if desired in the future e.g. swapping one of them out for LUSD. I considered taking the median of an arbitrary number of quotes, but that would make the contract unnecessary complex e.g. implementing a heap to sort any number of quotes.

Additionally, the Receptor module also implements the ITask interface to streamline its interaction by keepers. Therefore, the primary method of updating yin's price is via ITask.execute_task(). Nevertheless, there is also a update_yin_price that is restricted by access control that allows the update frequency of the task to be bypassed, similar to seer.update_prices() and seer.execute_task(). At the moment, this is not necessary, but it gives some flexibility for the future in case the yin's price needs to be updated in some user flow.

Initially, I wanted to include the Sepolia and mainnet scripts in this PR, but I think they can be taken up separately while UX design is ongoing.

@tserg tserg requested a review from milancermak October 1, 2024 03:19
Copy link
Contributor

@milancermak milancermak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to see some cool Cairo code again :)

Left some ideas on how to slightly improve the implementation, but overall looks good.

I'm not a huge fan of the name, but also don't have a better suggestion 😬 No point on dwelling on it 🚢

@tserg
Copy link
Collaborator Author

tserg commented Oct 2, 2024

I'm not a huge fan of the name, but also don't have a better suggestion 😬 No point on dwelling on it 🚢

A few other (already filtered) suggestions from Claude:

  • Sensor
  • Augur
  • Diviner

Copy link
Contributor

@milancermak milancermak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heh, I also used Claude to suggest names. I was going for some terminology to steer or guide stuff (boats, trains), trying to convey the fact that the module "just moves stuff around" - it came up with things like Helmsman, Raftsman, Hoghead, Hauler, Conductor, Signalman 😆

Suddenly, Receptor sounds pretty good 😇

Copy link
Contributor

@milancermak milancermak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tserg tserg merged commit a91d145 into main Oct 3, 2024
1 check passed
@tserg tserg deleted the feat/yin_oracle branch October 3, 2024 05:01
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

Successfully merging this pull request may close these issues.

2 participants