Type
CONTRACT
Validation date
2024-01-27 17:10:24 UTC
Fee
0 UCO

Code (944 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

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

    3EBF89F0CCFE39808935FD3669767AE8A973419CB0E681E06405B82FD2AE969EA71678C33B8E0423B44B79657A57C380EEFC4B3616AE7140164F8466

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

00013419627758006E3019CF9ACEC2C759C6D95FEBB26747C349F64915487E8516CA

Previous signature

4D209867265F8323AD52DF56A4E100D3797306AD7B25B1782E0058133657C17FF82A571BB9EED26192B65D8A475A89592104E93442BC1B6DEFB8AA7F0EE5CF00

Origin signature

30450221009A9F630F82BC0C4207C7324AEEE6467F416CFD10F43DC9FEF6DD4FF5FBCDBC310220151EC222234054E4CC1C63B80075A693962BF900D0F8AA1CE228A62020A4B5D7

Proof of work

0101046C39D56B717142B6EE14B0F8B2561ECA458F3D2D12C9977D613F78829419063211F9C21F7BB0D56B6523040A8156BE22B6E9D6332B88ED882574D12AE32F7A45

Proof of integrity

00C092351C0497FAA1EA8AEBFF99EC4348C25FA3821E4F691451391A78CBBC063C

Coordinator signature

619B3A0A66BFCFBF77D646FCC171D23FB4582CC20D9128A9735A38725153A9F64EF08AE81F0BEAF95D4C3371DEE23927CAB5DE4F3D28BD715FACC8B803FC8C0F

Validator #1 public key

0001B01EEF96BA7E95FC844D456CE8868F18864519FC9532E1751C2035FD044DD5D0

Validator #1 signature

6DCB4E41B3EF8B06061849BC17339E61B0515E8C69CEB09386B6550858C99DCC272816FBD6644A918E46D0D290CB67F156EE5EE887E4AB32EA60AF3CCC18B600

Validator #2 public key

000103E30584AD8DE66F9E29419D5D0ABEE5A76722C9FD0D012BDDE3A6E2B149C48D

Validator #2 signature

5A17EDC57DDBE5D0C5932E3EF8D200EE3EA12E129CBE309FC2FAB5A0E2607AE1BC94086F9314D8E25F14C61548EFF60DB559DBF2786B1B8F2B28C00AFB732607