Type
CONTRACT
Validation date
2023-11-21 16:21:12 UTC
Fee
0 UCO

Code (926 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0x9fc3ac8b0f608ce08dd33c2f9670601c9de04bf0", 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: 0x0000647409F94DE9798EA91E049B9AABA07B8CF3570A22056513B3437091C04B6807, amount: 1.98403
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.00597

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    F6F2C157EFE793894BE44DF99D0A5589563D96938C084EABA8BA806679B24FBD0CAA0823BB973F1A85EB583FAFE68B65527C0E0CB408EC1A3CFD6DDB

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001B741F840A11E79C48475F844123CA1E884CD1E2759824F29D3E94D994719FE92

Previous signature

996609FFE435FCBAF70EBFD890DCB0C7CAF34E97197686CDF980E8C086DF5269202F4EF82A16796B4B405F7A57DDADDFEF5820A1F2854CD153BCBAAD9C6E4E01

Origin signature

30450220629F2EE89C9E3B17A3E8B705C9A17A423BB94F225EA32F1CCA029C1FDAF99F77022100B3D5ADA94F6908AE4A239748ABAA07219F1141D4C0C357D95595475564AD229A

Proof of work

010204892A04DBE05192BCB662689E7E19700F3F7202028EF0A9F20635C4948436ED85A43BA3017281EE97781342DD8F24ED6F583B5FE542830FDB5191A11843A72A61

Proof of integrity

00906769D04BCFFF73B118CFB283B976F9D16F231AC93ECEB6CC61232772C597E1

Coordinator signature

C76B476E50A8C8E82691AECAD03E6192567703F328C109AE9EBC88FDCE38989D75B384F734FD413076A17178F6CB5BF5F0144850A8EE31570647F8EC5C51AB0D

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

8FCB8331D1BE91EB6C1C22A1FA0F78EDF8476AF128CE1046D870399224C87DE550252E2600A77105745CC1CF86F0926A772E093586DFE763F8561421B92BAC09

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

C0C20FE02621DAE911081AEC39D75C74AB901C47A670ED4D6E386196F0B5E4263DB047028D322623CC0E05559808E5A58CECB9420CEC139BD4D70BF155A53B01