You can check this line in src/map/trade.cpp
/**
* Adds the specified amount of zeny to the trade window
* This function will check if the player have enough money to do so
* And if the target player have enough space for that money
* @param sd : Player who's adding zeny
* @param amount : zeny amount
*/
void trade_tradeaddzeny(map_session_data* sd, int32 amount)
{
map_session_data* target_sd;
nullpo_retv(sd);
if( !sd->state.trading || sd->state.deal_locked > 0 )
return; //Can't add stuff.
if( (target_sd = map_id2sd(sd->trade_partner.id)) == nullptr ) {
trade_tradecancel(sd);
return;
}
if( amount < 0 || amount > sd->status.zeny || amount > MAX_ZENY - target_sd->status.zeny ) { // invalid values, no appropriate packet for it => abort
trade_tradecancel(sd);
return;
}
sd->deal.zeny = amount;
clif_tradeadditem(sd, target_sd, 0, amount);
}