@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1699999200 do
Contract.set_type "transfer"
# Send back UCO to bridge pool
Contract.add_uco_transfer to: 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801, amount: 497.5
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1699999200
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back UCO to bridge pool
Contract.add_uco_transfer to: 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801, amount: 497.5
Contract.set_code ""
end
condition triggered_by: transaction, on: reveal_secret(secret), as: [
content: Crypto.hash(String.to_hex(secret)) == 0xE31FB86821E557827F947325C2FE0C3A805E44C9DC1B3E03655D66865E52FDCB,
address: (
valid? = false
abi_data = Evm.abi_encode("status()")
tx = [to: "0x49d2b831beaf51218e3a0839124e0e13006817b2", 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_uco_transfer to: 0x00001675BECDA24450FAD82114A15B58567979E8E7AEA1CFFC54CE8C1779513EA2AF, amount: 496.0075
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 1.4925
Contract.set_code ""
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
B08076087E122F17CACECC1EA57E4627522A1FCBB50EE0A7555DF8F3D1A7C77FD0A5C0633FE2747375A39AE43F6F14BF7D7B8B0500078798985F5164
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000960D...35BEAt 2023-11-14 20:05:57 UTCAmount 497.71593118 UCO
Previous public key
0001C2B15C6D30DB7F97A607A413334482831214474745F8A39E79B52B3D42EECA05
Previous signature
6FB5E36565A35B1674A99A39B8387C2211E715F1B05674D48AED092EC7342870A40738D14F9A2E769EBB22F10958E733AEC4533698AB05D543D5D7BEC2D2DE0B
Origin signature
3046022100EA4236A556E91AC0E3275844EB5B352CC50188084B5DF1132D18C4726B7BE052022100F2ABCFC0F6ACE41C91B511A2688BCA116A1908369A07F92314DED21B54403BD5
Proof of work
010204B3B2A53580086B9F36919CF40ABC55904729F78BF43673E216FAC1EB2451DD1E521879C6588F0CB09B150A103A39A73E2816B5ADF51F0721348BA3A66C33023B
Proof of integrity
00541E1550BFED4D3218D990492A5E5579E51912B310B13E86D4BD0020F69C06FB
Coordinator signature
82E442F9EC7D8D920EC0764E09B860B3BCB78C54BBEC1D0B8705A8A74565555D146573995FD562D4ABC0612A8F79A0EBF3C9921305E1B14631FE78BB8FF14605
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
A868C69B8E13273DCD4798EACC2D547E15F9A0A2FD2733346197F1272319999158C58F17934F80049AB9ABF6FF56359C7472FEF0410DDCB6A5561459E41F6709
Validator #2 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #2 signature
F67400034B3A1A0C010A562DAC46E75BF1F3D4917CD3F24B09632BB25FD96CEC87C699B7BE05FB5403150CA7C48D8E53E9952ADB62CB1A5D2C14D568C918C809