Token-Giver / token-giver

https://token-giver-7u11.vercel.app/
0 stars 6 forks source link

Add token transfer via erc20 on set_donation function #39

Closed Oshioke-Salaki closed 1 week ago

Oshioke-Salaki commented 1 week ago

Right now we handle token transfer on the frontend, we want to move this action to the contract. Implement openzeppelin_token erc20 token component and use the transfer function to handle token transfer after donation.

Then update self.donations.write(campaign_address, amount); with the amount donated. Add a new storage map donation details

pub struct DonationDetails = {
  token_id
  donor_address,
  amount
}
donation_details: Map<Contract_Address, DonationDetails> //  Contract_Address Is donor_contract_address

Emit donation event with following fields.

#[derive(Drop, starknet::Event)]
pub struct DonationCreated {
        pub campaign_id: u256,
        pub donor_address: ContractAddress,
        pub Amount: u256,
    pub token_id: u256,
        pub block_timestamp: u64,
}
chachaleo commented 1 week ago

Can I work on this ?