Type
CONTRACT
Validation date
2023-12-09 15:27:12 UTC
Fee
0 UCO

Code (945 B)

  @version 1

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

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

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

    15BEE82E602E9D9A3082EA9822C56247A85497833A884FF6013EF771F53EB4271D0B18A07E54AA46772642B2DAE00DEE1690492BB44E0D8E4EEFAEEF

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001586037773194F2DB4CC68D9BA85F303D97A9E8476BB5F7DFF9E0C3DBAE91E948

Previous signature

EA9E52277C2D0CE5E01BC5E2B104FB89188A3DAF2DA925009C69440E4CED884B77E71FC4174270AF542D5D06E3DE26896E2D91963FD0B9CBD4C33F7E7D5E1405

Origin signature

30460221009B335C56C9FFE0D6B7193215544A7CDCA533E626D4C8CEF27D293F1EC86594C3022100CF206D53EE2D30638B395BB4FC669F312E3859C0E911F5395C2052F3423733B7

Proof of work

010104BB7216545F28C83467606EDA88968E19C436410AB446D1BC88FEBDE3506275F9B0B931CAAE420B96B2A158B7112F13795C878CCC346C76E04A96C59CCFC6FC39

Proof of integrity

0054B90C2469808F05A5EA110452455ADB0063E2E761349E2B6FF24B50BFB8B3AB

Coordinator signature

E584069DF58C8C3E2C98AA49F7C5DA636798B02294FD417F5531516C34FF8F83415A0BC249E0235608DD4B44BD1C5E163B99CC04901CC2FD1989F8840906A903

Validator #1 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #1 signature

1D5714AE9571A17269E28FA9B3AE8EB5D0BD0D7FA3C6677EE26D4C6D0C59E21C39320BB5A0B035988D7243917574425A18886DDA99CCC5B428F1813CD3BF790B

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

AB5C5C20E9516782113DFB6875BE15A6DC2B1F09EF4432CCBA5B276A395FA7A9C0A3EDF6A3A70B02DD53D78D3910B793F3B9F15DAFB97115E433CCE88B0BAB06