Type
CONTRACT
Validation date
2023-11-15 21:18:02 UTC
Fee
0 UCO

Code (934 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

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

    614C860991C2B4E6470DF1C905850D0A421EB4E1C8E466289EE21A9DEFCECFAFE857D8B31D8EDA3078962D6F27DA1771953C6B0F914661D96DEEF7AC

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001466811B98363E3B3D4B78CDBC9C66CE12240704BB96C78259B7FDD55DD31B14B

Previous signature

E8B806F202DE14AF2474DABF9728DE33B3B0A724BFB3C1CCB6490C66E2C941F50655B3528D4BB4CD357F8869DDF60232010C5E423EBFC6E26DF47642BD9FF202

Origin signature

304402203161605BB11E3C0D793B1AD023BC18F2C7993B934B5B7FDD9E8CDDE7A416F1AB022010852AD44B608446BDC740B8445DEF0A9E55954A47C6B739966FB291EA31284D

Proof of work

01020451684966573439C38DA99334546FBBDE4A6D96A50B4A4ECBB6572CDBED023F079607407E254421D1779525D11C60D55684F0B403B93B95823554E29D1E2CDB16

Proof of integrity

002DE029F5DB08347A27FB3390D18FA3608AE874DD23337D9E85BEF69AB7CEFFF0

Coordinator signature

9659EF28083EBA7010945259403FE8526C71690AB461700013B9254327819D01B02112C8B4E72A00942682C55DAF1585557E50CBD09B587D4686C603CEF4340A

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

1FE1BED5563C7E61A5129CF340C7962ECEC6D03B0EE97B611A82FE6E39E48D3C55C210D45AFA5A73A1D072B77B4C5524BB18667883BF4EE39F083E9407720909

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

EC89B788FF4151CE73D80A3F301A53257E858685052D801C27F4B15666214D803FC01E8FA405C9913D892F654F92D2F6416F034B33B5D40408228D40247B7303