diff --git a/.gitignore b/.gitignore index 59695d0..5719119 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ build .vscode - +.env node_modules diff --git a/contracts/dependencies/cetus/Move.toml b/contracts/dependencies/cetus/Move.toml new file mode 100644 index 0000000..f9efbc0 --- /dev/null +++ b/contracts/dependencies/cetus/Move.toml @@ -0,0 +1,40 @@ +[package] +name = "CetusClmm" +edition = "2024.beta" # edition = "legacy" to use legacy (pre-2024) Move +published-at= "0x70968826ad1b4ba895753f634b0aea68d0672908ca1075a2abdf0fc9e0b2fc6a" +# license = "" # e.g., "MIT", "GPL", "Apache 2.0" +# authors = ["..."] # e.g., ["Joe Smith (joesmith@noemail.com)", "John Snow (johnsnow@noemail.com)"] + +[dependencies] +Sui = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "framework/mainnet" } +MoveStl = { local = "../move-stl" } +IntegerMate = { local = "../integer-mate" } + +# For remote import, use the `{ git = "...", subdir = "...", rev = "..." }`. +# Revision can be a branch, a tag, and a commit hash. +# MyRemotePackage = { git = "https://some.remote/host.git", subdir = "remote/path", rev = "main" } + +# For local dependencies use `local = path`. Path is relative to the package root +# Local = { local = "../path/to" } + +# To resolve a version conflict and force a specific version for dependency +# override use `override = true` +# Override = { local = "../conflicting/version", override = true } + +[addresses] +cetus_clmm = "0x1eabed72c53feb3805120a081dc15963c204dc8d091542592abaf7a35689b2fb" + +# Named addresses will be accessible in Move as `@name`. They're also exported: +# for example, `std = "0x1"` is exported by the Standard Library. +# alice = "0xA11CE" + +[dev-dependencies] +# The dev-dependencies section allows overriding dependencies for `--test` and +# `--dev` modes. You can introduce test-only dependencies here. +# Local = { local = "../path/to/dev-build" } + +[dev-addresses] +# The dev-addresses section allows overwriting named addresses for the `--test` +# and `--dev` modes. +# alice = "0xB0B" + diff --git a/contracts/dependencies/cetus/sources/acl.move b/contracts/dependencies/cetus/sources/acl.move new file mode 100644 index 0000000..9628534 --- /dev/null +++ b/contracts/dependencies/cetus/sources/acl.move @@ -0,0 +1,80 @@ +module cetus_clmm::acl { + use move_stl::linked_table::{LinkedTable}; + + public struct ACL has store { + permissions: LinkedTable
, + } + + public struct Member has copy, drop, store { + address: address, + permission: u128, + } + + public fun new(arg0: &mut TxContext) : ACL { + ACL{permissions: move_stl::linked_table::new(arg0)} + } + + public fun add_role(arg0: &mut ACL, arg1: address, arg2: u8) { + assert!(arg2 < 128, 0); + if (move_stl::linked_table::contains(&arg0.permissions, arg1)) { + let v0 = move_stl::linked_table::borrow_mut(&mut arg0.permissions, arg1); + *v0 = *v0 | 1 << arg2; + } else { + move_stl::linked_table::push_back(&mut arg0.permissions, arg1, 1 << arg2); + }; + } + + public fun get_members(arg0: &ACL) : vector