Type
CONTRACT
Validation date
2023-11-30 21:13:51 UTC
Fee
0 UCO

Code (932 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0x6315c60784b4435533c7d9985f402b895a8485ae", 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.06944105, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 2.0895e-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

    E49745DE256ECE18B90443352B30400939764CB7558F333A99ABB98EB0A6EF0CBE6C6FB4C37AE9C057F9436470B6D0ADDBCEADA93C7303EEF484F76C

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001A6B80A0E31000C4B2596D7F79A6AF8C2336DF1B2A64C9F10B577B2A618C4018A

Previous signature

7C4FB1DEE255903350EC3E00D87081E3160759D79FFE17B3A90DFA945E0D8CEA45C1CCEBCCAD53E11B296EF8AF855C93ED3FFF20E23EE3B24C29441CADEE8702

Origin signature

3044022011DA27F0FE6B3ED24AEA460300DC0B2BA0567181955FFDCC6060B3B43E515466022047454F4D46F0436150C38B45AA04857FB6AB71FC12F78674185F3F4BCE8E3C07

Proof of work

010104EB90F7BDD03D5A7FD9B61D9128D7CF24C11F3F7DA96825DA3680C2B6BCC48F1AFCE26E0A5F1A903EDAA4BC9390210A0A4F175847EC2A2BB325BB6D1CE8EC8F90

Proof of integrity

005E134058B2F949385B81A3A93E5906A057BF00B37552FB31263B612D67C49020

Coordinator signature

D7BFF03C9C5BF6F5647B472F1C6CF7B5D7857B44AE0030CE983A23013346BDD189605843791BAE2429E918EFE1EB20DFA27219721CD50E260847FF2C2A2CF003

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

0D361D5683221439693E52EB115733F166439A4F76F40E37B43D37E5FCEE1C4FEA7641364B8562B8EE2F7445FC878240131FBA9B510C7838FDE566FCA8F3310F

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

EA9DC60286F6BBC91A2A6C59BBD059D2FD32A136008B7A2B6B2D11488F09DBBB2E6A37C97296FCD259AD5EC3FDD84D99C585D90A2FF582954B99334A78E6E90A