Skip to content

Commit a4ebb69

Browse files
committed
wasm WIP
1 parent 567f558 commit a4ebb69

File tree

8 files changed

+2171
-391
lines changed

8 files changed

+2171
-391
lines changed

ex/config/runtime.exs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@ config :ama, :work_folder, work_folder
1717
#Envvar.load(Path.join([work_folder, ".env"]))
1818
config :ama, :snapshot_height, (System.get_env("SNAPSHOT_HEIGHT") || "41960861") |> :erlang.binary_to_integer()
1919

20+
# https://snapshots.amadeus.bot/000041960861.zip
2021
# zip -0 -r 000037454455.zip db/
2122
# aws s3 cp --checksum-algorithm=CRC32 --endpoint-url https://20bf2f5d11d26a322e389687896a6601.r2.cloudflarestorage.com 000039434469.zip s3://ama-snapshot
22-
# aria2c -x 2 https://snapshots.amadeus.bot/000039434469.zip
23+
# aria2c -x 2 https://snapshots.amadeus.bot/000041960861.zip
2324

2425
# tar -C /tmp/000037454455 --xform 's@^\./@@' -cf - . | zstd -T0 -1 -o /tmp/000037454455.tar.zst
2526
# zstd -T0 -d --stdout /tmp/000037454455.tar.zst | tar -C /tmp/restore -xf -

ex/lib/misc/testnet.ex

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@ defmodule Testnet do
99
RocksDB.get(key, %{db: db, cf: cf.contractstate})
1010
end
1111

12+
def transfer(to, amount, symbol \\ "AMA") do
13+
key0 = Application.fetch_env!(:ama, :keys) |> Enum.at(0)
14+
to = if byte_size(to) != 48, do: Base58.decode(to), else: to
15+
amount = if is_float(amount) do trunc(amount * 1_000_000_000) else amount end
16+
amount = if is_integer(amount) do :erlang.integer_to_binary(amount) else amount end
17+
Testnet.call(key0.seed, "Coin", "transfer", [to, amount, symbol])
18+
end
19+
1220
def slash_trainer(signer_count \\ 1) do
1321
validators = DB.Chain.validators_for_height(DB.Chain.height()+1)
1422
malicious_pk = List.last(validators)

0 commit comments

Comments
 (0)