Skip to content

Instantly share code, notes, and snippets.

@cryptcoin-junkey
Last active August 9, 2022 06:33
Show Gist options
  • Save cryptcoin-junkey/4070528d3ac7bd1ce52949454ef94173 to your computer and use it in GitHub Desktop.
Save cryptcoin-junkey/4070528d3ac7bd1ce52949454ef94173 to your computer and use it in GitHub Desktop.
[plan] A `Levy` function for Monaparty.

This feature is to add a levy message to Monaparty protocol.

Protocol changes

levy message

New.

stored value

asset_name, levy_fixed, levy_permill

Default values if a asset doesn't not set levy.

  • The default value of levy_fixed is 0.
  • The default value of levy_permill is 0.

So there is no modification if an asset owner wasn't set leviable.

validation

  • The sender of message must be the owner of asset_name.
  • levy_fixed must be a positive integer.
  • levy_permill must be a positive integer lesser than or equal to 1000.
  • The message must be invalidated if asset_name is not listable and levy_permill is set.
  • The message must be invalidated if asset_name is vendable.
  • holders of asset_name must be only owner.

overwrite

levy_fixed and levy_permill can be overwrite by new levy messages. They must pass more restrictions follows:

  • levy_fixed must be lesser than or equal to previous levy_fixed.
  • levy_permill must be lesser than or equal to previous levy_permill.

issuance message

Messages are invalidated if they set vendable true to a leviable asset.

send message

sender is the asset owner

No change.

sender is not the asset owner

The message must be invalidated if the sender have less XMP than levy_fixed.

The sender is lost levy_fixed XMP. The asset owner gets floor(levy_fixed * 95 / 100) XMP. levy_fixed - floor(levy_fixed * 95 / 100) is burned as a fee.

sweep message

Same as send per each asset.

order message

A counterpart asset must be XMP only if the asset was set as leviable.

In case the FOOBAR asset is issued and is set levy by Alice, Bob(a holder) maked FOOBAR, and Carol took it by n XMP.

Carol is lost floor(n * levy_permill / (1000)) Alice gets floor(n * levy_permill * 95 / (1000 * 100)). And a difference is burned as a fee.

In case the FOOBAR asset is issued and is set levy by Alice, Bob(a holder) maked FOOBAR, and Alice took it by m XMP.

No levy is occured since Alice is a owner of FOOBAR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment