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

fix (fungible-token): add contract-caller as allowed sender #21

Closed
wants to merge 1 commit into from

Conversation

friedger
Copy link
Contributor

This PR changes the fungible-token.clar contract. It

Reasoning:
Currently, a defi contract would need to use (as-contract (contract-call? token transfer...)) if the defi contract wants to transfer own tokens. This is dangerous because it changes the sender context to the contract itself and gives the token contract access to all assets owned by the contract.

It is more secure to allow the defi contract to transfer the token as contract-caller. With this PR, an example defi.clar contract was added that allows to release tokens from the contract by any user. The user can transfer only the token itself, no other tokens might be transferred. This enables AMM without whitelisting contracts.

@leahjlou
Copy link
Collaborator

Hi @friedger, this is great! My apologies for the delay in getting this merged. Would you mind resolving the conflict in package.json and removing yarn.lock?

@leahjlou
Copy link
Collaborator

I resolved conflicts and merged the changes here: #28

Thanks for your contribution! 🙏

@leahjlou leahjlou closed this Oct 10, 2024
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.

fungible-token: allow contract-caller to send own token
3 participants