-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathREADME.md
147 lines (117 loc) · 3.24 KB
/
README.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
<!-- cspell:word permissioned -->
# `emojicoin-dot-fun` market metadata
This package contains functions to set and get metadata about markets in a
permissioned way.
## Publish commands
Set variables:
```sh
MARKET_METADATA=0xaaa...
EMOJICOIN_DOT_FUN=0xbbb...
PROFILE=my-profile
```
Publish:
```sh
NAMED_ADDRESSES=$(
printf "%s,%s" \
"market_metadata=$MARKET_METADATA" \
"emojicoin_dot_fun=$EMOJICOIN_DOT_FUN"
)
aptos move publish \
--assume-yes \
--move-2 \
--named-addresses $NAMED_ADDRESSES \
--profile $PROFILE
```
## Add admin
```sh
NEW_ADMIN=0xccc...
MARKET_METADATA=0xaaa...
PROFILE_NAME=my-profile
aptos move run \
--args address:$NEW_ADMIN \
--function-id $MARKET_METADATA::emojicoin_dot_fun_market_metadata::add_admin \
--profile $PROFILE_NAME
```
## Remove admin
```sh
ADMIN_TO_REMOVE=0xccc...
MARKET_METADATA=0xaaa...
PROFILE_NAME=my-profile
aptos move run \
--args address:$ADMIN_TO_REMOVE \
--function-id \
$MARKET_METADATA::emojicoin_dot_fun_market_metadata::remove_admin \
--profile $PROFILE_NAME
```
## Add properties
> If market metadata entry does not exist, create an empty entry. Then, add
> market properties, overwriting existing properties if they already exist.
```sh
MODULE=emojicoin_dot_fun_market_metadata
FUNCTION=add_market_properties
PACKAGE_ADDRESS=0xabc...
MARKET_ADDRESS=0xdef...
PROFILE=my-profile
PROPERTIES='"X profile","Website","Telegram"'
VALUES='"foo","bar","baz"'
```
```sh
aptos move run \
--args \
"address:$MARKET_ADDRESS" \
'string:['$PROPERTIES']' \
'string:['$VALUES']' \
--function-id "$PACKAGE_ADDRESS::$MODULE::$FUNCTION" \
--profile $PROFILE
```
## Remove properties
> If the market has an entry, remove all specified keys. If the market has no
> entries after removing the keys, remove the market from the metadata registry.
```sh
MODULE=emojicoin_dot_fun_market_metadata
FUNCTION=remove_market_properties
PACKAGE_ADDRESS=0xabc...
MARKET_ADDRESS=0xdef...
PROFILE=my-profile
PROPERTIES='"X profile","Website"'
```
```sh
aptos move run \
--args "address:$MARKET_ADDRESS" 'string:['$PROPERTIES']' \
--function-id "$PACKAGE_ADDRESS::$MODULE::$FUNCTION" \
--profile $PROFILE
```
## Set properties
> Clear all properties for the given market if it has any, then set the supplied
> values. If there are no supplied key-value pairs, remove the market's entry
> from the metadata registry.
```sh
MODULE=emojicoin_dot_fun_market_metadata
FUNCTION=set_market_properties
PACKAGE_ADDRESS=0xabc...
MARKET_ADDRESS=0xdef...
PROFILE=my-profile
PROPERTIES='"X profile","Website","Telegram"'
VALUES='"foo","bar","baz"'
```
```sh
aptos move run \
--args \
"address:$MARKET_ADDRESS" \
'string:['$PROPERTIES']' \
'string:['$VALUES']' \
--function-id "$PACKAGE_ADDRESS::$MODULE::$FUNCTION" \
--profile $PROFILE
```
## Emojicoin special properties
The `emojicoin dot fun` frontend will only consider the following values:
- `Discord`
- `Telegram`
- `Website`
- `X profile`
For example, to set the website to `https://example.org` and the x profile to
`0xabcd` for the `0xabcd` market, you can use the following variables:
```sh
PROPERTIES='"Website","X profile"'
VALUES='"https://example.org","https://x.com/0xabcd"'
```