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

[Feature]: Option 2: Add message as argument to TokenFactory send hooks #6389

Closed
Tracked by #5864
apollo-sturdy opened this issue Sep 13, 2023 · 4 comments
Closed
Tracked by #5864
Assignees

Comments

@apollo-sturdy
Copy link

Summary

Add field message: CosmosMsg to SudoMsg::TrackBeforeSend and SudoMsg::BlockBeforeSend enum variants.

Problem Definition

No response

Proposed Feature

There are currently two before send bank hooks for TokenFactory, BlockBeforeSend and TrackBeforeSend. These both have the arguments/fields from: String, to: String, and amount: Coin. It would be great if a fourth field message could be added with type CosmosMsg. When a user sends coins in a CosmosMsg, this message would be included in the BlockBeforeSend and TrackBeforeSend hooks. This would allow contracts to conditionally perform actions depending on the kind of message.

Example

User calls a contract with

CosmosMsg::Wasm(
    WasmMsg::Execute { 
        funds: Vec<Coin>,
        contract_addr: String,
        msg: Binary
    }
)

and sends coins with the funds field. Before executing the contract and transfering the coins to it, the chain would call BlockBeforeSend and TrackBeforeSend with the CosmosMsg as a field. The hook contract could then match on the message, see that it is a contract execution, check which contract is being executed and what action is being performed on the contract. If it is a specific action, it could for example block the send, deduct a tax from the user, or similar action.

@czarcas7ic
Copy link
Member

@apollo-sturdy follow on question, would these message fields be useful in the Track/Block AfterSend fields as well? Or just the BeforeSend fields?

@mattverse
Copy link
Member

@czarcas7ic AFAIK this is a alternative to the after send hooks

@czarcas7ic czarcas7ic changed the title [Feature]: Add message as argument to TokenFactory send hooks [Feature]: Option 2: Add message as argument to TokenFactory send hooks Sep 20, 2023
@apollo-sturdy
Copy link
Author

@apollo-sturdy follow on question, would these message fields be useful in the Track/Block AfterSend fields as well? Or just the BeforeSend fields?

Yes, I think for full flexibility would be good to have it in both.

@PaddyMc
Copy link
Collaborator

PaddyMc commented Apr 30, 2024

Closing, if this is still an issue ask here => https://github.com/strangelove-ventures/tokenfactory

@PaddyMc PaddyMc closed this as completed Apr 30, 2024
@github-project-automation github-project-automation bot moved this from Needs Triage 🔍 to Done ✅ in Osmosis Chain Development Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants