Type
CONTRACT
Validation date
2023-10-27 12:32:29 UTC
Fee
0 UCO

Code (924 B)

  @version 1

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

  Contract.set_code ""
end

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

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.95e-4

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0x2e82864369ec389e52879e42bd22364c59dea00f", 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://data-seed-prebsc-1-s2.bnbchain.org:8545", "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: 0x00008DD40CD42287A3C8282065F5BCA7259AC7014CD73109B570E946A977687C7BD0, amount: 9.9202e-4
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 2.98e-6

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    F8BCC5571C540E9BDC5A8E6E44E9BA805D9AB29867E0AEC766882ECD152F9AA49327AF0091797113860BBCA002BC7E2A143B5CD781F391C404D69D25

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001ED69FABDD09C37C8B8992B2B5243C754A32D645956D638D69C8C755662613AC1

Previous signature

C1FD6E5DFE6FE60F384568048F70E3D7F37D879BD6337629F7B237503027F32CA7750A0808EAAC92A702D52E9AFA1492D1C614AA70E489FF9A996C1A5F24A605

Origin signature

30450220551F4CF252981B50EC58296E4D19FC635DDF522F9004162484DF0E26A7382DF3022100D423812D95FB64BB51FBA69CCF37CE8CC6055520237AE7C60455C3734DC91080

Proof of work

010204E9BB401A767B0C92D5DB139379AAB18E1B449B455F49E3A44F3466B2D38E59F0516B79493A528A95E5A74CF46F79CF12DEB73293458F6A4403D2B3E57D697347

Proof of integrity

00E4FCBA28E4D1242F1A317D32B7F03ED3D09B970525986995C0D232663868646D

Coordinator signature

2CCB3AE4025087D7B6AC3C1348B30B103EC286991A234299E8FA025081AA73A07FCCB97279264144C588855381D371EF91FC7C44F82916049C71C24BB7AB7E00

Validator #1 public key

0001500FBE298B79FFBDD5CCA1798F30FD88A53D26EC39DE5DDE1F4137B032A4BC34

Validator #1 signature

378ED8D6EDEE69C685F3CAE0EDCA8B9DB893E16BB36147CA31C81C907036099C04DF1049DCA7CDFAFE614F2E1EF302603CD5185DC73A9AC2F8E8721F1091630C

Validator #2 public key

00011ED0B570D680BE5ECD58D2D121689DA73C46DCB38A01C6E10D06286040ADE30A

Validator #2 signature

68F9A7F6BD1EEFA32A77CB988B54624F92E879937BBADAE70EBA60AD0B62A227B5AD37CF81E0DEC141786BB9BDF3AB3CEEAA708FA2116E903350C299C8EBD503