| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Cooked.Attack.TokenDuplication
Description
This module provides an automated attack to add minted tokens in a
TxSkel. In principle, a token duplication attack consist in minting a
higher amount of tokens already minted in the transaction, but we generalise
it to also add arbitrary tokens if needed.
Synopsis
- data TokenDuplicationParams owner effs = TokenDuplicationParams {
- tdpNewMints :: Sem effs [Mint]
- tdpThief :: owner
- anyMintTokenDuplicationParams :: [Mint] -> owner -> TokenDuplicationParams owner effs
- existingCurrencyTokenDuplicationParams :: Member Tweak effs => (VScript -> [(TokenName, Integer)]) -> owner -> TokenDuplicationParams owner effs
- existingAssetClassTokenDuplicationParams :: Member Tweak effs => (VScript -> TokenName -> Integer -> Integer) -> owner -> TokenDuplicationParams owner effs
- newtype TokenDuplicationLabel = TokenDuplicationLabel Value
- tokenDuplicationAttack :: (Members '[Tweak, NonDet] effs, IsTxSkelOutAllowedOwner owner) => TokenDuplicationParams owner effs -> Sem effs Value
Token duplication params
data TokenDuplicationParams owner effs Source #
Parameters of the token duplication attack
Constructors
| TokenDuplicationParams | |
Fields
| |
anyMintTokenDuplicationParams Source #
Arguments
| :: [Mint] | The |
| -> owner | The attacker, who receives the extra tokens. |
| -> TokenDuplicationParams owner effs |
Token duplications based on a list of Mint.
existingCurrencyTokenDuplicationParams Source #
Arguments
| :: Member Tweak effs | |
| => (VScript -> [(TokenName, Integer)]) | For each policy that occurs in some |
| -> owner | The attacker, who receives the extra tokens. |
| -> TokenDuplicationParams owner effs |
Token duplications based on a function applied to existing currencies (cannot add new currencies, but can add new types of tokens).
existingAssetClassTokenDuplicationParams Source #
Arguments
| :: Member Tweak effs | |
| => (VScript -> TokenName -> Integer -> Integer) | A function returning the new amount of tokens to mint given a specific currency, token name and amount. This new amount replaces the old one. |
| -> owner | The attacker, who receives the extra tokens. |
| -> TokenDuplicationParams owner effs |
Token duplications based on a function applied to both existing currencies and token (cannot add new currencies nor new types of tokens).
Token duplication label
newtype TokenDuplicationLabel Source #
A label added to a TxSkel on which a tweak duplicating tokens has been
applied. The label contains the value that was added to the transaction.
Constructors
| TokenDuplicationLabel Value |
Instances
Token duplication attack
tokenDuplicationAttack Source #
Arguments
| :: (Members '[Tweak, NonDet] effs, IsTxSkelOutAllowedOwner owner) | |
| => TokenDuplicationParams owner effs | The parameters of the attack |
| -> Sem effs Value |
This attack adds extra tokens of any kind in the minted value. The additional minted value is redirected to the attacker.