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

feat: create Action type and send_with_callback #3

Closed
wants to merge 14 commits into from

Conversation

willemneal
Copy link
Contributor

@willemneal willemneal commented Aug 1, 2021

This adds a new function send_with_callback, which takes a contract with a function link_callback(account_id), and the gas required for the call.

To handle this change I added an Action enum to replace the Balance value type in the map:

pub enum Action {
  Deposit(Balance),
  DepositCallBack(Balance, AccountId, Gas, Balance),
}

Then when responding to claims the it checks the action to determine if a call back is added to the promise chain.

  • Add final attached deposit required by callback

@mattlockyer
Copy link
Contributor

I see where you're going with it. Could be really useful to kick off a cross contract call after linkdrop is claimed.

e.g. I deploy this linkdrop proxy, call send_with_callback (restricted to only_owner) then a callback NFT contract and method could mint a free NFT, only for calls with predecessor of the linkdrop proxy contract.

@willemneal
Copy link
Contributor Author

Bingo! That is exactly my plan.

@mattlockyer
Copy link
Contributor

Yea cause then we don't have to redeploy our linkdrop proxy contracts to do "new things" with linkdrops. We can just keep creating them and changing the send_with_callback args. Great idea! Love the composability!

@willemneal willemneal marked this pull request as ready for review August 12, 2021 16:52
@willemneal willemneal marked this pull request as draft August 12, 2021 16:52
@willemneal
Copy link
Contributor Author

@mattlockyer Just realized that we need to add a way to specify how much attached deposit is required for the final callback.

But in other news, I've tested it with my newest project and realized I forgot about the attached deposit when the callback returns.

@willemneal willemneal closed this Feb 23, 2023
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.

None yet

2 participants