Type
CONTRACT
Validation date
2023-10-25 14:32:20 UTC
Fee
0 UCO

Code (944 B)

  @version 1

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

  Contract.set_code ""
end

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

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-5, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    288211AB1D40337EA656DA3BFC2502E4547310A846A1FC92B03D1EA3CEB7551AEE6050F6E00E52EEDDF3712C5A381A53C15A8412E1A6A38D21B360C5

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

000190F43AB7BDA8C62E0B843A9B98D7F9C9B97BF3670B27AE688CB456C5C1212614

Previous signature

4DC2FAFAD3A29AE62385C7992643F007DA5619DF688611B2AB679A0846FFD1AC35442798F2F24F6F5405044557533C7A1795B218E30A248575E724A3B3E5250F

Origin signature

3046022100AA355F420835EFB07198CAB6CB18203121AE06F350A789F5AC376DCAC5D02BFA022100B7E2CD67863770A2607E20C04811AEF98E19CBA2C79169C0B6A6C95B5FF0866E

Proof of work

010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765

Proof of integrity

00463ED47925A7F72D1941B3895048499DDF8F25BEB96CE7608A329DD8993B0845

Coordinator signature

758AC0BBDBE67AB354E1D2A27C851E019A8C4C714ED891A714943A23E2B4D6E0E9AD42E0653386408739A2B52243E08C3E9398E4290B38BA4C8F3E1696A79F0D

Validator #1 public key

00018A312AFA617E98B343D09AD2E73F0AB661DB0A59FB986D5DB8CE7664E14C25FC

Validator #1 signature

A3142A845759E1F039FE61C92E82E7F06310DE97BE1C2A16B6D4923A3154076AE33EF2D3E4032C25144F2FD60184A6C66B07E6BB6368ACE2CDA8C19B7A4A040B

Validator #2 public key

0001500FBE298B79FFBDD5CCA1798F30FD88A53D26EC39DE5DDE1F4137B032A4BC34

Validator #2 signature

D3896F08EF03BC21907D4C253A29C0A07D3F63B14482B6CBCA435C4B89E30DA350A3CAABF2D6351AD2E18C81A73E40664A90C9F2E33115D68BCDA362C5D5E20C