Type
CONTRACT
Validation date
2023-12-07 12:07:49 UTC
Fee
0 UCO

Code (934 B)

  @version 1

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

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

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

    3956990833AF3E74448DB8B313FF6DB1BDFA164793A4E33AB8DA6C9CFFDA9D322B40FB4099DDC8955C28EF9C95E5E46211C57FA9E0E299281EB58DAF

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

000185901287585816B930C520165B882DAF7840029AAFDFD07F1A5229324619603D

Previous signature

20DE3BBAD57D42254E2F8F43020E0C4D6D7C09E262EBEB5AA992BF59592E1BCA51FBEA782C3D0B44AF35E329D850FDBD77C86DD780F264C81EBFEA75E2DEB309

Origin signature

3045022045B8680B7C1213499FD8B84F9B4D9433966CDAAD71732B6C13067E41C7BC6A2A022100E3A237C30FF9367447280719D046DA43DECB039F63A9A8014CFA252881BF084C

Proof of work

010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765

Proof of integrity

00E61D553FB3A09556CD0667B21BEE14FC587FC5DA232C0711232B730F90F687BC

Coordinator signature

7E64C79A483C353A9A6F6307670540958D1B25DC40B6E364A5A11556379BF73BA36819A078EFAD9C26FCBAF88EE93AFBC3A647D23E86E77C71A83A150503770F

Validator #1 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #1 signature

59023784BCB802702AF77B03A342BF27FD6558BAF531819CD8B75357FB949C0C994347A441F885FE9F771398EE0F5C0E9578DD29B4865466E52CF26C971B8308

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

2229CA2335D9DD4A73B0AF9CAD69BA03569F284935B3D70F410A8BDD4B278CAB137799FBAB123093C9E527E0A532B3716B8B4CC9B7B300B67B0CA6A12DAAD70B