Type
CONTRACT
Validation date
2023-11-25 10:55:47 UTC
Fee
0 UCO

Code (936 B)

  @version 1

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

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

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

    9327A5A342A139F47077DA7A2A222695A06FA4C68D25F3619A9B5A3403AEA37141B307EBF0107909D399DD4CB798E02136E5EC89828333711CED5DEF

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

00012E1410285904119899F5B5E3C4A25D8DD61A6310F7BAC0FBBE8380D2B69D74CA

Previous signature

504EE09B7A0D89B6C15714A5CC278B31B60A20845971F5C0E2D9E94B7849991EAF3F00058ED8345D5110FAE6BC58422E89B2A3E61DF34DC05C7ABAE0867E3A04

Origin signature

3045022021173264C4B7A4ED4784C75540B14D6CE118A4089F962DCE1431171E70D82983022100E82CCBE52AE9FCFE8CD32C076B39AACA58BC431560E133FF2706059D15311509

Proof of work

01020451684966573439C38DA99334546FBBDE4A6D96A50B4A4ECBB6572CDBED023F079607407E254421D1779525D11C60D55684F0B403B93B95823554E29D1E2CDB16

Proof of integrity

007999455893B0719170E3322B12B0562A93E025564A90CE0D55B6C95D92C6E549

Coordinator signature

30398F830B5A721DA0083A8B0D84E03C586B12DD7653F239D18CE8ADEB766039A37F3F69CAC40B7F3458BCCE55FA253601BF41FF2CF6F917EC8897384F3DE309

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

D72CED067038F6165DD50B607105286740C1630CEF3C706D4E5ED53E6064FB3C7DEF4AD015ABDF8A5D621DA96EEF3D20EB48C7D1365E6F0F4126099AD0C1BB01

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

0BC90955D56E63410A05346BA7E66BEB9AEF0DA6C9771DBF4759F49A4E68DCC11EB2918710B21DBBEC6C2A2D5CCF17410FA525FBD8C33C8A0B3AE8CF61137105