Type
CONTRACT
Validation date
2023-11-25 14:44:13 UTC
Fee
0 UCO

Code (945 B)

  @version 1

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

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

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

    216E442493D5836127ECEE4277040BEE701D99EF5E6848AFD0B010D0642EBBD504546A6A5DB724DB46CCDF35253A16CB0F8BE7509D702E4C52F00B00

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

00013AAB1475B8DCE669B48F5591E9F025C5E99825DFC305735EECF1D9D49C3026D6

Previous signature

F2B15A4603A22996561A1287B54F74A973AC6C805C51E74984C29A854CFAC64D6921A0D9B03CF475F05138A93D130CF6A440B1A9221A044F1D7C0091DD233202

Origin signature

3046022100A028557F3F3AE6CA31AA91BABF736F1058FBD0A2F491250C9171746DF2E8517102210081E65E725E20072B00F6C29618292678EF930A97B2DCF285538A618D6D432351

Proof of work

010204D6052E0C6CA9244CDE5F3D664296BDFBA0090B330404C3C16B098758F27965DFEC0D3F25D1365F389C2B6C516195552F8779DEE0796C8C33F1A9C0404F4E3381

Proof of integrity

004D6E26E174E4E937F8152B02369BF9367E04491D0A674CA560A7C873874FFD2C

Coordinator signature

1C23B95E6483788692ED276AE55D32B2BFEBD6D95813B892CB86F02F3AEEB9C9171E34DDEE5D1EDA267894B9732D666E7A625F0F256E5011C70ECA32AE3D4505

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

A38092705C8F9F7F15A3E5FFACFF1CC4E93F58F8636B13F4B7A08F171C75BB28E3B0903537D0726635F428AFE3E5953B27DFA219EA1185A4D1C79753178A430E

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

1FEF6AB776EEC2A598482EED28B41338C726D95DB3C84A0838D93EABA82FED7940486CA4E4E3286F7BFF463EA6E429C4BF9ADB6BAFCCBF63BA319320146A8F05