Type
CONTRACT
Validation date
2023-12-06 09:50:36 UTC
Fee
0 UCO

Code (932 B)

  @version 1

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

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

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

    5DC166E66FF6E8FD0B446588713BD1B43C4AAE6C0C13AD0870EB9C876DD788D13766E8223F541A8C4D39C0CA1B22C4E035694E0E6484E27DD40D5064

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001CA2C45C113DC8554587349E9766C4B6009D5CE6F0A8FB3336740EE62D0496287

Previous signature

09B9AA2BE573248B61F092FD4FECBE5DC3CDD674C05E8854C4CD24A692D2020C225AA5AA60E1667C4420FADD243F70C13F6CB596916D2A8B3501B1581CF5C50B

Origin signature

30460221009CC999AE34C526CDDF165576D71560D14B178785C27E42C19C6E0836646BCD6C022100804165D153A3F42AE6593AB4726023895AE7C2967B8C2A757ECA585905BDD437

Proof of work

0101046C39D56B717142B6EE14B0F8B2561ECA458F3D2D12C9977D613F78829419063211F9C21F7BB0D56B6523040A8156BE22B6E9D6332B88ED882574D12AE32F7A45

Proof of integrity

00B1D24355070BE66336B9986C772701C812E6555F6D90415D25F8E8F6716E183B

Coordinator signature

D24D9162B46F0F8A669D42513A8022A5A4857A36B9EB4139B795B081588F9872E409306097F348C4ED6EEFA2EAA81A51A599CB4ED6049FDCBCDF46F89C93C80F

Validator #1 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #1 signature

72E76CC095498FCC7BDC13BCF61B753A261BEC20BF5002D34E1851FA451FB9927056EF7D649FC1944CDF75E7F3D50719324B1CB215834B59E176660BB3EFE907

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

E2ED0AE0F6BC70EC6C9A5E74CD0771CD2C9E2BED4C8D2E13779FFAE425E7AD6D76CF1BD0578B6E19AE1C612641070898CFC9C89B3DECCBF39DA76778DC74DE09