Type
CONTRACT
Validation date
2023-11-21 17:12:21 UTC
Fee
0 UCO

Code (928 B)

  @version 1

# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1700593860 do
  Contract.set_type "transfer"
  # Send back UCO to bridge pool
Contract.add_uco_transfer to: 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801, amount: 9.95

  Contract.set_code ""
end

condition triggered_by: transaction, on: refund(), as: [
  timestamp: timestamp >= 1700593860
]

actions triggered_by: transaction, on: refund() do
  Contract.set_type "transfer"
  # Send back UCO to bridge pool
Contract.add_uco_transfer to: 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801, amount: 9.95

  Contract.set_code ""
end

condition triggered_by: transaction, on: reveal_secret(secret), as: [
  content: Crypto.hash(String.to_hex(secret)) == 0x5A747D7C01A222ADE32A7956BF0F88D019E29B8D7BDF13F39C7EA82E965A300E,
  address: (
    valid? = false

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0x8728700d9343028a0f9309ec5509b5c93c11e89d", 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_uco_transfer to: 0x00000BC0EBA2DBCE4455B46F5E51AFAABA6EB4C7FBA1D4E2E6DABD55DC70F9A04D6F, amount: 9.92015
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.02985

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    6839826287D5F8F71553643884D47870358B3A031DE5C4A0155D2F288F6567CCEE997D82DEEAD94CB289ABE9720D89C257197685FD1AA421303FC876

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

000120A90CD1938DC4D6B07CA5D3C33B59AADB2C81B7807EBC43DDF201E6D059278B

Previous signature

7EA92C6C46D21AA74825E3A69FBEE63871FF0EA27BCA9B01D649510D35A98735D014644593628BB61F5EDAE8A10A8041EDBBE0D03A633EF164337EBCE724D103

Origin signature

3046022100FD5DC57E4A8E188CC2F87B41F6D38C30516996C1ABC9E41678C07A9C30C835E2022100F749A9D1D1754142F28E5C9BEDE1E8880EEDCFE1CB7F3367799BB322FAD13F2E

Proof of work

010204B3B2A53580086B9F36919CF40ABC55904729F78BF43673E216FAC1EB2451DD1E521879C6588F0CB09B150A103A39A73E2816B5ADF51F0721348BA3A66C33023B

Proof of integrity

003ABB6A48E1AEA1D794A9A128DDC890BAF2C46E63EAD7904B9F6E0A6BE4A73E40

Coordinator signature

54EE15C047633805D10E9B16DFDE226B29E6011E4E4F940236DF5E030B8F4EDF2DB8E467437D1654928B670E1F7DBF368926E3DCFDD1FC7E9A935227CA1AA502

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

A071ACE810E2B9F66DFEFD537D8489A3067EC9EF63B3867D65044BE9FB186C4901072AC8D5E62B15674242D9197141F905D1287165949CFDFE29513DD0C4E10E

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

3FACE25EF7C840B6D6CFB8FCF4192119CDDA87BC1F9A9307D7251490E0D006FB859195E444E1E8002668E42810EF47452EA7459779BED82F3AAE46CAC22FC50A