Type
CONTRACT
Validation date
2023-10-27 09:55:41 UTC
Fee
0 UCO

Code (933 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0x020b8169eee1f2df2307a3d4ff44ad43d33a0c2c", 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: 0x00008DD40CD42287A3C8282065F5BCA7259AC7014CD73109B570E946A977687C7BD0, amount: 9.9202e-4, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 2.98e-6, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    AC2FB7E12DB78680668DC29A16C8B958FCBBB1ED746C6DD296A9D09B50879C3F72A0BC42B844FB0EC3253339AED9730970A984B8689C3CDD4D2E2890

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001F54F0486BD2497C5B21060B3CF7DD4F80AC0C714563899A6A94AC8D8870A0E38

Previous signature

A49F9D8C117BDC6BD89EB10EFE78A97AFECFDDF082BEFFAA24B5B7CA2708B37D6CC8864D8940E29A22DF68560A80B6DD43BB1EC1A1EDB2A48FC9A885F4ABCE05

Origin signature

304602210087396C9968016BCE8A3D9A1F37BE5F85BD958778CA4CB67B3A56C897E03CE5B5022100C579E6F8AF19EA6B827E9E1A4E8D7D7EFA929346DCDFA35CDE4FAAC316A48E2B

Proof of work

010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765

Proof of integrity

0023B7C648BFDFE9C4C4F30F35EF51F04C0C6ED19118ECFEC903C0976B8C75218A

Coordinator signature

9C33CD7C8EF4409C70EBE2FC9252030476B8F342E5A4E25DB86D5B9082A2122D9FC6AFDEA62EF77E17B7A64689ECC6769B597882AAB40B66294D3EE611BD750A

Validator #1 public key

0001500FBE298B79FFBDD5CCA1798F30FD88A53D26EC39DE5DDE1F4137B032A4BC34

Validator #1 signature

873CED1A2D132E1B33495457EE136DA265048A2BE66EF97A09495A0F3FF89900F149E46E6BE18C7C75F9D1FDD6FD92696CBA6F8EFC212D7D5FEC0B351E0C9800

Validator #2 public key

00011ED0B570D680BE5ECD58D2D121689DA73C46DCB38A01C6E10D06286040ADE30A

Validator #2 signature

511A265E78ED4EFA0575F70B481BB70808341E3C85F485DF5D956AB4BA6C4C1199E6E96DD09F0126B35F147ADB3C0ACBBB0FEF51EB4353AFB0C48979CCF8F007