@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1701554700 do
Contract.set_type "transfer"
# Burn the non withdrawed tokens
Contract.add_token_transfer to: 0x00000000000000000000000000000000000000000000000000000000000000000000, amount: 0.0398, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1701554700
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Burn the non withdrawed tokens
Contract.add_token_transfer to: 0x00000000000000000000000000000000000000000000000000000000000000000000, amount: 0.0398, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.set_code ""
end
condition triggered_by: transaction, on: reveal_secret(secret), as: [
content: Crypto.hash(String.to_hex(secret)) == 0xE2A5EDE7C01884701E6A220E87E5B4200F830188E2763499AE7395D7AB649D95,
address: (
valid? = false
abi_data = Evm.abi_encode("status()")
tx = [to: "0xa8c661fc4e77cb6878033d39e46803c6c8cb0ee8", data: "0x#{abi_data}"]
request = [jsonrpc: "2.0", id: "1", method: "eth_call", params: [tx, "latest"]]
headers = ["Content-Type": "application/json"]
body = Json.to_string(request)
res = Http.request("https://data-seed-prebsc-1-s2.bnbchain.org:8545", "POST", headers, body)
if res.status == 200 && Json.is_valid?(res.body) do
response = Json.parse(res.body)
result = Map.get(response, "result")
if result != nil do
decoded_abi = Evm.abi_decode("(uint)", result)
# Withdrawn status is 1
valid? = List.at(decoded_abi, 0) == 1
end
end
valid?
)
]
actions triggered_by: transaction, on: reveal_secret(secret) do
Contract.set_type "transfer"
Contract.add_token_transfer to: 0x0000064F114419DD1BA0B495E4B596513A180BCC4F58643496F0919DCC3B6313BEA1, amount: 0.0396806, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 1.194e-4, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.set_code ""
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
AB3893CBDFB666BE3C13D47FBFF927E879579058C5D50DF86ACCDD91D88E3B9CD0130376033DA4AF6B21479F592851B63F8A8BA8BFBC90983BC1ACA5
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (2)
-
From 00009A6F...F991At 2023-12-02 20:05:57 UTCAmount 0.35610017 UCO
-
From 0000C495...36A5At 2023-12-02 20:05:49 UTCAmount 0.0398 0000288B...B827
Previous public key
0001B48F3B4E058EC607A3D4C5CC73E4766506921541FD697C75A7BD98757ACC30A1
Previous signature
580BEB158E9A0893CB3C93A448512CAB17B50DD175DE84D334A05457EC80095C0C7C630A563DEB4B1CDB04E5B2BE097339245444F08BD75FFEE3D7316E601B05
Origin signature
3045022043374F055D0BF87CCB31F4162981A3C73BC946B688289B90A9C7EC39B54104C0022100DEE0E66CF97830E059E462D61F91AD6F2CA72BD7DB75F02FE78D97E23A878358
Proof of work
010204892A04DBE05192BCB662689E7E19700F3F7202028EF0A9F20635C4948436ED85A43BA3017281EE97781342DD8F24ED6F583B5FE542830FDB5191A11843A72A61
Proof of integrity
0070862CA923D250ADAF63E77D5167762F20DB7C778018BE6865F1D83942C1EB4D
Coordinator signature
23BCC7A025087BCFC4B9839FBE5F2253EA3FD814EA9B8A0226E688F01ECE22096DA93298BED9B2C726FF029924921C7853D648182948F04DA21E4BAAF2CE660B
Validator #1 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #1 signature
597182B94AADA9D10EF61D8D4F32AA70A32F04A2993E555DDF4CB07EB57BBCA3472390E5088EEC360170396441A9E1419EFDBFDB50667639F7EBE9BF77B0C50B
Validator #2 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #2 signature
E9F4C744E8418D4385E73B1895E8FE401992033B548AA504A484CA85C2D09D8B3665161FF5478D043401F7E06C1F392DC7AEB3B678C80B427DBCE352723AA60F