Type
CONTRACT
Validation date
2023-11-23 23:03:57 UTC
Fee
0 UCO

Code (941 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0x97b21283d381761f034fc37d1b6228007b2c71b8", 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://data-seed-prebsc-1-s2.bnbchain.org:8545", "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: 0x00006AFF130BEB6BE9B02B80FFC13DB5EABFB0A7D167BAFC9F2DF8F141D7755FB39F, amount: 0.05078895, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 1.5282e-4, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    0C17A7F8197610D4A14641AE03E7ADEAFD03BC0117C67A9C0D93BD5077B1BB572BDC566731FB18DC971D0443D79BCD5C61ACEAABD8E5C91DFCF0212E

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001CEC26BFF2E004BCD898415EA81F4E888399419E7C10334BC3A98AA06A8AFF3FF

Previous signature

451FEAA54C9BA10AA998C2DE01B57E4C2E8A74805A035829E9D860432D06B4C8083AF642363B6471DCF3DE692187F78991CC9905A7B61A1D5B9C3315C47C5B0A

Origin signature

304402204714485D64409C29AF361BCA923C2497ED57977207DF1A858F7E3065042B20820220488BB49A65F1295FAA503C747D8B071A5E231E42EC6025F048CA377E4A988D02

Proof of work

01020451684966573439C38DA99334546FBBDE4A6D96A50B4A4ECBB6572CDBED023F079607407E254421D1779525D11C60D55684F0B403B93B95823554E29D1E2CDB16

Proof of integrity

005642ECA41D2D14BB89E97739142870F184BA1CD0CB56A7DC18D1BE109DD97E75

Coordinator signature

4BBDB6A2DF519CCF7F17E8E9C0AEC98981E12AC5A271B379090E0AD0612328613C4F4FF799F957D4580AB9BB3F7F36AE3B67D4C08B525A8132B0E68898F7310F

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

05391D93C55388A4F4B12173E95CF02379D194D02DA6C77EB4931684078744CC0F28AD673CFFFF358883788562C585A2BE62C12683CEF732D8A10BCCF78AFF00

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

F2B5A76DA8FA1AC80C8F34A3FABC29F7133C4977ED922B63F369E9E60A6B189F787BEB0B6CBD8631C384C8D7071226031C53B1779EB4E8DA21210FC43CABF908