@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1702558560 do
Contract.set_type "transfer"
# Burn the non withdrawed tokens
Contract.add_token_transfer to: 0x00000000000000000000000000000000000000000000000000000000000000000000, amount: 0.0995, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1702558560
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Burn the non withdrawed tokens
Contract.add_token_transfer to: 0x00000000000000000000000000000000000000000000000000000000000000000000, amount: 0.0995, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
Contract.set_code ""
end
condition triggered_by: transaction, on: reveal_secret(secret), as: [
content: Crypto.hash(String.to_hex(secret)) == 0x64B3B1AC78F8625C5E5CBAFEC8E59F380EB5B29000DE98BD832B5D3E49EFAABB,
address: (
valid? = false
abi_data = Evm.abi_encode("status()")
tx = [to: "0x5e950eed4d158d2c4a9add1a23cd1ab2924e10e1", 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://sepolia.infura.io/v3/3a7a2dbdbec046a4961550ddf8c7d78a", "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: 0x0000D9E7B4300CC29670CA80010FE23292BEE4AE28057328732A0FF4CF11C319D81A, amount: 0.0992015, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 2.985e-4, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
Contract.set_code ""
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
97AD87B0DB34CA9CE016472B8E3FA81FA92BB05B9EA0101BC84BABAD66D36FB2515AF77ED9C52E50A2CC63177D5522BFA5F436680D5C91CEA5F176DF
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (2)
-
From 00008B95...553DAt 2023-12-14 10:57:03 UTCAmount 0.37392826 UCO
-
From 00005084...8488At 2023-12-14 10:56:56 UTCAmount 0.0995 00003DF6...73B4
Previous public key
00013C4267CD3C780F0CD89C0CEDF4195FADD718772BB374AB9E6D10E9C720CD3F58
Previous signature
0A1FB9E8D93547E45AAB8591F2F07FE07640441AB12EE00D34DC78634B001ED22E07067418F5E6E8F4E904E93250B6FA58C5F476328073D077AA8658E1A03606
Origin signature
3044022054E2D40172F321583ADE8124C3776CAA17DC4FA283802CA83E29BCF03378A49C02204625A87448B0D13BB55C7BD6FBA66D5946A7B36A78CF0D68482A16A8A5C8C3AF
Proof of work
010104228ED9FE757FA46CEDCAE4E3FDDEC1EF6511A71B15E5611AA36EA41DFB969EF2FB83D72D13AD1E89873CD4EFF1364880B3557D72AE5188EF5E1BD09253CE235A
Proof of integrity
00E286427EAFC0727376EE638AF55C0036201286CE69F83199F44E01FE6E25299B
Coordinator signature
7CBB47F3F8E655A5929D147510EAB979D521A00076EA65FA45945459D0EB1044A575673530B2D2D30271F47A48DA45E9F4498E88C090552A4B2FBA351A4A1204
Validator #1 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #1 signature
7E75FAB8D9A9DE54A568F34E114154EAB4E344C41C8B38AB0EF601394BC1D1228D9353BA74F224758B0E72E2F06C644A83A874BA584CB3F429F7118B4D72720C