Type
CONTRACT
Validation date
2023-10-25 15:13:05 UTC
Fee
0 UCO

Code (928 B)

  @version 1

# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1698253920 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 >= 1698253920
]

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)) == 0x3F98E22CEEC8FB8E459B8FFBEBBB13D21CB399CD9A373D85F20886D1B6763FB0,
  address: (
    valid? = false

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0x3067a6bb8c09d23c22114b86d64e5687894116cc", 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: 0x00008DD40CD42287A3C8282065F5BCA7259AC7014CD73109B570E946A977687C7BD0, 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

    AA68595E0FAB3B5F5ED23F6CCFF0E305D313CF522E5F2210E634255B3A64E19352337B46B7A8DA09A7590B90D9511CDF42CDC1C517F316B03A4F56E2

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001A841799A77E41D610E127F1246BF3EA72BE3606B416850993C3EACC4A0BF3098

Previous signature

143392AF178FA0127B957FB10191352E9C6F84FC6CF7056CE0595261502E429BF8A96CEB776DF9E1D482E99CB22825CF38F6C5C737F688188B0A3B48F5257A02

Origin signature

3045022100BCF2507D60901DE2F647FA25176719CB7132FD83D35234585000F5C9606A36D602205E7F6393872246E059631FDB70DBBCC5CDF7273BD19444DE4D70E15CF13C0D1A

Proof of work

010104EB90F7BDD03D5A7FD9B61D9128D7CF24C11F3F7DA96825DA3680C2B6BCC48F1AFCE26E0A5F1A903EDAA4BC9390210A0A4F175847EC2A2BB325BB6D1CE8EC8F90

Proof of integrity

00B9C83E0CBF7859FA9A8445F8219AE0B13047EB867C1175A7AEDEF80D1F53E9BB

Coordinator signature

FC586EE9B19ED445688774E31B3D21466514AE712132B575B9428A1600912B2C9914896C834381C63F2407F5272539A0AC1EC57917C9410AF2C121ABFEB1930A

Validator #1 public key

0001500FBE298B79FFBDD5CCA1798F30FD88A53D26EC39DE5DDE1F4137B032A4BC34

Validator #1 signature

808DDFF834DC5FC9226F2066BD7C51CF872D3CBBA2B90CD46CCDA5C9DC34278292458A564E634773C91202E93AAC010A1A387927D8A34B86353DFD0C0D785907

Validator #2 public key

00018A312AFA617E98B343D09AD2E73F0AB661DB0A59FB986D5DB8CE7664E14C25FC

Validator #2 signature

BE6E4456F3233570013E88398A399B0BB21897264F6BF3A7705A82AC2D44E11F301A1F69105ADC4D31BB1310DB14A6BD25894BCD75138FFF2B8FD91B8260E805