-
Notifications
You must be signed in to change notification settings - Fork 0
Add AMMConfig module with create/view scripts #61
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
Changes from all commits
92551a6
c34bc00
79527c3
24eff3f
27e89c1
730c737
a3b531e
3ed1fdf
8d75c8a
b528d53
a2ca3c3
29a59e1
c3752ad
109fdab
f537d55
bcd4265
5468490
d7ef4ac
3de7292
ee1bbad
cb2b3ac
57a737d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| pnpm dapp format:move | ||
| pnpm lint:fix | ||
| node scripts/strip-move-localnet.js --staged |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| # Generated by move; do not edit | ||
| # This file should be checked in. | ||
|
|
||
| [move] | ||
| version = 4 | ||
|
|
||
| [pinned.test-publish.MoveStdlib] | ||
| source = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/move-stdlib", rev = "22f9fc9781732d651e18384c9a8eb1dabddf73a6" } | ||
| use_environment = "test-publish" | ||
| manifest_digest = "C4FE4C91DE74CBF223B2E380AE40F592177D21870DC2D7EB6227D2D694E05363" | ||
| deps = {} | ||
|
|
||
| [pinned.test-publish.PropAmm] | ||
| source = { root = true } | ||
| use_environment = "test-publish" | ||
| manifest_digest = "C66389234060080B839236B8BDEF322DBBFD4F55C944FBDC236E812F170025F0" | ||
| deps = { deepbook = "deepbook", pyth = "Pyth", std = "MoveStdlib", sui = "Sui" } | ||
|
|
||
| [pinned.test-publish.Pyth] | ||
| source = { local = "../pyth-mock" } | ||
| use_environment = "test-publish" | ||
| manifest_digest = "2963D6B4689ED068546E86F8453FBCA51DCDF68A1C96D681328D2CDACE14B5CF" | ||
| deps = { std = "MoveStdlib", sui = "Sui" } | ||
|
|
||
| [pinned.test-publish.Sui] | ||
| source = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "22f9fc9781732d651e18384c9a8eb1dabddf73a6" } | ||
| use_environment = "test-publish" | ||
| manifest_digest = "7B6E5525FC0BFAECA61725298C425266BB21D456122669E3B2D3A4151A705F69" | ||
| deps = { MoveStdlib = "MoveStdlib" } | ||
|
|
||
| [pinned.test-publish.deepbook] | ||
| source = { git = "https://github.com/MystenLabs/deepbookv3.git", subdir = "packages/deepbook", rev = "4c2f8e22d54e40da9b44e297656ee1d4528612b2" } | ||
| use_environment = "test-publish" | ||
| manifest_digest = "4CE7EBF2D294B2073FAC96555A5584741C6DEAA89256AA4FD4FED535D3C79C54" | ||
| deps = { std = "MoveStdlib", sui = "Sui", token = "token" } | ||
|
|
||
| [pinned.test-publish.token] | ||
| source = { git = "https://github.com/MystenLabs/deepbookv3.git", subdir = "packages/token", rev = "4c2f8e22d54e40da9b44e297656ee1d4528612b2" } | ||
| use_environment = "test-publish" | ||
| manifest_digest = "2963D6B4689ED068546E86F8453FBCA51DCDF68A1C96D681328D2CDACE14B5CF" | ||
| deps = { std = "MoveStdlib", sui = "Sui" } | ||
|
|
||
| [pinned.testnet.MoveStdlib] | ||
| source = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/move-stdlib", rev = "563c15820b27dec9cbe75f826a3b6243ef44da1a" } | ||
| use_environment = "testnet" | ||
| manifest_digest = "C4FE4C91DE74CBF223B2E380AE40F592177D21870DC2D7EB6227D2D694E05363" | ||
| deps = {} | ||
|
|
||
| [pinned.testnet.PropAmm] | ||
| source = { root = true } | ||
| use_environment = "testnet" | ||
| manifest_digest = "EF55A39C03806D44F7224057AF3F6B7DC7E067950C63BB52702F3BF5557FC743" | ||
| deps = { deepbook = "deepbook", std = "MoveStdlib", sui = "Sui" } | ||
|
|
||
| [pinned.testnet.Sui] | ||
| source = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "563c15820b27dec9cbe75f826a3b6243ef44da1a" } | ||
| use_environment = "testnet" | ||
| manifest_digest = "7AFB66695545775FBFBB2D3078ADFD084244D5002392E837FDE21D9EA1C6D01C" | ||
| deps = { MoveStdlib = "MoveStdlib" } | ||
|
|
||
| [pinned.testnet.deepbook] | ||
| source = { git = "https://github.com/MystenLabs/deepbookv3.git", subdir = "packages/deepbook", rev = "4c2f8e22d54e40da9b44e297656ee1d4528612b2" } | ||
| use_environment = "testnet" | ||
| manifest_digest = "3101923B9428545A4F52FFAD1C4F959F9BFFF84CD09CE4BCC1CB831286999B5A" | ||
| deps = { std = "MoveStdlib", sui = "Sui", token = "token" } | ||
|
|
||
| [pinned.testnet.token] | ||
| source = { git = "https://github.com/MystenLabs/deepbookv3.git", subdir = "packages/token", rev = "4c2f8e22d54e40da9b44e297656ee1d4528612b2" } | ||
| use_environment = "testnet" | ||
| manifest_digest = "5745706258F61D6CE210904B3E6AE87A73CE9D31A6F93BE4718C442529332A87" | ||
| deps = { std = "MoveStdlib", sui = "Sui" } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| [package] | ||
| name = "amm" | ||
| edition = "2024" | ||
| version = "0.0.1" | ||
|
|
||
| [dependencies] | ||
| deepbook = { git = "https://github.com/MystenLabs/deepbookv3.git", subdir = "packages/deepbook", rev = "main" } | ||
|
Comment on lines
+6
to
+7
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Confirm whether this package still relies on a floating git ref and whether a lock file is the only immutable pin.
rg -n --glob 'Move.toml' 'deepbook.*rev\s*=\s*"main"'
fd '^Move\.lock(\.pinned)?$' packages/dapp/contracts -x sed -n '1,120p' {}Repository: OpenZeppelin/openzeppelin-sui-amm Length of output: 3712 Pin Line 7 uses 🤖 Prompt for AI Agents
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's better to pin specific commit/version instead of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
|
||
| [dep-replacements.test-publish] | ||
| pyth = { local = "../pyth-mock", rename-from = "Pyth", override = true } | ||
|
|
||
| [environments] | ||
| test-publish = "8051a268" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| # Prop AMM Move Package | ||
|
|
||
| This package contains the Prop AMM Move modules for configuration and execution. | ||
| It is experimental and unaudited. | ||
|
|
||
| ## Purpose | ||
|
|
||
| - Define shared configuration for the AMM. | ||
| - Provide admin-gated updates and related events. | ||
| - Define execution-time state and events for trading. | ||
|
|
||
| ## Usage | ||
|
|
||
| - Publish the package to initialize the admin capability. | ||
| - Call `create_amm_config_and_share` to create shared config and emit the creation event. | ||
| - Call `update_amm_config_and_emit` with an `AMMAdminCap` to change settings and emit the update event. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| /// Execution-time state and events for the AMM. | ||
| module amm::executor; | ||
|
|
||
| use sui::table::Table; | ||
|
|
||
| // === Structs === | ||
|
|
||
| /// Per-trader account state. | ||
| /// | ||
| /// Uses a table to map each pool ID to the trader's active order IDs. | ||
| public struct TraderAccount has key { | ||
| /// Unique ID for the account object. | ||
| id: UID, | ||
| /// Account owner. | ||
| owner: address, | ||
| /// Active order IDs keyed by pool ID (table entries are stored on-chain). | ||
| active_orders: Table<ID, vector<ID>>, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it the best possible way for organising storage for order/pool ids?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is fine if we don't have that many ID's in vector. But would like to see how is it used
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should be fine if |
||
| } | ||
|
|
||
| // === Events === | ||
|
|
||
| /// Emitted when a quote is updated. | ||
| public struct QuoteUpdatedEvent has copy, drop { | ||
| /// Pool identifier. | ||
| pool_id: ID, | ||
| /// Quote price. | ||
| price: u64, | ||
| /// Spread in basis points. | ||
| spread_bps: u64, | ||
| /// Quote timestamp in milliseconds. | ||
| timestamp_ms: u64, | ||
| } | ||
|
|
||
| /// Emitted when an order is executed. | ||
| public struct OrderExecutedEvent has copy, drop { | ||
| /// Order identifier. | ||
| order_id: ID, | ||
| /// Execution price. | ||
| fill_price: u64, | ||
| } | ||
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.
Name & version to be properly set.