Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: transfer to ICS20 first then burn #296

Merged
merged 3 commits into from
Feb 19, 2025

Conversation

Farhad-Shabani
Copy link
Member

In continuation of #275
Closes: #276

@Farhad-Shabani Farhad-Shabani marked this pull request as ready for review February 19, 2025 02:34
Comment on lines +546 to +564
// approve ics20 contract to spend the tokens for `address_starknet_b`
{
let call_data = cairo_encoding.encode(&product![
ics20_contract_address,
U256::from(transfer_quantity)
])?;

let call = Call {
to: *ics20_token_address,
selector: selector!("approve"),
calldata: call_data,
};

let execution = starknet_account_b.execute_v3(vec![call]);

let tx_hash = execution.send().await?.transaction_hash;

starknet_chain.poll_tx_response(&tx_hash).await?;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm. this is a very interesting ! So, the token owner can burn tokens from anyone's balance, but token owner can't transfer it to their own balance ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question. This got me yesterday too. Should add a check in the ERC20Mintable contract.

In the standard ERC-20, since the supply is fixed, minting and burning don’t matter, so ownership isn’t really a concern. But in our case, we’re working with an extended version of ERC20 where only the owner (ICS20) can mint and burn tokens. This part of code was originally written at the start of the project just to get the MVP working. Now that it looks like we have no choice but to go with our own ERC20 version, it's good to review the implementation there and ensure it’s fully secure by adding some unit tests.

@Farhad-Shabani Farhad-Shabani merged commit 0a1b62f into main Feb 19, 2025
9 checks passed
@Farhad-Shabani Farhad-Shabani deleted the farhad/burn-from-ics20 branch February 19, 2025 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Zero address appearing as sender in testnet when minting IBC tokens
2 participants