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

fungible-token: allow contract-caller to send own token #20

Open
friedger opened this issue Feb 26, 2024 · 1 comment
Open

fungible-token: allow contract-caller to send own token #20

friedger opened this issue Feb 26, 2024 · 1 comment

Comments

@friedger
Copy link
Contributor

Description
The contract fungible-token.clar has limited composability feature for defi products.

Currently, when a defi contract wants to transfer tokens that it holds it needs to use (as-contract (contract-call? token transfer ..)).
This is dangerous because malicious tokens have access to all assets the contract holds.

Solution
Relax assert to allow contract-caller to send own token. Replace asserts in transfer function with
(asserts! (or (is-eq tx-sender sender) (is-eq contract-caller sender)) ERR_UNAUTHORIZED)

@MarvinJanssen
Copy link

I agree and have always advocated for this change. In fact, I would even want to supersede the SIP010 document with a safe-transfer standard. There are contracts out there with and without the more lenient guard, which makes using SIP009/SIP010 tokens in DeFi rather problematic.

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 a pull request may close this issue.

2 participants