Type
CONTRACT
Validation date
2023-11-12 15:25:52 UTC
Fee
0 UCO

Code (942 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

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

    2DEC9EFAD01F3564B6A1D1C399E6CF3B25878A15BABD087590BBC1B09B83B1D1C34BB1B1E4E5A0D8A4A2E5EA1125879C2310839463EFF16CA4888865

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001BD353CE31676EC9347F46C392375795D17C1671ABABA268B6309DBBF97F707EE

Previous signature

2D9979B1DAC549D6A33370BDDD260831C8A168A7499EBBE2BED26B0728F689C12F1EE081A795F2D922B3050F612D3D99CB7B9D48525385985594678C197B8C0D

Origin signature

3045022100F4CFF9AFC88CDB960C4179136722D93BDF53524FF048BBA618E1A2BF324A15AE022045F6A89466A10C0840517E3606B5763E73937334201213BD4F1F89267473E5E2

Proof of work

010204AA023E1E039788AD4B8F713C8871CA39A177414A99A0788993AD725B1FBB7AD5E4CAC86151A9E03451DCACB1EFC100B1E450FCEDAF5E5005F3A4C503D1D29712

Proof of integrity

00B76E565EE4809B99BD804A08D4A32EA575634F4C6B6BFD2035E08AD893669A47

Coordinator signature

962969A865DD7B5394560CB352A65326C86AEED568F77810E84A9F549419474AFC5021D4D6441736D7B6A960D8090DCF95C57BE204CEC10110CF6CE95372D703

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

3D0E27E574AD982226732DBE47B98130FB929AF291780C7C520C38BB7DEBDAE34B44108364BA2912E17287D9D0DFC87EDDE96219BE3D37C38D309F742E3E2F09

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

2114075E37ADA71459D2D6F31A434B96914650928AB0A0D4AB3321D7A7272AB17E5A8D6377B72FC62AA7EE20B4945EAE6230879FF52CCD709167A0324FBA2B01