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

Feegrant: Is it possible to implement the content of a sponsored-transactions (user A's fee is paid by user B)? #1738

Open
99Kies opened this issue Jun 20, 2023 · 8 comments

Comments

@99Kies
Copy link

99Kies commented Jun 20, 2023

Is it possible to implement the content of a sponsored-transactions on cosmwasm (user A's fee is paid by user B)

@webmaster128
Copy link
Member

There is a fee payer in transactions and a feegrant module in Cosmos SDK. I think this is what you are looking for. But this is happening on the Cosmos SDK level and is not CosmWasm specific.

@vishrutsingh
Copy link

Fee grant support was discussed in #1200 but was there any further discussion on this topic? Can't find any implementation in the code.
This could be useful to have if one has to test a contract on mainnet and has insufficient/low funds to begin with.

@webmaster128
Copy link
Member

Here is a team that is issuing grants as a contract (i.e. contract is grantee):
https://github.com/astroport-fi/astroport-core/blob/52af83eab04c620ac40019f7cc9cee433d0c601e/contracts/periphery/fee_granter/src/contract.rs#L120-L181

It's great this works but is not very convenient yet. E.g. the GRANTS need to be tracked separatly instead of being queried from chain.

@webmaster128 webmaster128 changed the title Is it possible to implement the content of a sponsored-transactions on cosmwasm (user A's fee is paid by user B) Feegrant: Is it possible to implement the content of a sponsored-transactions (user A's fee is paid by user B)? Sep 26, 2023
@99Kies
Copy link
Author

99Kies commented Oct 8, 2023

@webmaster128
image

Can the --allowed-messages in this feegrant be set to the specified contract address?

I want dapp user to be able to use money from my account for gas fee when they can use my contract.

@webmaster128
Copy link
Member

@99Kies can you open an issue for that in wasmd (and link it here)? Alex should be able to help over there.

@webmaster128
Copy link
Member

I want dapp user to be able to use money from my account for gas fee when they can use my contract.

Other devs achieve something similar by allowing the users to spend the contract's funds. In this case the contract needs to create the grant itself. Not necessarily easier but seems to be possible.

@99Kies
Copy link
Author

99Kies commented Oct 9, 2023

https://github.com/astroport-fi/astroport-core/blob/52af83eab04c620ac40019f7cc9cee433d0c601e/contracts/periphery/fee_granter/src/contract.rs#L120-L181

@webmaster128 I see this function. It's actually executing wasmd tx feegrant grantContractAddress granteeContractAddress.

By this way can user A call the methods of grantee Contract without consuming the handling fee?

@99Kies
Copy link
Author

99Kies commented Oct 9, 2023

@webmaster128 I tried this and specifying grantee as the contract address doesn't work. Since it's still the user who is initiating the transaction, the fee is still paid by the user.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants