Skip to content
This repository has been archived by the owner on Apr 8, 2022. It is now read-only.

C2X transfer refunds #92

Open
wants to merge 3 commits into
base: staging
Choose a base branch
from
Open

C2X transfer refunds #92

wants to merge 3 commits into from

Conversation

altonen
Copy link
Contributor

@altonen altonen commented Nov 6, 2021

This PR introduces a new destination type called Destination::FundPP which is used solely for funding a smart contract. It also implements refunding for C2X transfers as previously all excess funds were burned, now they're returned back to the contract.

@altonen altonen requested a review from zorvan November 6, 2021 14:43
@altonen altonen changed the base branch from staging to pp-validation November 6, 2021 14:46
@altonen altonen changed the base branch from pp-validation to staging November 21, 2021 10:58
pallets/utxo/src/lib.rs Outdated Show resolved Hide resolved
pallets/utxo/src/lib.rs Outdated Show resolved Hide resolved
Remove funding functionality from Destination::CallPP and introduce
a new destination type that is used only for funding. This makes
the interface cleaner and enables a simple implementation for refunds
after C2X transfers.
Implement Contract-to-Pubkey (C2PK) and Contract-to-Contract (C2C) refunds.
As the contract must be spend all of its funds when it's doing a C2X
transfer, a refunding mechanism where the excess funds of a transfer
are sent back to the contract must be implemented.

This commit uses Destination::FundPP to refund the contract the
difference of total funds versus the amount it is transferring.
@altonen altonen marked this pull request as ready for review November 22, 2021 17:01
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants