Skip to content

Commit f456387

Browse files
author
root28root
committed
vendor: prune aptos-core to move-stdlib only
1 parent 5b07cee commit f456387

39 files changed

Lines changed: 6 additions & 25564 deletions

minimarket/sources/minimarket.move

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,6 @@ module minimarket::minimarket {
3939
assert!(market.admin == caller, E_ONLY_ADMIN);
4040
}
4141

42-
fun get_mut(market_addr: address): &mut Market acquires Market {
43-
borrow_global_mut<Market>(market_addr)
44-
}
45-
46-
fun get(market_addr: address): &Market acquires Market {
47-
borrow_global<Market>(market_addr)
48-
}
49-
5042
fun find_balance_index(balances: &vector<Balance>, owner: address): (bool, u64) {
5143
let i = 0u64;
5244
let len = vector::length(balances);
@@ -69,7 +61,7 @@ module minimarket::minimarket {
6961
}
7062

7163
/// init(admin, fee_bps: 0..=10000)
72-
/// ВАЖНО: здесь НЕТ `acquires`, мы не читаем/не извлекаем глобальные ресурсы; только `exists` + `move_to`.
64+
/// ВАЖНО: здесь НЕТ `acquires`, мы не выносим ссылки из глобального состояния.
7365
public entry fun init(admin: &signer, fee_bps: u64) {
7466
let admin_addr = signer::address_of(admin);
7567
assert!(!exists<Market>(admin_addr), E_ALREADY_INITIALIZED);
@@ -89,7 +81,7 @@ module minimarket::minimarket {
8981
public entry fun list(seller: &signer, market_addr: address, item_id: u64, price: u64) acquires Market {
9082
assert_initialized(market_addr);
9183
let seller_addr = signer::address_of(seller);
92-
let m = get_mut(market_addr);
84+
let m = borrow_global_mut<Market>(market_addr);
9385

9486
let len = vector::length(&m.items);
9587
if (item_id == len) {
@@ -105,9 +97,9 @@ module minimarket::minimarket {
10597
}
10698

10799
/// buy(item_id, pay_amount == price). Комиссия удерживается в пуле.
108-
public entry fun buy(buyer: &signer, market_addr: address, item_id: u64, pay_amount: u64) acquires Market {
100+
public entry fun buy(_buyer: &signer, market_addr: address, item_id: u64, pay_amount: u64) acquires Market {
109101
assert_initialized(market_addr);
110-
let m = get_mut(market_addr);
102+
let m = borrow_global_mut<Market>(market_addr);
111103
let len = vector::length(&m.items);
112104
assert!(item_id < len, E_BAD_ITEM_ID);
113105

@@ -128,7 +120,7 @@ module minimarket::minimarket {
128120
public entry fun withdraw_fees(admin: &signer, market_addr: address) acquires Market {
129121
assert_initialized(market_addr);
130122
let caller = signer::address_of(admin);
131-
let m = get_mut(market_addr);
123+
let m = borrow_global_mut<Market>(market_addr);
132124
only_admin(m, caller);
133125

134126
let amount = m.fees_accumulated;
@@ -140,7 +132,7 @@ module minimarket::minimarket {
140132

141133
/// Просмотр внутреннего баланса (для демо/тестов)
142134
public fun view_balance(market_addr: address, owner: address): u64 acquires Market {
143-
let m = get(market_addr);
135+
let m = borrow_global<Market>(market_addr);
144136
let (found, idx) = find_balance_index(&m.balances, owner);
145137
if (!found) { 0 } else { vector::borrow(&m.balances, idx).amount }
146138
}

minimarket/vendor/aptos-core/.actrc

Lines changed: 0 additions & 2 deletions
This file was deleted.

minimarket/vendor/aptos-core/.backportrc.json

Lines changed: 0 additions & 12 deletions
This file was deleted.

minimarket/vendor/aptos-core/.dockerignore

Lines changed: 0 additions & 45 deletions
This file was deleted.

minimarket/vendor/aptos-core/.editorconfig

Lines changed: 0 additions & 8 deletions
This file was deleted.

minimarket/vendor/aptos-core/.gitattributes

Lines changed: 0 additions & 30 deletions
This file was deleted.

minimarket/vendor/aptos-core/.gitignore

Lines changed: 0 additions & 152 deletions
This file was deleted.

minimarket/vendor/aptos-core/.gitmodules

Lines changed: 0 additions & 3 deletions
This file was deleted.

minimarket/vendor/aptos-core/.lycheeignore

Lines changed: 0 additions & 3 deletions
This file was deleted.

minimarket/vendor/aptos-core/.node-version

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)