Type
CONTRACT
Validation date
2023-11-17 09:16:39 UTC
Fee
0 UCO

Code (944 B)

  @version 1

# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1700219760 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 >= 1700219760
]

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)) == 0xE05C7A2FB3296CCC0E48D57905FAE6EE72FBE5F673ED86D8E03A19C9E5B337AE,
  address: (
    valid? = false

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0x441d941c7171a2ecd371ac288e2dfaf4cf26fad8", 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: 0x00000BC0EBA2DBCE4455B46F5E51AFAABA6EB4C7FBA1D4E2E6DABD55DC70F9A04D6F, 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

    1D476EE198A8A82232BB84499F03548EB6BE6B458D610343FC07C016934FEB5B4F4B9659D6FE1EA2FD81E7F4D520D8AB329B11CD0556154EB7D97CEB

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

000123744305D329E44A8B50B9EA539C7A73EB1C0606F328149E36D76FC74C08423A

Previous signature

B42398C7126035C4E249E4A0F9B230B856B0AAAD075C0D28669A1F9E2C1BFFE9E0AD1309659467D2DFCFFCCB658A32AD84CB22FBA20E4307F356CB835549CD02

Origin signature

304502201584153A14E4F57BCD1BE373A403A010D79A3551F17B6F6E638FC875223643C6022100918C4C18CF56BF2B21417DA4496B0F2A90DCE80734919D08F4BFCFC639FDA35D

Proof of work

0101046C39D56B717142B6EE14B0F8B2561ECA458F3D2D12C9977D613F78829419063211F9C21F7BB0D56B6523040A8156BE22B6E9D6332B88ED882574D12AE32F7A45

Proof of integrity

00A2729B6D1BD99DCEC6791B526AFAE85FA17E33603B889A9874A1203F02A0B8C4

Coordinator signature

81AD6B6FC19ED1281E7379F591818A518A428A48DBD7571324CE9C08C33F94A3DE107F3187662F5FF6376743F1B6C5ECD6B96AC4B4E68A8DB46112420126D70D

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

6498FDD58D361A45A031F69E2C1ECF6ACA0F33E313EA741539F09351F094F1FB8392B1A01E46A8D4CA509948624EAC8D1845B2C0A401A8E22881D4E8B360C403

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

073B2729F5A68A2394187CAC404749F10BFC4D0606E609A25C09ACC13E8664296751A1D64AABD53033DC1260890BB684BEA3600D5227E93457EAB3FAB546660C