@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1706380440 do
Contract.set_type "transfer"
# Burn the non withdrawed tokens
Contract.add_token_transfer to: 0x00000000000000000000000000000000000000000000000000000000000000000000, amount: 0.00995, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1706380440
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Burn the non withdrawed tokens
Contract.add_token_transfer to: 0x00000000000000000000000000000000000000000000000000000000000000000000, amount: 0.00995, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
Contract.set_code ""
end
condition triggered_by: transaction, on: reveal_secret(secret), as: [
content: Crypto.hash(String.to_hex(secret)) == 0xCDF85BE1E7CA1CA1A98C3229A2981F29ECEAF32DD27BB460F2C4581FBA9E4187,
address: (
valid? = false
abi_data = Evm.abi_encode("status()")
tx = [to: "0xba59dc406d336d2a7834beee37ebdc0ddf37cec0", 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: 0x00000958DE1AC1DF79B441CCBBD0CA8E3BF6ED846175740A8D735CDA5977C5ED0093, amount: 0.00992015, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 2.985e-5, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
Contract.set_code ""
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
CE2C6BB47782AE04D441E3CDE27DDE78A7390A1CE965C8F8822351482481458E624DDC56F61B3218AC095FA7134D2818E35EBEFDC7B12CDFD0BFA65C
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (2)
-
From 000030B4...1417At 2024-01-27 16:41:29 UTCAmount 0.34880405 UCO
-
From 0000CB9B...2314At 2024-01-27 16:41:19 UTCAmount 0.00995 00003DF6...73B4
Previous public key
0001F40E6BDF56C2423334BD374FE46B8A083D74A3E40571B9B4ECE22556FE1CC6B9
Previous signature
A34532F03429B46B7C7D50E5D8F3ED2A5E3ADD3D78F84AB335B4E9DBAA835CCD9323DBDCEF3C043D0C4224755BED5C698B7A5B17213952198806C5AAFC9CA20C
Origin signature
30440220210D943109B1DBFC13C2A55BA1F03FF77AA050878343FBCEE79AB56547FD754502201BA01DED53FEC313E591BD92B9AF32C185CA3AEED83ADE2F1F39D70399CAFBCA
Proof of work
0101046C39D56B717142B6EE14B0F8B2561ECA458F3D2D12C9977D613F78829419063211F9C21F7BB0D56B6523040A8156BE22B6E9D6332B88ED882574D12AE32F7A45
Proof of integrity
000E7163455A8547FA532D1C7B3099C7023FF4A8DE445EFDBD0621D8CDE0AF6AE4
Coordinator signature
CE75C32D7F016637685147BD0D49D47E7A6192033A74C0D045B33B72C663753CEA2A2674B7FE412544317C7922891451C2A7BAB5C3DB541EA0CB369B31195F0E
Validator #1 public key
0001B01EEF96BA7E95FC844D456CE8868F18864519FC9532E1751C2035FD044DD5D0
Validator #1 signature
6B54D9DB2FE45EA8ED83EEC0A7E16C4166EFE629D0E39F1A7499D0947E123C6E5F3B5A2D3401C61259B22454FBF2D373FEDFB6DEBAD4D5DDCFB0C5CE05D2E607
Validator #2 public key
00011ED0B570D680BE5ECD58D2D121689DA73C46DCB38A01C6E10D06286040ADE30A
Validator #2 signature
86E2244F047959E3E82FEECB1BAFAC05D143A2843152274A9A628194952739E88EA59529F13BFCAA502F736505858011491506D1AA91A7E2BA681A55F4B7680E