Type
CONTRACT
Validation date
2023-10-31 16:38:41 UTC
Fee
0 UCO

Code (937 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0xe9205e70886d14074d2f5ee911562cf4fd38bea3", 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: 0.992015
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.002985

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    8A0CB78640D063028C8F01883B19AF3FAAEE0E79830FA0F48F5F01EF13E504368B84B45E1D1C3449C278F0B4FEC3B22CBB46D6F4DC94337587B52442

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001AE255B139FDB9B928172D54ECD9FD51B440B1110FCA0DB5AEB631C46C1597F6D

Previous signature

73E0AC7DAAAD7EDB54913D5C6A1D138034CD3D36491E6BD9148679EE53535FA4478BA10F60DE10C059D999CF1381408058CB7FEAC74564223172F5C7275D2909

Origin signature

304502200443AB261169CFE3EAA4E952A50A5A7600DA6BAAAC518BEDB6C9179008A9CCEA0221008B3F355FEEFAAB20E5BD9465651B16D666ED8625F997BEAC88818A58AEBE35BE

Proof of work

010104EB90F7BDD03D5A7FD9B61D9128D7CF24C11F3F7DA96825DA3680C2B6BCC48F1AFCE26E0A5F1A903EDAA4BC9390210A0A4F175847EC2A2BB325BB6D1CE8EC8F90

Proof of integrity

00A92A310624A1FD5A15DBAFD15350DCA9149291D3CE22D16A53C80BA4DF8D5968

Coordinator signature

952AE06AD7B09DE572BB926D891E6463F1C5AD7A119F1A033E83EB61C8E50D84BD1A6073EE67AC4100F3F7E0C4565421BA01269B20DF11D4AAFADF21FAE3A109

Validator #1 public key

00011ED0B570D680BE5ECD58D2D121689DA73C46DCB38A01C6E10D06286040ADE30A

Validator #1 signature

1ACCCDC6F3C076CDE748158EC807A753671F923194C3608F3600F9DCABA95BA3A152C621B371E93CAEA04CDCBED4AB1419343CC73EFE157D6C2B03E2EDAA2300

Validator #2 public key

0001500FBE298B79FFBDD5CCA1798F30FD88A53D26EC39DE5DDE1F4137B032A4BC34

Validator #2 signature

E05D32160920603C2EB5549A516EE781AF45C7C0DA2AB40AB17DABEFF6304BE8F3D23971F0E0B566F03ABB2969F10F85015D9F6F0974E2E6F75956E9F97F7B0B