Background
The AdsBazaar business dashboard applicant review panel has two actions per applicant: Approve (maps to select_creator) and Reject. Currently only select_creator exists — there is no on-chain way to formally reject an applicant.
Without rejection, the contract cannot distinguish between "pending review" and "deliberately declined". This blocks the frontend from showing accurate application status to creators.
Signature
pub fn reject_application(env: Env, campaign_id: u64, business: Address, creator: Address) -> Result<(), Error>
Rules
- Only the campaign's
business address may call this
- Campaign must be
Open or Active
- Application must exist and have
status == Applied (cannot reject an already-selected creator via this path)
- Sets
application.status = ApplicationStatus::Rejected
- Does not affect campaign status or budget
Implementation notes
pub fn reject_application(env: Env, campaign_id: u64, business: Address, creator: Address) -> Result<(), Error> {
business.require_auth();
let campaign = Self::campaign(env.clone(), campaign_id)?;
if campaign.business != business {
return Err(Error::NotCampaignOwner);
}
let mut application: Application = env
.storage()
.persistent()
.get(&DataKey::Application(campaign_id, creator.clone()))
.ok_or(Error::ApplicationNotFound)?;
if application.status != ApplicationStatus::Applied {
return Err(Error::ApplicationNotFound); // already actioned
}
application.status = ApplicationStatus::Rejected;
env.storage().persistent().set(
&DataKey::Application(campaign_id, creator.clone()),
&application,
);
env.events().publish(
(Symbol::new(&env, "application_rejected"), campaign_id),
creator,
);
Ok(())
}
Files
src/lib.rs — add ApplicationStatus::Rejected variant and reject_application function
- Update
ApplicationStatus enum (it currently only has Applied, Selected, Rejected — confirm Rejected is present and exercised)
Acceptance criteria
Background
The AdsBazaar business dashboard applicant review panel has two actions per applicant: Approve (maps to
select_creator) and Reject. Currently onlyselect_creatorexists — there is no on-chain way to formally reject an applicant.Without rejection, the contract cannot distinguish between "pending review" and "deliberately declined". This blocks the frontend from showing accurate application status to creators.
Signature
Rules
businessaddress may call thisOpenorActivestatus == Applied(cannot reject an already-selected creator via this path)application.status = ApplicationStatus::RejectedImplementation notes
Files
src/lib.rs— addApplicationStatus::Rejectedvariant andreject_applicationfunctionApplicationStatusenum (it currently only hasApplied,Selected,Rejected— confirmRejectedis present and exercised)Acceptance criteria
reject_applicationis callable only by the campaign's business addressError::NotCampaignOwnerfor non-owner callersError::ApplicationNotFoundwhen application doesn't exist or is already actionedRejectedapplication_rejectedevent with campaign_id and creator address