Type
CONTRACT
Validation date
2023-10-23 11:46:39 UTC
Fee
0 UCO

Code (935 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0x524729b8d4ef3c2efaaa5a648cc7760a071b615b", 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: 0x0000CB30ACA5320066B4413E9D4190EA13562F3225BB5F49A975ABD91CFFDAFED88D, amount: 0.0198403, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 5.97e-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

    141C84248472E4D7449C59B92FCEBA7BD83B653E0B18F56AD16057009170C71FF4FB393F7E3EA01A045C568C20C40A8DFAB552125DD63EE87E0EB729

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

00015A1B8972B47FB123E1C2E4E41E765948DB5456DBAB0EC6DBC7A0B4B1194F86D1

Previous signature

BD81B6D9D8EE801A138D35F579005D0300F5A35C59F656C2FB40312E0F03E1E17EF053AB13B6CC219A251336A31D40C5FF2F119F1E55F3CD0B7B722F8C413E07

Origin signature

3045022100B135D4CCBAD29CDBACA2EF1E431602FABCB081B710111320D68F06AF030B85B502207E91826F0CF475264811BAD1DD01136418708F7E6A49479529EE4BDBC0F52104

Proof of work

0101046C39D56B717142B6EE14B0F8B2561ECA458F3D2D12C9977D613F78829419063211F9C21F7BB0D56B6523040A8156BE22B6E9D6332B88ED882574D12AE32F7A45

Proof of integrity

0050BF830BEA192EF05467F688650F67B01199BCF319312BB879F9D3A44DB8A7DC

Coordinator signature

9E31CFE139374CD516CACBD782CC080AFDA1F4DF0177C2EF57BE7B8491E01F1E8C98C32DDEFB4A139039B49C2F3222622D7DA6A56CC6E8E8C17BFAB607AF4A09

Validator #1 public key

00018A312AFA617E98B343D09AD2E73F0AB661DB0A59FB986D5DB8CE7664E14C25FC

Validator #1 signature

24CCF1BDFAE71A0464E18B29F685DA1432FDDF5F581772A82A6F00F2F732A101DB73E920DA66BF2540992515C0788963053AC39223F254F67284210C4D71A504

Validator #2 public key

0001500FBE298B79FFBDD5CCA1798F30FD88A53D26EC39DE5DDE1F4137B032A4BC34

Validator #2 signature

61BE095A4C6C4ECF1F95E8AE67B8718E2DD2DC82178817EB81FE7F1D87EB05C201B88E14EB19D6D2AACF821A0E0805A65BEEB7F3DFE7F3C4BF29B969F3730607