Type
CONTRACT
Validation date
2023-11-20 15:17:22 UTC
Fee
0 UCO

Code (931 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

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

    65673566391290C1FABA2D9F96B9E8633E41340E888CBBE330DBB4A9F18362FFEBBFFBD131445C68C031262F24816B430DE18427DE2CDEDC7AC02BEB

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

00011586F0C1ACA59A55FFA7EE934D8E881260A51D08AF5DD55B8FD17D2EF42E0251

Previous signature

D3EF777C35236749AF87689197FA82A8C0B084B5DE05263E6E5DC77D1898180E145B2EA33D4FD357F51B5DE48F02283F8BCA4981265999B3F566C1AB25AA3901

Origin signature

304402206B2F0B14E09B2FB468290ED4F5B3228D64600FA9F2A2B497B4EF0BAC42F95782022043C741DD3E526B5A6E42AEDC4BE02078DEDDCD868C6BA93B2C66466D75C18960

Proof of work

010204E9BB401A767B0C92D5DB139379AAB18E1B449B455F49E3A44F3466B2D38E59F0516B79493A528A95E5A74CF46F79CF12DEB73293458F6A4403D2B3E57D697347

Proof of integrity

000DA742EBA6886735711F35DA1DDA21ED540D3683D524700F10A3DA4C3226D0C4

Coordinator signature

DD38A7898B6227FAFD502E65A30C7B06A43F38FDE75F9059F81477EFE9A01FF54F7AB9469FA9B452BACED8BEFCD96DB07772293B2BA916747E0EB900E8034200

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

DADE76F1CCE88945F9CBC28CAF7B59EE169C0AAB1420BFE17D5BCB3B290FF7AB723100BD8ADDEA74FFC60D07D84F631BCAF575CB1478015FE440F2AAC36BC80D

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

4B88500B12A65A134B5846C5561C981317CA042CD9B26C04D241EF1E57448144E2A7222EE8871D00130B2CC05E9B62C69710957768D368E3495886741E495804