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

Support anyone-can-pay script #69

Merged
merged 8 commits into from Jul 31, 2020
Merged

Support anyone-can-pay script #69

merged 8 commits into from Jul 31, 2020

Conversation

classicalliu
Copy link
Contributor

Now anyone-can-pay script only support to transfer anyone-can-pay addresses to anyone-can-pay address.
And transfer to anyone-can-pay address from any lock script will integrate to common later.

public readonly fromScript: Script;

constructor(
fromAddress: Address,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use FromInfo here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

constructor(
fromAddress: Address,
cellProvider: CellProvider,
{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we skip QueryOptions here? Is there any chance that we have to let users customize the query used here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's for anyone-can-pay with sudt https://github.com/nervosnetwork/lumos/pull/69/files#diff-2cf727f7322effda3e47a60c2bbcc253R199

If we skipped QueryOptions, we should provide a sudtToken param, for search anyone-can-pay lock script with sudt type script.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay in that sense let's keep QueryOptions here.

return txSkeleton;
}

export async function transfer(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like maybe we should not provide transfer here. I do want to distinguish transfer from withdraw in lumos:

  • transfer is an action that you exact CKBs from a bunch of cells that are alike, it does not matter which cell is in fact used.
  • withdraw is an action that you exact CKBs from exactly one cell, and you can only use that single cell.

I feel like in ACP, it's more likely we are dealing with withdrawing operation, not transfer operation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's this means we can withdraw a cell with withdraw capacity range [0,cell.capcaity-minimalCellCapcity] ∪ cell.capcaity, and withdraw amount (from data) range [0, cell.amount]

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I think that's the plan.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

return txSkeleton;
}

export async function destroyAnyoneCanPayInput(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One we change transfer to withdraw, I feel like we can merge this function with withdraw: the cell will be destroyed once one withdraw all the amount in the cell.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

@classicalliu classicalliu merged commit 81de436 into develop Jul 31, 2020
@classicalliu classicalliu deleted the anyone-can-pay branch July 31, 2020 03:23
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