Skip to content

Considerations on converting our Cash implementation to Debit #1

@keyvank

Description

@keyvank

Assumptions

  • In the proposed implementation of Plasma Debit, we are not going to support channel ownership transfers.

Terminology changes

  • Coin structure is now a unidirectional payment Channel with the operator.
  • capacity: is the maximum amount a channel can have.
  • amount: is the amount of money that is withdrawn when a user submits an exit, operator gets capacity - amount

Channels
In Plasma Debit, Channels should be treated like Coins in Plasma Cash.

Cash:

struct Coin {
  address owner; // Initial owner of the coin. (Doesn't change)
  uint256 amount;
}

Debit:

struct Channel {
  address owner; // Initial owner of the channel. (Doesn't change)
  uint256 amount; // Initial balance of the channel. (Doesn't change)
  uint256 capacity; // Initial capacity of the channel. (Operator can increase this)
}

Operator can increase the capacity of a channel by calling the extendCapacity function:

function extendCapacity(uint256 _channelId)
public
payable
onlyOperator {
  Channel storage channel = channels[_channelId];
  require(channel.capacity > 0, "Channel does not exist.");
  require(msg.value > 0, "msg.value should be > 0.");
  channel.capacity += msg.value;
}

Exits
As we don't support channel ownership transfers in our current implementation, we remove the exitor property of our previous Exit struct of Plasma Cash.
A new property named amount is added to our exit struct which holds the amount of money that is withdrawn to the channel owner when the channel is exited. It is always less than the capacity of that channel.

Cash:

struct Exit {
  address exitor;
  uint256 finalAt; // block.timestamp when the exit was made + CHALLENGE_TIME.
  bool invalid;
}

Debit:

struct Exit {
  uint256 amount; // Exiting amount.
  uint256 finalAt; // block.timestamp when the exit was made + CHALLENGE_TIME.
  bool invalid;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions