Incorrect state of the variables.
NFT owner at start of auction [469394814521890341860918960550914]
Nft balance of bidder of 111 before END is 0
Nft balance of bidder of 3261725658685625214387356271586076291828489518716458212830507939744925554858 before END is 1
Nft balance of bidder of 111 after END is 1
Nft balance of bidder of 3261725658685625214387356271586076291828489518716458212830507939744925554858 after END is 0
NFT owner at end of auction [469394814521890341860918960550914]
[PASS] starknet_auction_integrationtest::test_contract::test_call_end (gas: ~2393)
#[test]
fn test_call_end() {
let (auction_dispatcher, auction_contract, erc20_contract_address, erc721_contract_address) =
deploy_auction_contract();
auction_dispatcher.start(86400, 10);
println!(
"NFT owner at start of auction {:?}", load(auction_contract, selector!("nft_owner"), 1)
);
let erc20_dispatcher = IMockERC20TokenDispatcher { contract_address: erc20_contract_address };
let erc721_dispatcher = IERC721Dispatcher { contract_address: erc721_contract_address };
let first_bidder_address: ContractAddress = 123.try_into().unwrap();
start_cheat_caller_address_global(first_bidder_address);
erc20_dispatcher.mint(first_bidder_address, 20);
erc20_dispatcher.token_approve(auction_contract, 20);
auction_dispatcher.bid(11);
stop_cheat_caller_address_global();
let second_bidder_address: ContractAddress = 111.try_into().unwrap();
start_cheat_caller_address_global(second_bidder_address);
erc20_dispatcher.mint(second_bidder_address, 15);
erc20_dispatcher.token_approve(auction_contract, 15);
auction_dispatcher.bid(15);
stop_cheat_caller_address_global();
let time = get_block_timestamp();
start_cheat_block_timestamp(auction_contract, time + 86401);
start_cheat_caller_address_global(auction_contract);
erc721_dispatcher.approve(second_bidder_address, 1);
stop_cheat_caller_address_global();
let nft_balance = erc721_dispatcher.balance_of(auction_contract);
assert(nft_balance == 1, 'Nft balance must be 1');
let nft_balance_highest_bidder = erc721_dispatcher.balance_of(second_bidder_address);
println!(
"Nft balance of bidder of {second_bidder_address:?} before END is {nft_balance_highest_bidder:?}"
);
let nft_balance_auction_contract = erc721_dispatcher.balance_of(auction_contract);
println!(
"Nft balance of bidder of {auction_contract:?} before END is {nft_balance_auction_contract:?}"
);
auction_dispatcher.end();
let nft_balance_highest_bidder = erc721_dispatcher.balance_of(second_bidder_address);
println!(
"Nft balance of bidder of {second_bidder_address:?} after END is {nft_balance_highest_bidder:?}"
);
let nft_balance_auction_contract = erc721_dispatcher.balance_of(auction_contract);
println!(
"Nft balance of bidder of {auction_contract:?} after END is {nft_balance_auction_contract:?}"
);
println!("NFT owner at end of auction {:?}", load(auction_contract, selector!("nft_owner"), 1));
stop_cheat_block_timestamp(auction_contract);
}