Skip to content

Commit

Permalink
Set supply as big int
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuel committed Jun 23, 2022
1 parent 6ec2882 commit 2dc35ed
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,18 @@ defmodule Archethic.TransactionChain.Transaction.ValidationStamp.LedgerOperation
...> %Transaction{
...> address: "@Token2",
...> type: :token,
...> data: %TransactionData{content: "{\"supply\": 10, \"type\": \"fungible\" }"}
...> data: %TransactionData{content: "{\"supply\": 1000000000, \"type\": \"fungible\" }"}
...> }
...> )
%LedgerOperations{
unspent_outputs: [%UnspentOutput{from: "@Token2", amount: 1_000_000_000, type: {:token, "@Token2", 0}}]
unspent_outputs: [%UnspentOutput{from: "@Token2", amount: 1000000000, type: {:token, "@Token2", 0}}]
}
iex> LedgerOperations.from_transaction(%LedgerOperations{},
...> %Transaction{
...> address: "@Token2",
...> type: :token,
...> data: %TransactionData{content: "{\"supply\": 10, \"type\": \"non-fungible\", \"properties\": [[],[],[],[],[],[],[],[],[],[]]}"}
...> data: %TransactionData{content: "{\"supply\": 1000000000, \"type\": \"non-fungible\", \"properties\": [[],[],[],[],[],[],[],[],[],[]]}"}
...> }
...> )
%LedgerOperations{
Expand Down Expand Up @@ -99,7 +99,7 @@ defmodule Archethic.TransactionChain.Transaction.ValidationStamp.LedgerOperation
[
%UnspentOutput{
from: address,
amount: supply * @unit_uco,
amount: supply,
type: {:token, address, 0}
}
]
Expand All @@ -109,7 +109,7 @@ defmodule Archethic.TransactionChain.Transaction.ValidationStamp.LedgerOperation
%{"type" => "non-fungible", "supply" => supply, "properties" => properties},
address
)
when length(properties) == supply do
when length(properties) == supply / @unit_uco do
properties
|> Enum.with_index()
|> Enum.map(fn {_item_properties, index} ->
Expand Down
4 changes: 2 additions & 2 deletions test/archethic/mining/pending_transaction_validation_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -324,9 +324,9 @@ defmodule Archethic.Mining.PendingTransactionValidationTest do
%TransactionData{
content:
Jason.encode!(%{
supply: 3,
supply: 300_000_000,
name: "MyToken",
type: "fungible",
type: "non-fungible",
symbol: "MTK",
properties: [
[
Expand Down

0 comments on commit 2dc35ed

Please sign in to comment.