Type
CONTRACT
Validation date
2023-11-08 14:34:51 UTC
Fee
0 UCO

Code (937 B)

  @version 1

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

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

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

    A79BE7F8D2FFDAE80406A1EA395452917FE39B851232CEACBA73BDEE56E7C180A8877D315ABE2BAF284F2C6FA32DF73038085339E9136BED51FFD870

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001733E68E11B9CC97A0A3D5BF37326A960F1BBDEE4F4BC2F7044E6048C4B25E919

Previous signature

9D57EF8A2B22EDA178C75E3B3C1DED613C1D10E69577A2CAEC3FC2B9ED720EF0F05EEDA73D367D30D4D14231F3A0A68CD572F7A0F464B4581880C2BC6C591A00

Origin signature

3045022100AAC7769B77D8912277D9E0A04C02EC307ACCB8E2163D53BC21D02D4FAFACAF6E022049B2451B05471316312D911EA3EC76280BCDE783657F739729FE3A405592A611

Proof of work

010204892A04DBE05192BCB662689E7E19700F3F7202028EF0A9F20635C4948436ED85A43BA3017281EE97781342DD8F24ED6F583B5FE542830FDB5191A11843A72A61

Proof of integrity

00F6F14D51D54B58D03A377792ECE9E29D72544D88A74E1169A13619377EE4D5A5

Coordinator signature

53B6F30BFEF4001EBCC01085561BEEC0435EA4EBA32721F663C1E74046407F9B5AFD9649ABBEBB29F41739D9530F07FB02A425B5F2884C38C57C13816D0BEF09

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

0D3450E1A320DC3882B61DC85B7132F06ABBA06AF2035C34D2229DF99554912884A1358B9821AA2E7503819F3F908CD7A9C412BC8A3621A48FBD847952E8740F

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

C6FFD636C27C92DF5310B0D16D646172580E53F4C28CB4709326B8C106EF2C04FF8798272B6E32ABDC1DA437E6F4AEF64C393BB1A83CDFFAEFEB00C5BB555E0C