Type
CONTRACT
Validation date
2023-12-09 15:56:48 UTC
Fee
0 UCO

Code (936 B)

  @version 1

# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1702144560 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 >= 1702144560
]

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)) == 0xC6A11E1D9AAD35ECF403B568FC2FB22CA7A15ED390CE7ABAA4DE0B6A8232A9D7,
  address: (
    valid? = false

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0xaee753b0dcc9281285f447d7133dbc3c034f6609", 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: 0x000066062AE51C8EDDB115B895B4917CF9A25F20A0CDAEEDCFC62085AB197F6B48FC, 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

    4A99FD6B53141B85FBFABE58EE082888C4C28E4D79653457B5E96CD8D81A83AA9C7563E5FE515C7E9FDD862F6FDEB48108C9E8A6210DAB8255D59E36

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001EABF2A78DC05EEC3651131A5259615866EBF606FD6CE127EF2A0DA60E8EF533F

Previous signature

4024627221696CBEAB13A890D66377B05AC82F0A42099850B68FCB555C4DA803BCC373F0EBE5FBBB3F9D7E1A2AF2E76A687DD22E93EC93492F56BADBF1A48104

Origin signature

3046022100B976C709356C76403E5F518D5A39C42AEEEC547ECD480EBD69A7783102F581B20221008FDFA85446B876A6F14A6303FE348E763752775719E10686B6719AC968694A7C

Proof of work

0101046C39D56B717142B6EE14B0F8B2561ECA458F3D2D12C9977D613F78829419063211F9C21F7BB0D56B6523040A8156BE22B6E9D6332B88ED882574D12AE32F7A45

Proof of integrity

007A57FD0038B925200C76E74DD0E5B86B0D4C5787E6B48DE9E1F6C254A344AEA9

Coordinator signature

9FB28E5FC4E0304CA2D4FD723FA6D32A6D1DA49D52A8A2C7B76F4C15929B92020C5F97006E19B6851457F8784D6BDCD9C5B3EFC818A926EF35DA718AE829000D

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

95685351CD96FAA9F393F3AC653F4AABD20E70EB16E63383EFC876BF5DC5F1BC691F2D07B7F2CAF47D0E015139E80A1A65CDAD1FDC4E18064F68B2E80D7E1502

Validator #2 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #2 signature

15278EC6CFA2851EA96475810B9D0DCC2B5DE71B35B837C0D5F3282EF575AA34CF7C7920DB458019305AF95A380F2AEDA2B52EA97194677CD42EF8BC73020C0F