@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1701290520 do
Contract.set_type "transfer"
# Send back UCO to bridge pool
Contract.add_uco_transfer to: 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801, amount: 14477.25
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1701290520
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back UCO to bridge pool
Contract.add_uco_transfer to: 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801, amount: 14477.25
Contract.set_code ""
end
condition triggered_by: transaction, on: reveal_secret(secret), as: [
content: Crypto.hash(String.to_hex(secret)) == 0x6399AB9EBA51617BD1E1DA45F45FE14FA5B2220B5101F60CF13A6FCD8E5C52FC,
address: (
valid? = false
abi_data = Evm.abi_encode("status()")
tx = [to: "0x2e9de86889425c3344343adbca66561ef3e8d66d", 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: 0x000024EFC168359BBE0ABF897270CBFABBFF5784622EA02A463BA2EAF7C5219EAFD7, amount: 14433.81825
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 43.43175
Contract.set_code ""
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
99C268498421ADFFDA6242677864A84A657E8887C3B1E865CA566F41B5613F81CABF60AA13F25DCDA2D97218FA2CCD505E062076C010A77F246A5466
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 00001228...70A3At 2023-11-29 18:43:03 UTCAmount 14,477.50477093 UCO
Previous public key
000166997D02990276FDB4FF63B47108A97A755A1CD170443D7E570C4A88F3EB79DE
Previous signature
E7CFDF8FB770874D0FFF47E4959BB1187523FB1D15F0C33D2D3642BC4AE5F836F659587D20CF2F14BF49A81D0D97CAD3ED9D21E169434D1EF92789385272AB02
Origin signature
3045022100EB1B76860FAFBDD6F246A9411939BE2B2A91021474B21B57404BEEED279B4173022002DD0F8E2CCEA901E1A2F7EFEF1D6A18C7122516807A752F3849344EB7D2B5EE
Proof of work
010204E9BB401A767B0C92D5DB139379AAB18E1B449B455F49E3A44F3466B2D38E59F0516B79493A528A95E5A74CF46F79CF12DEB73293458F6A4403D2B3E57D697347
Proof of integrity
00BD269C64794272AE9ADB682AB20B07AA79F10CBD7451FD56A4E0801BC8B6D968
Coordinator signature
C159FB88024D45D854E4A17E6CA8118CC6BF630B4956B190D12AA6C92C372627332BDE43F156E0035F8F03AFB26B58339258537673A049CA3A65FC8AF4A02B03
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
5DB285D6757FBCC5FBC29C57AB52D16CEAC9EF2753B5B01EDD282DE6298BF1B3CC397932692BDBF11E18228FEAB591EB24B02DD947216BC96B81F22142E0E10E
Validator #2 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #2 signature
D968C8A6800A4725BC1F62F9041E082B249136BE6771E48C8D29B7FE0568C72BB5BB4A477EE9647F42973942EE88F7D98DAA686FAD58919DE2A57FFDA172B807