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

Allow custom reference in #topup transactions #46

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions func/common.fc
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ const int err::invalid_auction_config = 223;

int mod(int x, int y) asm "MOD";
int equal_slices(slice a, slice b) asm "SDEQ";
int is_prefix_of(slice a, slice b) asm "SDPFX";
int builder_null?(builder b) asm "ISNULL";
builder store_builder(builder to, builder from) asm "STBR";

Expand Down
4 changes: 2 additions & 2 deletions func/nft-collection.fc
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ _ unwrap_signed_cmd(slice signed_cmd, int public_key, int subwallet_id, int msg_

if (op == 0) { ;; regular money transfer
;; NB: it is not possible to recover any money transferred to this account
;; so we return back all transfers except ones with comment #topup in it
throw_unless(err::wrong_topup_comment, equal_slices(in_msg_body, "#topup") & (in_msg_body.slice_refs() == 0));
;; so we return back all transfers except ones with comment starting #topup in it
throw_unless(err::wrong_topup_comment, is_prefix_of("#topup", in_msg_body) & (in_msg_body.slice_refs() == 0));

return ();
}
Expand Down
2 changes: 1 addition & 1 deletion func/nft-item.fc
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ cell change_dns_record(cell dns, slice in_msg_body) {
}

if (op == 0) {
int is_topup = equal_slices(in_msg_body, "#topup") & (in_msg_body.slice_refs() == 0);
int is_topup = is_prefix_of("#topup", in_msg_body) & (in_msg_body.slice_refs() == 0);
throw_unless(err::forbidden_topup, is_topup | equal_slices(sender_address, owner_address)); ;; only owner can fill-up balance, prevent coins lost right after the auction
;; if owner send bid right after auction he can restore it by transfer response message
return ();
Expand Down