Type
CONTRACT
Validation date
2024-01-25 16:48:49 UTC
Fee
0 UCO

Code (944 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    5B93E3C772DE3FD3DBEFD5B7A1C133DD50E0F6735A848445D4527D05D1B191C308B5DCB7D513DDABC7DB8AF0B69A9FEB23713986E8D0D059AD1FDB3A

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

00018050E10D1906C25F62AAA6590B0E42B7A22CCA1211BFE630518F1AFEE92970AE

Previous signature

7D3DD7BB7673D3139BED8CAA60F07E774636EE3D1C28FA3F563EEA8C3B32C713C351DB6191BA6DC9419FCB6713961F11B5A5DCD71EDD810F726FE3D399B98606

Origin signature

3046022100941853EBA2ADB3B182DA807E0B5FBE593EBC870796A6CB42FA4DCF7E2571DDD4022100E5677BEC9624AEC415DCA94A7A67EF76784F50D92469C14167F1E3B9DCCF3B2A

Proof of work

010104BB7216545F28C83467606EDA88968E19C436410AB446D1BC88FEBDE3506275F9B0B931CAAE420B96B2A158B7112F13795C878CCC346C76E04A96C59CCFC6FC39

Proof of integrity

00FE0AE6EAC18D5C91E3C56023F0B9157E62E28DC77CB844D0FE99A6A11984C825

Coordinator signature

0FB757A720ECC38E292F73A2C898CF52EBE16F1E62A15A8E41A3AA3ABACD7E04C1F22057E14EB8251CAC5F91F55AB50E020B7FEDB20D5756191DEBF76B69DA03

Validator #1 public key

0001B01EEF96BA7E95FC844D456CE8868F18864519FC9532E1751C2035FD044DD5D0

Validator #1 signature

54C8F6D15E7D6450773EC9166564956A132FABA678152D0D36C625FF6CCA4BE300937B7E7BCD3E7E16178FA59BEF59BA2878E831A13214019A76E3DF54FD1404

Validator #2 public key

000134772A943DC0F7038B1BABA39E18841C12DD6682B1B6D1D15E08D7CAF5339AB0

Validator #2 signature

605DEC7769A52D423A84E0B20D7980312FAB7224DD6A55145186CBE7B5FE49739EBE7FDBB695950294E81043028A5D24C87269C6B2DE6BB256A54E3BA038320F