@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1702143960 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 >= 1702143960
]
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)) == 0x8F57142FCC312A06B3323B3FAA354909B00975895AE5E212411B07325E7F64F3,
address: (
valid? = false
abi_data = Evm.abi_encode("status()")
tx = [to: "0x41a96f1c32d118bc801ff47945531c56810d3e24", 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: 0x000066062AE51C8EDDB115B895B4917CF9A25F20A0CDAEEDCFC62085AB197F6B48FC, 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
87C6F127AA61812AECC3E525E4D7E849D48BA333BD1FA31939BD964F973A8E938883497008866137573F5800726E14A256694327F524FD00DA23C42D
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (2)
-
From 00008F21...BFB3At 2023-12-09 15:47:41 UTCAmount 0.35371037 UCO
-
From 00005807...4AB4At 2023-12-09 15:47:32 UTCAmount 0.0995 00003DF6...73B4
Previous public key
00011803F8A69DD4B35CE6FE49CEB431896E950B038041119016990976B341609BE8
Previous signature
581DEB4FBFEA82B16AAB68C40B7C27FB44756B1AECCB3405728314BC2917D08C7473E1BDA09CD5EF2B2D3D2A0851865ABA1271675DCBEB27A5250DBF4DD69F0E
Origin signature
3045022100D4F77DC1CCA70260F35015EFEDE2DD63CE193DB7C4FF1F4EEC32B50BD3D98553022057DFAF2755028ED84357EDFD5F2530296969B10EA9903F3125CDB654F4ECFF78
Proof of work
010104228ED9FE757FA46CEDCAE4E3FDDEC1EF6511A71B15E5611AA36EA41DFB969EF2FB83D72D13AD1E89873CD4EFF1364880B3557D72AE5188EF5E1BD09253CE235A
Proof of integrity
0009E148FE48E8F5935169103A111C455335A8D32C27D25791DF7B8EF6CCEFBEE7
Coordinator signature
591FA68B95FE68363D75A558E696C74C5A16FF5FBC2D7F89C5D0BC5C5A0FC47123A06D75706161F09C73AEC98A061650C4AEFB4FDBDB072F34254148E3D8F608
Validator #1 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #1 signature
52A4F3AF1E788EBD6BF9D535BD07DE5E5720C7B82546927B26158BD9081F0358E0B87BCDF7CB935AD5692FC94055DFDC6FAAEDDBA2DCACFED62DABED853EF900
Validator #2 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #2 signature
44B248EED9B98163123D766E2336587F4D201AC92F4A64F21AD5CD15564AE2348336A386615A7EF4C78489B48A091EABACB8348FE8E1FD804D3FD9F3D424440F