12 require_auth( bidder );
13 check( newname.suffix() == newname,
"you can only bid on top-level suffix" );
15 check( (
bool)newname,
"the empty name is not a valid account name to bid on" );
16 check( (newname.value & 0xFull) == 0,
"13 character names are not valid account names to bid on" );
17 check( (newname.value & 0x1F0ull) == 0,
"accounts with 12 character names and no dots can be created without bidding required" );
18 check( !is_account( newname ),
"account already exists" );
19 check( bid.symbol == core_symbol(),
"asset must be system token" );
20 check( bid.amount > 0,
"insufficient bid" );
24 print(
name{bidder},
" bid ", bid,
" on ",
name{newname},
"\n" );
25 auto current = bids.find( newname.value );
26 if( current == bids.end() ) {
27 bids.emplace( bidder, [&](
auto& b ) {
29 b.high_bidder = bidder;
30 b.high_bid = bid.amount;
31 b.last_bid_time = current_time_point();
34 check( current->high_bid > 0,
"this auction has already closed" );
35 check( bid.amount - current->high_bid > (current->high_bid / 10),
"must increase bid by 10%" );
36 check( current->high_bidder != bidder,
"account is already highest bidder" );
43 r.amount +=
asset( current->high_bid, core_symbol() );
47 r.bidder = current->high_bidder;
48 r.amount =
asset( current->high_bid, core_symbol() );
54 get_self(),
"bidrefund"_n,
55 std::make_tuple( current->high_bidder, newname )
58 uint128_t deferred_id = (uint128_t(newname.value) << 64) | current->high_bidder.value;
59 sysio::cancel_deferred( deferred_id );
60 t.send( deferred_id, bidder );
62 bids.modify( current, bidder, [&](
auto& b ) {
63 b.high_bidder = bidder;
64 b.high_bid = bid.amount;
65 b.last_bid_time = current_time_point();
sysio::multi_index< "namebids"_n, name_bid, indexed_by<"highbid"_n, const_mem_fun< name_bid, uint64_t, &name_bid::by_high_bid > > > name_bid_table