Type
CONTRACT
Validation date
2023-11-14 19:31:49 UTC
Fee
0 UCO

Code (943 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0xb74824d675998a83aab0ed927ea7a9b5b7a4f9c9", 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.54560825, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.00164175, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    55B5E423F4BD93BF1B4B129CA6A5E9D2D1EC06AD64C2FD8F212FF7185E42C6B98497512E3B93EE5B9AF0FC1F73C4E3BCF6A1AD1C6891491E18D86832

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001AEF3241A9424B7E4932AD5B427D41084F9D6D763AB10A3426453B32A62A60DDB

Previous signature

D59F0765719B7E7E2F9880BD30F0608FA4A17D37358CC855BC61F526C16FB7CC1725C3302DADC32CA2F209CC41B354FF5B08F5FF7B9C6AFFC147F839B564A40A

Origin signature

304502200C71B438A3A71F6F91486A38F709F5670A3082CA40FA3328A16070C53F371FDA022100B6CD969BEDFB3C9B8BB007F2CC2D43FC1726EA153085C2330B71304B3339097E

Proof of work

01020451684966573439C38DA99334546FBBDE4A6D96A50B4A4ECBB6572CDBED023F079607407E254421D1779525D11C60D55684F0B403B93B95823554E29D1E2CDB16

Proof of integrity

00FD058973D4DF8776424783800A92E9F1194CF6048CCD5056CDAA12E37D08035B

Coordinator signature

73E5D7D9FBA693760CDBFD441C480C1952A4BB4C403C75BA39117BB7D128D76F004462B461342CC50F9A5B2CCBAB8F703DF0C53C7C3DDB0F29520741C1901803

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

B8BF81180A12FAA7C9EE89F0F6C77E350D678B0AB5957AEC1B1563808009FC60FEC82205FD55E4D5B08913413BA7000B4A1E720796B5D5AA97005F5120B73801

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

C404A88FADE75946C00BF06AB333CF04AA9EAB8BA7D72C633AB46FC14C853D8E31EBCBB45E487864EE97C871B9D8B98007CBE98EEEBF38C3382C5386E0B2D305