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

Code (946 B)

  @version 1

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

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

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

    DB0BF94F1B3C835CBC052FBF4331669580DFF5689D39A796AEDEB88AD50FC97BCDE9FC005020FA87D16641B955F0861975DABDDA11846D1240C45483

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

00017A1CE2EE2E09E37832289DE83AB26E85EAE8EF96504316143B72343E615BA627

Previous signature

920FBE0AAA6ED76A66B1F4CCDCAF49E770D99090BEB7985217A5AF830F22F2BCBA369D8171AB7F2B083BA7C5F72954751B49EA9222E1CD0C0830763BD980F10A

Origin signature

304602210091B0482D435C056730BFD2BB0AFB78B1077034463AE5D2A9F7E0955C1C3EADED022100AE65D723F2D6CCB9223A5CF6D03838CDCBDC814709DA24D56D2C3461A38409DE

Proof of work

010204AA023E1E039788AD4B8F713C8871CA39A177414A99A0788993AD725B1FBB7AD5E4CAC86151A9E03451DCACB1EFC100B1E450FCEDAF5E5005F3A4C503D1D29712

Proof of integrity

00F6FE106C29460529FFB75488815CF8E468A5BD68B09F5CAB3DA02662801C3F8A

Coordinator signature

31EEAD1FE09F7BA21DE62F858E87E8CC0E2D1AD8BF8BD4EF90C068B1881E40804324DC325548A905898342809D2B5559CF50403C26F3118A2A515EB6CBB3EF02

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

05BC22A3EA6D14A2C7E46176F1DAD4001E5B4238F21946CA44500384E8736CAD71BD1799CCA1BB833F2EC50B2B8FBFA64772FB4844F6FF3A3E3DC4D768C3B002

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

99264C211D47CBF4039DA8C6FF10521FB9D59C30B2528B646105908B7FBCEA34F66AB853FF3FBC70C2FC24C95C36F82875859C3E618261BBD72F4E43ED211B0F