Skip to content
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-1562] Begin preliminary struct architecture #6

Merged
merged 6 commits into from
Apr 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions cfg/cspell-dictionary.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,41 @@
aland
aptos
barthelemy
bento
bouvet
burkina
caicos
clipperton
cunha
dango
diya
econia
emojicoin
eswatini
faso
fleur
futuna
hamsa
ivoire
keycap
khanda
kitts
leste
maarten
marino
mayen
melilla
merperson
moai
nazar
oden
precommit
rica
sint
struct
subdir
supervillain
tanabata
tokelau
turkiye
xbtmatt
6 changes: 3 additions & 3 deletions src/move/Move.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
[addresses]
emoji = "_"
emojicoin_dot_fun = "_"

[dependencies.AptosFramework]
git = "https://github.com/aptos-labs/aptos-core.git"
rev = "mainnet"
subdir = "aptos-move/framework/aptos-framework"

[dev-addresses]
emoji = "0xc0de"
emojicoin_dot_fun = "0xc0de"

[package]
authors = ["Econia Labs ([email protected])"]
name = "Move Emojis"
name = "EmojicoinDotFun"
upgrade_policy = "immutable"
version = "1.0.0"
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// cspell:disable
module emoji::main {
module emojicoin_dot_fun::emojicoin_dot_fun {

use aptos_std::smart_table::{Self, SmartTable};
use aptos_framework::object::{Self, ExtendRef, ObjectGroup};

const ABACUS: vector<u8> = x"f09fa7ae";
const AB_BUTTON_BLOOD_TYPE: vector<u8> = x"f09f868e";
Expand Down Expand Up @@ -2437,8 +2439,52 @@ module emoji::main {
const ZOMBIE: vector<u8> = x"f09fa79f";
const ZZZ: vector<u8> = x"f09f92a4";

fun init_module(_: &signer) {
#[resource_group = ObjectGroup]
struct Market has key {
market_id: address,
market_address: address,
emoji_bytes: vector<u8>,
extend_ref: ExtendRef,
}

#[resource_group = ObjectGroup]
struct Registry has key {
registry_address: address,
supported_emojis: SmartTable<vector<u8>, u8>,
markets_by_emoji_bytes: SmartTable<vector<u8>, address>,
markets_by_market_id: SmartTable<u64, address>,
xbtmatt marked this conversation as resolved.
Show resolved Hide resolved
extend_ref: ExtendRef,
}

struct RegistryAddress has key {
registry_address: address,
}

fun init_module(emojicoin_dot_fun: &signer) {
let constructor_ref = object::create_object(@emojicoin_dot_fun);
let extend_ref = object::generate_extend_ref(&constructor_ref);
let registry_signer = object::generate_signer(&constructor_ref);
let registry_address = object::address_from_constructor_ref(&constructor_ref);
move_to(emojicoin_dot_fun, RegistryAddress { registry_address });
let registry = Registry {
registry_address,
supported_emojis: smart_table::new(),
markets_by_emoji_bytes: smart_table::new(),
markets_by_market_id: smart_table::new(),
extend_ref,
};
smart_table::add_all(
&mut registry.supported_emojis,
vector[
ABACUS,
AB_BUTTON_BLOOD_TYPE,
],
vector[
0,
0,
],
);
move_to(&registry_signer, registry);
}

}
4 changes: 3 additions & 1 deletion src/python/move_emojis/emojis_to_const.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,4 +290,6 @@ def convert_to_move_const(viable_emojis: dict[str, EmojiData]) -> dict[str, str]
consts = dict(list(sorted(consts.items(), key=lambda x: x[0])))
with open("move_consts.txt", "w") as outfile:
for name, move_string in consts.items():
_ = outfile.write(f'const {name}: vector<u8> = x"{move_string}";\n')
_ = outfile.write(
f'const {name}: vector<u8> = x"{move_string}";\n' # noqa: E231,E702
)
Loading