Type
CONTRACT
Validation date
2023-11-15 20:58:30 UTC
Fee
0 UCO

Code (942 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0x37ee091e6d78d5e6a4aa8e1b69fc43e0b1625e08", 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: 0x00008D5D4054C44E2D545884BD557D7E1CEA9B3669EB223C11CDADD6D99A1334F9F8, amount: 0.0992015, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 2.985e-4, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    8E2268C7BB9351D342E65E885F1167AA29384FEC44F65EE49E3951106BA4E0B2461AEB54DC4926D538EDAB9E07431C3894355807625219661B1F95FB

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

00019F9441957460CCBF0D6125A724C3DDC48E62F1B7418142BD2815A43D74F1B841

Previous signature

ED6729602A891DBFC92B97124E37EC29ED25911622B341FD95EB8294F2AE14A4FBA7BACECFF4DA40CC6831D94FCA3B0A8B13AA6C56450C17996741729D3D380D

Origin signature

304402201325E40531AABBA2077A7B3A694CA9EE02F27C5FAEB1D183BBCA8AF8D4E1EB49022024F60532E5BA0BE18D1FDA396F0313E07FE9359D9CB0CBF2A855EDF733008EBE

Proof of work

010204AA023E1E039788AD4B8F713C8871CA39A177414A99A0788993AD725B1FBB7AD5E4CAC86151A9E03451DCACB1EFC100B1E450FCEDAF5E5005F3A4C503D1D29712

Proof of integrity

00D527C09334ACF7D601D3D8337A44017E9AC95CB7E1BB4581F68FCEA87498ABA3

Coordinator signature

22D0DC9FB126361456127E3292F0D3DB42225273E41BE12792CD01F88C295F4B07FCB6F9D0C99BCCAC62083FF39D89DBD79006453BE13339F143884943C79E0D

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

7950BAE07C7AC529D1F0ED10CCC0C5CD8E4FC36A10105C4765DAB484EBF42BEA122AAB959228CE4483D1162DD92E0FF3B08476EBE307E7F7DCF940C4205E2C07

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

F019EFB962EFB34C4DAB260F77FF4F8F4D5E209F5511E7CBBBCC4E5B2C384AEA5DF573D06DF366F8B04B0E72FA33FA075CE1989090CD9F4336CC5E70444C1008