Type
CONTRACT
Validation date
2023-11-08 13:48:19 UTC
Fee
0 UCO

Code (942 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0xe95c3b1ec6297d1dfe05116ac03337789643c43a", 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: 0x00008DD40CD42287A3C8282065F5BCA7259AC7014CD73109B570E946A977687C7BD0, amount: 9.9202e-4, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 2.98e-6, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    F51DF67207A39F1E79681714EB1C462B2ABFC19027FCA91DEE6E5E8CF2A99E44C7342C0DE99F29C5675144BC48B2CAE5A78EFC14446E660F9DB22B74

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

00012CAEAA084B22F28E182661F09CFD31B67355392785842AA9A3DB57AE8B4767A6

Previous signature

C887060D7690BEC9F1EB62DE8A307EE19A7A7C3FCF1A88C0445240D6296160B7E5CB7636EDDBED6C32472E49ED7C55F4AC19DE875AD06F52DCC766ECCE082408

Origin signature

3045022100CCC66F2CA1785F3D45819F9D09B296AD49C622EDA17A3E5D754F5A7C0E0EF8F10220518EC63BD81002DD429455D794325253E160BCBC5DB620D5C00F3457EF3AE138

Proof of work

010204B3B2A53580086B9F36919CF40ABC55904729F78BF43673E216FAC1EB2451DD1E521879C6588F0CB09B150A103A39A73E2816B5ADF51F0721348BA3A66C33023B

Proof of integrity

003AB6F86E2A0DCD193B79A419333DDCD609E5768C1234C1B8B42A82786BDC2C8C

Coordinator signature

5E1A8A610C20E9AA853C83006A28D4DC10BE27D1176F91DB8EFDD623790B016AF15DF2B16755CD4187D02EA3EE6C2B25D7F4EC1CF15CD3A9D9CF47805BCA6506

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

28FAB1E5FA5A8B7E27FCFC1ABFA0170172AF7C1564FE481E4EFDA2501BE8FCA15CC7A3D71AA758EECEF0BED562EA1DA246D91E1A71DECBC9FA54B550018EC406

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

260DEF8A600F849A2AAD9EA29B92CB70860FF25461DB45B289989BD69A1311E65B1DC108310C41AD9EC47688DBC8B7D9C799CC4A16C3C02C42A388F95B5A6206