Type
CONTRACT
Validation date
2023-12-01 16:50:36 UTC
Fee
0 UCO

Code (932 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0xa60dd50d030b3cebe7917508ce265f95f17fea90", 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: 0x0000064F114419DD1BA0B495E4B596513A180BCC4F58643496F0919DCC3B6313BEA1, amount: 0.0198403, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 5.97e-5, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    47B2ABA89DDE8A576A8E2E021F62F551ADD93B796C8B841472A0FA15CF7E446E2460EA9918212395A7EF7340BDE413DBE4781544CE2EC87D32E887E9

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

00010763F7CDC7F0211B0DA7DCBA59D44ACC360C710131295AE93D2A30FE45892C46

Previous signature

4A119A3C1AA6699E2D6AC7A0E51997DDAF5B8C9138C040225CDFCD75366D7CE993E2DBC7E1FF0AA5313DDD90C476B491552181C33B773A2B7554BF2336757100

Origin signature

3044022064E23BD37829F0DEAE35C00F00CB254FA3A266EDBE6C3BBD697C407D7A15AC3102201AAD1E3B8CCDF57D777A46E6B1540145F1058DF0077C8AF56E217AE1038883E0

Proof of work

010104228ED9FE757FA46CEDCAE4E3FDDEC1EF6511A71B15E5611AA36EA41DFB969EF2FB83D72D13AD1E89873CD4EFF1364880B3557D72AE5188EF5E1BD09253CE235A

Proof of integrity

0097ED2F28FFBABC1DC49A09B13C523BF474414DDC88EFD120277672E9B30A93C1

Coordinator signature

7F1CA9BD0E6D605F26F988C7CE381F359A7D272BBAF0AA2903CD1ECB17350D9014A1B5E1EFB70967C8937FB642F810B9746CDF0FBC8E2768DD400F90787DD20D

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

E3F71C26EC85BDF3DC085D6FF5C1FD4ABD2FCE5E2ABC6080FAC40143B4C099AC47D84168D730DBA550BE4436CABE2C9827E967824ED29CAAB1C9FB6C231ECE0D

Validator #2 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #2 signature

03BAC6681A861505C9D81CB738C560A8CB8183BE0D5625D84B9824678A94673EEC7B0B5E60FAFCFC4FEBBBBD6E26A673BABB2BB6E0EEDE7DAEEA675C8B0E8003