Type
CONTRACT
Validation date
2024-01-04 21:14:01 UTC
Fee
0 UCO

Code (943 B)

  @version 1

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

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

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

    CFD99D55CCBE7D86F238BCB2492FB7495005D74648D47F123274FE6842428F5386F00CF98E7C7BC3EBAEB76994A1B507B021CEA2EDC2EA00345B502F

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001DD55B9B153EB227570C9A3B1E3D160FC4BBF3F473F4538C77FDCB47881FD338A

Previous signature

1DA267F3A14430C18893456BC36166FA33EAAB5CA7A99A9C414739927C60603F1678D886F4AF5EB099AE03BD8600BB0059440B1CF221157760DD3B982EE70C00

Origin signature

30460221009C2EC2447B2118B382588C2AA4D60B093FD6D2E1F252270424D2CBA5D29E79EF022100C6EF5A131818C5A9D6C0C9086A58A3C497FAE04E441A443E3820851916FCA5EC

Proof of work

010104228ED9FE757FA46CEDCAE4E3FDDEC1EF6511A71B15E5611AA36EA41DFB969EF2FB83D72D13AD1E89873CD4EFF1364880B3557D72AE5188EF5E1BD09253CE235A

Proof of integrity

0035B97B2177D109561CA76551539564179158CFDA5369CF8958FCB9E6420EB83F

Coordinator signature

70CDF476C0EE68B9968F264785A9B6170239CBF130A5F2975600669E42027E39E92FA96B6AE66AB21A52ADB0D1D9EB828847EA64124252B2E430A03041AA190F

Validator #1 public key

00010F2A0E4C424582A94BD90E05FE6931628F91988ABBE387D365994F1F3FCF5A12

Validator #1 signature

385A26ED8C087AA508E081D9588764A2D9D03516AD53F6CE1C159D5C19285B47A69B8839A1A05B264A63160B2B25211B84778460AEA85C8B9AD871F098E51508

Validator #2 public key

000162E6ADFF9FBBBC4BDBB3CD56A5A13A1E8576C3619ADC58A189F7E9A3A77FF95D

Validator #2 signature

A7C9F4C1974F951BEEC0EE10FD240DF56EA0A4EE89806AE23BD03D0D918ABBFE25E867F8BD5C7DD816039D4169BFAA50E22DDCA2798F66E380CC51DAB3DEFC07