Type
CONTRACT
Validation date
2023-12-06 11:51:29 UTC
Fee
0 UCO

Code (935 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0xaef6c51204040a67aeac4ca73f838a189899db95", 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: 0x00001CB542FCAA33F7CD10830C54723B35B81731AD76BDFE41B2FD9BCFE677218A89, amount: 0.0396806, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 1.194e-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

    457A4FB374788DC33F56DD9FA09B1BBE89310999A6D8673637D41810536A9CB19A545B5205B2521C1E9EC888ECD62091601986121511E8765ED5ABB2

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001993E962F1C26D8B128D015F70A9907EC52F3DD96D016A829EF5206DED06FB5DB

Previous signature

A7841C6764FB6E069DB7456463B1421F80CBEF97EAF09A076EC5A3D54024F90D31FFDAEF291654C6C713BCAB55C437711745D643EE94D83591AF7D6D1ED5AC0D

Origin signature

3045022100AD01DEFDFB63CCD7288F8C3AFB4847BF799E909567C4F5FD07A2DA92EDEA165B022055F79990E4F31107A46577E91D0F220DB58A38E024A9B3F5E862F4EA4B3C9B98

Proof of work

010204E9BB401A767B0C92D5DB139379AAB18E1B449B455F49E3A44F3466B2D38E59F0516B79493A528A95E5A74CF46F79CF12DEB73293458F6A4403D2B3E57D697347

Proof of integrity

00C485A8F4D29BB04C43C79D59E4C62C13385BEF7F220913A24BA7ADC138D84437

Coordinator signature

B99EA89EE729170E03DE9E3E2A605D966774BF42F9C50B31C307BFEFC6EB608B0C6AE40FF8ED07F5FE683BA64F3BB26C301532AB7EEDE11D1791ED5CEC144805

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

6845B5676994641CD8A0843B33F0524EC8C2EF0C29927E51ED1B75DBE3F1C8F1E869A09D012DEA0B0B386B0225D42DE4FD2A341C3C26876D376EC29678FD4608

Validator #2 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #2 signature

42D88BCF87770CC1364D512032E689B46C7CC3A26F3D297D0B83E270C53897012B002D0B3C054F0A0BF7B49186338738CFE48F0A6BC202ACFDF7665C16B8300B