Type
CONTRACT
Validation date
2023-10-30 13:13:03 UTC
Fee
0 UCO

Code (940 B)

  @version 1

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

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

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

    F8174D9EC868E5C3615BF4EC1C83B49FE3870170644FF6478CE949D1EC4C11EA5ECA3F06A7C710D93B73EF4836C628D791F822FA09F36DD426B6B5D8

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

000131CCFD02C9D753025E107420B35485EFDEFAB1FD488C36CD300025F50D2EE5B6

Previous signature

6C1637859D3079352ADF09F19CF5BD1AB6B2A13E315812B445B83D25CA44828F7B967D2552C8A9627A8C387E0FACBC085522A92A2A30D370EBC348FBA503220D

Origin signature

304502202696C8FCA276E71865DBD77AC3C86EB588D7285DE0595A0497FB66C75B18FA1202210099E0DC20D6F0FCBB01F42DDFBDC6E83F4C53AC1CCDC3A062EE76AAC69FA9EAE5

Proof of work

010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765

Proof of integrity

001E11956610A0C31F6404D97FEF5931783DEE816BBFC0D373B0752105D1CD9C3A

Coordinator signature

3E14F5602EEC5719163F423F4CBC28FE7881834EB7D6121392BAA87AF515996883D8AF8F95CE931FEC7185EF69F47BABDE6CE61A2F04755C523AC5A97DE34905

Validator #1 public key

0001500FBE298B79FFBDD5CCA1798F30FD88A53D26EC39DE5DDE1F4137B032A4BC34

Validator #1 signature

B653015F4F56368CF08847CB22B8A543588768CE6BF92EAE2B979728D4EBF6C2A51FA07AB93065D918757A640FB2C156732D20951868A99C261C819B4C32DD08

Validator #2 public key

00011ED0B570D680BE5ECD58D2D121689DA73C46DCB38A01C6E10D06286040ADE30A

Validator #2 signature

5B7877093A2ACDDAB8AA8A50BAAF9511B767B78CE0B12221DDE70342F78A3F39EBDF5C46A6A2C96B494396F17B8FACDAB23264DB272FED8612F5F62812A98E05