Type
CONTRACT
Validation date
2023-12-06 08:04:49 UTC
Fee
0 UCO

Code (934 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

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

    0E30B2DCE9BDF3AC6DFA942B2C9DC07BA14A10B41BD6AF0B61C796EB4BA62EDD2724C5E548D9CF562A06612C28F0C8BE6DF37FFD956CDAB25AB546EF

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001FCEC0A9808F1369F2A52FB2A68B769631FDFA3B680BD7364F82BC3BD68A271C8

Previous signature

0EFC362FF4BD463097ED8A70C379C3B445042624DCA98ABFE546F1B820F5475339945148E68CAB4E25175EAE06DE4BCE7466B01F8D09883DB5B3F23F6ABAD809

Origin signature

3044022012490BE450C4ECEECF2CFF2EAF239EB20164672B42D3B8A06E01050442D33CF802200C87679A6503F2F0028A384B8F3D1BBB8A0C7DF51878019C56342A38AC38717D

Proof of work

010204AA023E1E039788AD4B8F713C8871CA39A177414A99A0788993AD725B1FBB7AD5E4CAC86151A9E03451DCACB1EFC100B1E450FCEDAF5E5005F3A4C503D1D29712

Proof of integrity

003F5F3BE60B78B8D0235FE142F6251FD75E402179BE96228930E460E457CD94E4

Coordinator signature

1D1629F30770B56937117FF08039D4F543B010FC9BE2F006F217C7A46D31FDBCEB2A06F416FD5C0E11235478CF7593D013CD549FA8115D5EE478C792721D2C0F

Validator #1 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #1 signature

FA7286A51AA89FE6C66A50F60776F5ACEC1E3008E2A0E8B106D5689B585E9624894393DE286F5EA66881EEBE7BB7854C097D66D8873841887CD2D7F90A4B4C05

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

553181B819945D13C379BFE6EF9B40AA9BDE00D1A92566918D7F032FD7E16216D690AE86B15A0215869AA789CDB9D2EFEA64C59EE8C7106A30017333FCF7DB00