@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1700814240 do
Contract.set_type "transfer"
# Burn the non withdrawed tokens
Contract.add_token_transfer to: 0x00000000000000000000000000000000000000000000000000000000000000000000, amount: 0.0995, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1700814240
]
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: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
Contract.set_code ""
end
condition triggered_by: transaction, on: reveal_secret(secret), as: [
content: Crypto.hash(String.to_hex(secret)) == 0xC56086B0CD9A2D296477D03E450B9F07C539FBF9014E3F78D4E8FB31B28493AF,
address: (
valid? = false
abi_data = Evm.abi_encode("status()")
tx = [to: "0x0ed12369a45e96a02b9d94db5f649d217c9e581b", 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://polygon-mumbai.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: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 2.985e-4, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
Contract.set_code ""
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
EE5171DDA491B8DCB46FACA6FC9F9335A18991C82CAD191ECD2D15251F801A5B1411EB42C39BD6F7F943AF22E428B8C1032B4972C72CBE01AF9BF518
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (2)
-
From 00002FFA...33F5At 2023-11-24 06:30:02 UTCAmount 0.32272355 UCO
-
From 00004037...A27EAt 2023-11-24 06:29:58 UTCAmount 0.0995 00001A4A...01F1
Previous public key
0001846B7EF6AA472D2A5EC412E43844514F9D5448B73226BEFD8B40895BA5E43C7E
Previous signature
89FF256EA2797C2887AF489A1ADDEC88A2B684FE983BCFC32C3AF7B0A117E13076D5C682779D12C3CC2A6B8845D0AD260F57C17839168AC8F6366BE52A955405
Origin signature
3045022100F6BF42EA717C561D95E527BDB530F9EE12FE9971470582C71932520799A6101802205BDBFD3DF81CC6F57C88924B65C2A2D3D59DFC50B807F30553056F2EC908726B
Proof of work
01020451684966573439C38DA99334546FBBDE4A6D96A50B4A4ECBB6572CDBED023F079607407E254421D1779525D11C60D55684F0B403B93B95823554E29D1E2CDB16
Proof of integrity
0064FBAC804AEFA354388BCB3C6A3893E30BEBE0527287C1BB4913FF4F15A659A8
Coordinator signature
342751F295C033094C614B525ED5313AE20D91D47860EC0EE2AC750508310751C48639AEB1E6F137C9068DC73692578F76B656DAE234E79495907AB37B3BFC0D
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
6B7258465C2A7E0364BBFF254FE2F434B7B316AFBB5521BC1B2FE38E1581FB6B0E6BB6DE5920E5D55498853636B416495DD12DF4C537BEFAD7C5F2CEAB154200
Validator #2 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #2 signature
5C54730CFC78D674EC72CD056374DAFA624EF3BCE953AEB88ABDF2B1DD0E39B82D55DF274F4E20567186354145FCA36B889C266E78549AEDDF26259974FA3003