-
Notifications
You must be signed in to change notification settings - Fork 19
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
[ECO-2618] Finalize emojicoin arena core logic design #478
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Look mostly good 👍
Just a couple of DX changes.
/// Based on proceeds when exiting, otherwise based on holdings in escrow. | ||
struct ProfitAndLoss has copy, drop, store { | ||
/// Emojicoins effective value, converted to octas at current exchange rate. | ||
octas_value: u128, | ||
/// Unrealized gain if `octas_value` is greater than `Escrow.octas_entered`. | ||
octas_gain: u128, | ||
/// Unrealized loss if `octas_value` is less than `Escrow.octas_entered`. | ||
octas_loss: u128, | ||
/// Ratio of `octas_value` to `Escrow.octas_entered`, as a Q64. | ||
octas_growth_q64: u128 | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we have octas_initial_value
(octas value at time of enter) and octas_current_value
(currently octas_value
) ?
This would mean that octas_{gain,loss,growth_q64}
).
I think it will also be useful to have the initial amount in the frontend.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since users can enter multiple times, the initial_value
descriptor isn't totally accurate, however I do understand the rationale for using a difference here and for including the reference value octas_entered
for the frontend
Mainly the octas_gain
field is because that is used for determining the top gains in top_exits
fields
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@CRBl69 per the recent lightweight data model we discussed, this can all be done offchain. Note that I even added an example in the new README about indexing PnL and how all the information is there
Description
This PR finalizes the Emojicoin Arena Move prototype, adding a README with a
comprehensive design overview.
Per extensive review, it adopts a lightweight data model that provides only the
minimal amount of information to required to enable comprehensive indexing,
as discussed in detail in the README.
Logic updates
SmartTable
structs since they can be a DoS vector.escrow, they must select lock in on subsequent top-off operations.
prevent unexpected abortions.
queries against both markets and thus inhibit parallelism within a melee
in the general case.
Test code
init_module
happy path tests.init_module
happy path tests for assorted pseudo-random seeds.Housekeeping
active
instead ofcurrent
to indicate a melee that hasn't ended.Escrow
" instead of"escrow".
removed.
movefmt
Testing
From in
src/move/emojicoin_arena
:Checklist