Type
CONTRACT
Validation date
2024-01-27 17:41:34 UTC
Fee
0 UCO

Code (949 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0xd9d2a6a12b9bd6392e0464f19af4751fe4106b99", 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: 0x0000FEA155AEF688306C66CCDF1B83DB3429E948EB5F57C006128669401B9B906720, amount: 0.03472053, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 1.0447e-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

    955FC886E1EEFB071A6A8939C50A2A5139EC3F1C4FDAF222C1938D5BBD4A00F1F157B53B779E90A0CBA5EDF4F9E101EF559D05A120AFE2BE27AD5FC1

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

000173108A47D904AA0222C9281B98812BB66C482166CA28A383C53AF8265D0A778A

Previous signature

6DD276DF935DCE32603E771624430184DA7CD47F8F49F02E5B65BB71C4F7DDBF183F848B629529AF6498D3D3F0979E1A5851DCCBA395107F4E354B5DC0D3EB0E

Origin signature

3045022042DC8E9C2D0E6A137532BAFDB0A58D67A1A428498AB7CDC0E790D5D4AD98EB3D022100BB23FF08660CB5D3E00673768DD961EA19CEBF065B8FF9FCE71D957269E9CB49

Proof of work

010204E9BB401A767B0C92D5DB139379AAB18E1B449B455F49E3A44F3466B2D38E59F0516B79493A528A95E5A74CF46F79CF12DEB73293458F6A4403D2B3E57D697347

Proof of integrity

0092F5B23D39CA342388629A933779C9DF7967B57405C89D829152A5C2879E9B2C

Coordinator signature

0ACA00862074BCC9274767795996EA1E6FABC27E549DFB4A2EB42B7E7D8AAB958AC392C3384D6C4972717CA584BE4E24EBB57D7D8EBA6E875250C7E391E50D03

Validator #1 public key

0001B01EEF96BA7E95FC844D456CE8868F18864519FC9532E1751C2035FD044DD5D0

Validator #1 signature

5DE285F5E187D5553BE16809454E3098BA974988F3908D8DBCD8584268996F6B59BA866C6B35355390A666E7BC41964A39E12C8758973678B6B21B370C3EE50A

Validator #2 public key

00011ED0B570D680BE5ECD58D2D121689DA73C46DCB38A01C6E10D06286040ADE30A

Validator #2 signature

9D490621E1964739E6F6732A724FF867589EF040487E59B0B94EAC47D3D849FAAB16D6C06D5AA3D9ACCF3CBC4352AA8D01C60ED081CB364C54F8ED1C9D942309