@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1700221920 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 >= 1700221920
]
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)) == 0x636529BAAD71F4A069E18038DC90E9D1438B999877BA55A8BA4AD2CB0AC138E0,
address: (
valid? = false
abi_data = Evm.abi_encode("status()")
tx = [to: "0x5b3c81ef4b90ad31ee3d22fa39d7edf23ca55955", 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: 0x00008D5D4054C44E2D545884BD557D7E1CEA9B3669EB223C11CDADD6D99A1334F9F8, 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
A9402C329892BC4F689911E41E2D371AF6B2B35BF63E1F7E83AD55381E238636F502E15DFED819532B6BA697DC02A76332584395B4F7C2EE7B388C4C
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (2)
-
From 00000EB9...E44DAt 2023-11-17 09:53:18 UTCAmount 0.3150346 UCO
-
From 00008BBD...FAA3At 2023-11-17 09:53:13 UTCAmount 0.0995 00003DF6...73B4
Previous public key
000116BC4DBC6CE103F01EEDDE00641332460B0C3E735A577254DFC6BDF14516AC4C
Previous signature
ECA3CCA2E4A94349CFCAF67AAB971BCF1219309DEC41B04BF51765F41E24B34135E873B548381CD6D71891BDC91147ADD594CB6A0740A6E374F8AFC56627600F
Origin signature
3045022100D882DF338F7462C4577C93B80EC9D1F72C56E58A6706FF557B2227C3CDDFF64D02206635AA1414290C6506C7F4F9C2FD8FE9481534E0DB70542F024B08E11D991FB0
Proof of work
010204D6052E0C6CA9244CDE5F3D664296BDFBA0090B330404C3C16B098758F27965DFEC0D3F25D1365F389C2B6C516195552F8779DEE0796C8C33F1A9C0404F4E3381
Proof of integrity
00397A473DD310EA4611B51CB56A228AADE5617792D92BF8EFAC2015889CD4B318
Coordinator signature
3D8AD98A959915850E2EED2D4E4D1C7446EFE30E76BC0E560CC7B96E6CF4476F74D05ECC4D9E988FF557BB8D2DCE0F18A68BC252FA37AC1E6B17873C80BD6F07
Validator #1 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #1 signature
3711C1E745647F0C3A4CA03AF355DB2C752BF57F9775832AD9D94F68684FB03E2077AAC7DC6EBC17139D0678A9AAD141C07CE51AD7E3376992A7C87B3B3ED104
Validator #2 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #2 signature
6F479013F6A420A7CD9CAC616A1CBCA78ACF98FAF9E2600C845C6DB250FDEB79D57EAE24A9BCA91A332149AE07446BF81BF4CD305BFBE60D28CA42295EFB530B