ex_plasma v0.1.0 ExPlasma.Transaction.Deposit

A Deposit Transaction type. We use this to send money into the contract to be used. This is really just a Payment Transaction with no inputs

Link to this section Summary

Functions

Generate a new Deposit transaction struct which should

The associated value for the output type. It's a hard coded value you can find on the contracts

The associated value for the transaction type. It's a hard coded value you can find on the contracts

Link to this section Types

Link to this type

t()

t() :: %ExPlasma.Transaction.Deposit{
  inputs: [ExPlasma.Utxo.t()],
  metadata: binary(),
  outputs: [ExPlasma.Utxo.t()],
  sigs: [String.t()],
  tx_data: term(),
  tx_type: term()
}

Link to this section Functions

Generate a new Deposit transaction struct which should:

  • have 0 inputs
  • have 1 output, containing the owner, currency, and amount

Examples

Generate with a single output Utxo

iex> alias ExPlasma.Utxo iex> alias ExPlasma.Transaction.Deposit iex> address = "0x1dF62f291b2E969fB0849d99D9Ce41e2F137006e" iex> currency = "0x2e262d291c2E969fB0849d99D9Ce41e2F137006e" iex> Deposit.new(%Utxo{owner: address, currency: currency, amount: 1}) {:ok, %ExPlasma.Transaction.Deposit{ inputs: [], sigs: [], metadata: nil, outputs: [%ExPlasma.Utxo{

amount: 1,
blknum: nil,
currency: "0x2e262d291c2E969fB0849d99D9Ce41e2F137006e",
oindex: nil,
owner: "0x1dF62f291b2E969fB0849d99D9Ce41e2F137006e",
txindex: nil}]

}}

Generate with a keyword list

iex> alias ExPlasma.Transaction.Deposit iex> address = "0x1dF62f291b2E969fB0849d99D9Ce41e2F137006e" iex> currency = "0x2e262d291c2E969fB0849d99D9Ce41e2F137006e" iex> Deposit.new(owner: address, currency: currency, amount: 1) {:ok, %ExPlasma.Transaction.Deposit{ inputs: [], sigs: [], metadata: nil, outputs: [%ExPlasma.Utxo{

amount: 1,
blknum: nil,
currency: "0x2e262d291c2E969fB0849d99D9Ce41e2F137006e",
oindex: nil,
owner: "0x1dF62f291b2E969fB0849d99D9Ce41e2F137006e",
txindex: nil}]

}}

Generate the whole structure

iex> alias ExPlasma.Utxo iex> alias ExPlasma.Transaction.Deposit iex> address = "0x1dF62f291b2E969fB0849d99D9Ce41e2F137006e" iex> currency = "0x2e262d291c2E969fB0849d99D9Ce41e2F137006e" iex> utxo = %Utxo{owner: address, currency: currency, amount: 1} iex> Deposit.new(%{inputs: [], outputs: [utxo]}) {:ok, %ExPlasma.Transaction.Deposit{ inputs: [], sigs: [], metadata: nil, outputs: [%ExPlasma.Utxo{

amount: 1,
blknum: nil,
currency: "0x2e262d291c2E969fB0849d99D9Ce41e2F137006e",
oindex: nil,
owner: "0x1dF62f291b2E969fB0849d99D9Ce41e2F137006e",
txindex: nil}]

}}

Link to this function

output_type()

output_type() :: 1

The associated value for the output type. It's a hard coded value you can find on the contracts

Link to this function

transaction_type()

transaction_type() :: 1

The associated value for the transaction type. It's a hard coded value you can find on the contracts