@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1701361920 do
Contract.set_type "transfer"
# Burn the non withdrawed tokens
Contract.add_token_transfer to: 0x00000000000000000000000000000000000000000000000000000000000000000000, amount: 0.995, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1701361920
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Burn the non withdrawed tokens
Contract.add_token_transfer to: 0x00000000000000000000000000000000000000000000000000000000000000000000, amount: 0.995, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
Contract.set_code ""
end
condition triggered_by: transaction, on: reveal_secret(secret), as: [
content: Crypto.hash(String.to_hex(secret)) == 0x13A842CB41EA8718FA1CB2C2D2A492820FEA18847BE2C6E94FEDD24146825B63,
address: (
valid? = false
abi_data = Evm.abi_encode("status()")
tx = [to: "0xff17f491bed126b01c6aec09dff12ff208f821e2", 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: 0x0000890DA42FE7496C403EEB60544295F0B985A7EEDEE14C256333A2294AD0895700, amount: 0.992015, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.002985, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
Contract.set_code ""
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
38CFE168D9EB1196A86F861874D01FB7EA2B27730DDE11795492482A15C22080FCC72A0253E9C44F12668FCEC18C39CF85C28BB2A1E9CE053ABC7300
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (2)
-
From 0000E485...0648At 2023-11-30 14:33:33 UTCAmount 0.36255356 UCO
-
From 0000AF60...940FAt 2023-11-30 14:33:27 UTCAmount 0.995 00001A4A...01F1
Previous public key
00017EEEA57DD6BA4B479D135DE8F8DCB1EAF2ADF6671CB67DD0E9986F0745123630
Previous signature
D6CBF35286AB376072F3C060E6BA83735717CBC4D5E56F8134FBDAA8C724A71704B9D135FEEED7C37080E3B86F89A39B4BD205D6E2AADA04EBE42C006803960E
Origin signature
3045022100D64453DA98F1AC1A97688CDE19A1FD67235400382BD81AB3020AD124C170E93D0220314F7BE142E8E437F1C816B07B1063196A114DC05B79C23F36CE20CE6A099A21
Proof of work
010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765
Proof of integrity
0053BB80929B01E9E2C98F4BA03E18234988EE8C3A009DA4F65E16E2364F071279
Coordinator signature
4E3FCCE7D1EB6D44705042CD2ECBB9B644D544A2F8A51E991363226F379AC45DA09792200A3776D0DB98672A227985977D75AADECA5745876F94D4CCDDF6AB04
Validator #1 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #1 signature
1A6FD89C58E3E6BDFB87DBC25CBF82501F89A6836272B3BE702E6C0EF9DC404B34D698770C76191E381DA564F4606B523091A8CF6B5A8DF3D113891573EDA40D
Validator #2 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #2 signature
7973D715DD81402EB780DABE83D75290E05C8563E0BE5953F99C6274816821961C789B2315D59A8EBB9A8A3E59C12FBA0225C24A64AEBAE3655F2F9D31893300