Skip to content

Commit 81ac6ff

Browse files
committed
Merge branch 'platforms_multi_index' into 'master'
Platforms multi index See merge request snax/blockchain/eos/snax!89
2 parents eee771f + 2af2816 commit 81ac6ff

31 files changed

Lines changed: 610 additions & 581 deletions

.gitlab-ci.yml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ cleanup:
3030
changes:
3131
- "*.md"
3232
tags:
33-
- build3
33+
- build2
3434

3535
build:
3636
stage: build
@@ -50,8 +50,7 @@ build:
5050
changes:
5151
- "*.md"
5252
tags:
53-
- build3
54-
53+
- build2
5554

5655
build:tag:
5756
stage: build
@@ -68,7 +67,7 @@ build:tag:
6867
only:
6968
- tags
7069
tags:
71-
- build3
70+
- build2
7271

7372
build:tag:macos:
7473
stage: build
@@ -87,6 +86,7 @@ build:tag:macos:
8786
tags:
8887
- macos
8988

89+
9090
build:tag:elastic:
9191
stage: build
9292
script:
@@ -109,7 +109,7 @@ build:tag:elastic:
109109
only:
110110
- tags
111111
tags:
112-
- build3
112+
- build2
113113

114114
test:jest:
115115
stage: test
@@ -123,7 +123,7 @@ test:jest:
123123
changes:
124124
- "*.md"
125125
tags:
126-
- build3
126+
- build2
127127

128128
test:core:
129129
stage: test
@@ -140,8 +140,10 @@ test:core:
140140
- contracts/platform/*
141141
- jest_tests/*
142142
- "*.md"
143+
- contracts/*
144+
- .gitlab-ci.yml
143145
tags:
144-
- build3
146+
- build2
145147

146148
build:docker:
147149
stage: build-docker
@@ -157,7 +159,7 @@ build:docker:
157159
changes:
158160
- "*.md"
159161
tags:
160-
- build3
162+
- build2
161163

162164
build:docker:tag:
163165
stage: build-docker
@@ -173,7 +175,7 @@ build:docker:tag:
173175
only:
174176
- tags
175177
tags:
176-
- build3
178+
- build2
177179

178180
build:docker:tag:elastic:
179181
stage: build-docker
@@ -189,7 +191,7 @@ build:docker:tag:elastic:
189191
only:
190192
- tags
191193
tags:
192-
- build3
194+
- build2
193195

194196
publish:
195197
stage: publish

contracts/snax.airdrop/snax.airdrop.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,9 @@ namespace snax {
5959
}
6060

6161
void airdrop::check_platform_registered(const account_name platform) {
62-
_snax_global_state _state(N(snax), N(snax));
63-
const auto& state = _state.get();
64-
for (auto& platform_config: state.platforms) {
65-
if (platform_config.account == platform) return;
66-
}
62+
_platforms_table _platforms(N(snax), N(snax));
63+
for (auto platform_config = _platforms.begin(); platform_config != _platforms.end(); platform_config++)
64+
if (platform_config->account == platform) return;
6765
snax_assert(false, "platform doesnt exist in snax global state");
6866
}
6967

contracts/snax.airdrop/snax.airdrop.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ namespace snax {
7272
typedef multi_index<N(accounts), account_with_balance> _accounts_balances;
7373
typedef multi_index<N(requested), account_n> _requested_accounts_table;
7474
typedef multi_index<N(platforms), platform_def> _platform_definitions_table;
75-
typedef singleton<N(global), snaxsystem::snax_global_state> _snax_global_state;
75+
typedef multi_index<N(platforms), snax::platform_config> _platforms_table;
7676

7777
_platform_definitions_table _platform_definitions;
7878

contracts/snax.system/producer_pay.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,7 @@ namespace snaxsystem {
3737

3838
const asset system_supply_soft_limit = system_supply_limit / 10;
3939

40-
asset platform_full_balance;
41-
42-
for (auto& config: _gstate.platforms) {
43-
platform_full_balance += get_balance(config.account);
44-
};
40+
asset platform_full_balance = get_platform_full_balance();
4541

4642
const asset issued_supply = snax::token(N(snax.token)).get_supply(snax::symbol_type(system_token_symbol).name());
4743

contracts/snax.system/snax.system.abi

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -262,14 +262,6 @@
262262
},{
263263
"name": "platform_config",
264264
"base": "",
265-
"fields": [
266-
{"name": "account", "type": "account_name"},
267-
{"name": "weight", "type": "float64"},
268-
{"name": "period", "type": "uint32"}
269-
]
270-
},{
271-
"name": "platform_config_extended",
272-
"base": "",
273265
"fields": [
274266
{"name": "account", "type": "account_name"},
275267
{"name": "weight", "type": "float64"},
@@ -301,8 +293,7 @@
301293
{"name":"max_transaction_delay", "type":"uint32"},
302294
{"name":"max_inline_action_size", "type":"uint32"},
303295
{"name":"max_inline_action_depth", "type":"uint16"},
304-
{"name":"max_authority_depth", "type":"uint16"},
305-
{"name":"platforms", "type":"platform_config[]"}
296+
{"name":"max_authority_depth", "type":"uint16"}
306297
]
307298
},{
308299
"name": "snax_global_state",
@@ -460,7 +451,7 @@
460451
"name": "setplatforms",
461452
"base": "",
462453
"fields": [
463-
{"name":"platforms", "type":"platform_config_extended[]"}
454+
{"name":"platforms", "type":"platform_config[]"}
464455
]
465456
},{
466457
"name": "setparams",
@@ -651,6 +642,12 @@
651642
"index_type": "i64",
652643
"key_names" : ["owner"],
653644
"key_types" : ["account_name"]
645+
},{
646+
"name": "platforms",
647+
"type": "platform_config",
648+
"index_type": "i64",
649+
"key_names" : ["account"],
650+
"key_types" : ["account_name"]
654651
},{
655652
"name": "userres",
656653
"type": "user_resources",

0 commit comments

Comments
 (0)