Type
CONTRACT
Validation date
2024-01-27 16:04:35 UTC
Fee
0 UCO

Code (945 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

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

    83F5D085AAD1F31D9AB5F075A3098E9292C54F5FDC4D95BB7ECCAE5A75D4D0B6C11DF63AE3C74F981B629196518D203DD4919D6F223D58C3E226945B

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001640C470EE8D7CECF9B30D7AB5D830779B09875DC3B339ED24CF7DB275ECBB009

Previous signature

07C70D30158FBAB9E604EE969B46F2EC5C5229E23F59C0B76255BFB9700968158049CA69BD996478C2D08C0CD2C94C11556595A6336122816F8B9E05FAA64D03

Origin signature

3046022100EBC8548AD1398C71B3BF29A4DA9E692BB3413542631C86C0720382BA4B9A841102210084AEAF0436533B60B8DD531AFB27625C06459DAD52ACA97C4B650255E933B936

Proof of work

010204E9BB401A767B0C92D5DB139379AAB18E1B449B455F49E3A44F3466B2D38E59F0516B79493A528A95E5A74CF46F79CF12DEB73293458F6A4403D2B3E57D697347

Proof of integrity

0025C7C11E188350353B767FB9F0D97800AC7798BF79B968E6A88ED66EEE3A8EAB

Coordinator signature

13B674D42F68A869ACA5CAD12737375F6966EDB9ACC5C39A4732B139DB8BE9B77CB0E562DA08F1FD065A4FA6E0CB3C9627801DFCA9DA8C948085BE45867DE403

Validator #1 public key

000177BA744AC778DC2D51A1B7C622E7AC4BD1E1AA8DA2D0FCE71BAAB7DAD0E020E0

Validator #1 signature

E425F8B89B41FFA70494F8B337A4DD99611F88FD9C44EA8FCF11733ED4B26F094D13384F7B21888662A8A533681A88F16DC0ABADAD1538B6C7AB3CFFF1E81308

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

A9D3D41F5BF8625C8EFD428C89C3149E6807EB867400F5FC7478AB1DB2C143281FCB8B6F0F67F30D2F176982632D24B01C437346728AA213EF9B23538F2A7004