Type
CONTRACT
Validation date
2023-11-14 18:35:38 UTC
Fee
0 UCO

Code (943 B)

  @version 1

# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1699994040 do
  Contract.set_type "transfer"
  # Burn the non withdrawed tokens
Contract.add_token_transfer to: 0x00000000000000000000000000000000000000000000000000000000000000000000, amount: 0.004975, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4

  Contract.set_code ""
end

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

actions triggered_by: transaction, on: refund() do
  Contract.set_type "transfer"
  # Burn the non withdrawed tokens
Contract.add_token_transfer to: 0x00000000000000000000000000000000000000000000000000000000000000000000, amount: 0.004975, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0x1c6e10f3a0c46f3900c06b6e8f908e11e268da0d", 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_token_transfer to: 0x000072181206496222FBB38752FCCED316C8936F3030CAE39BF58D41BFEED0CA6263, amount: 0.00496008, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 1.492e-5, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    0438F4F7769BBAC66683C7BFA04345A1FA910B14E186F29E722760C7F9FE2599C65B30144666FCBDC798D871302DA90E42D6E75C2C63E1B15A52DBEF

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

00014AA615F7960C858EA20A13D031D7748A2E9CF716F25C5B76A5033DBC330B9756

Previous signature

3AA2BEEA32EC43B69A1959272A0B7EBB4A3938643C054832C0E6C1644DCD5EED9A4FCFFA27DEA87CFA492D04731311CB3377A5038DBD670B4FEFAC9068BCE80E

Origin signature

304402207EEB3C3AF6726FD98FEEF98245F4163D017F4BE3ADE11D6BF7689A652D92FA6C0220158C18F508DCB198B3C6AB1C68A942016DC6808760AE734F7D6B1D7548739682

Proof of work

010104EB90F7BDD03D5A7FD9B61D9128D7CF24C11F3F7DA96825DA3680C2B6BCC48F1AFCE26E0A5F1A903EDAA4BC9390210A0A4F175847EC2A2BB325BB6D1CE8EC8F90

Proof of integrity

001ACA9A1A94985091DB62AC8EAB49D6A87C2EDB129DBE5FB1DC51DD5DF2E1928E

Coordinator signature

B3A6EC8C384AC95D4A4D30B5B4BAB3646860AA215CDD7A0F1D3B89C614B5EF797D19E9EB9B301EA4770D79473E779C9C0ED7F9FCC72127042B70B78807053100

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

A01FB969C1D2BA31884BB10D158BC5E05B3F8C1AFB246934FE094DB77007815B0BD1D7D4C6CF5D21A863AD1006120EA77AD50C9BE9543510A18967A5BF899F0D

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

722D15CD8572F6983EAB543120B9853007F468F96E964B1E18C7C7DD1DC4ED86FC1F28097B7E99611D8A82CFCF1F64B4E1D7850994A35B7AF6F87A63614E420B