Type
CONTRACT
Validation date
2023-11-16 23:40:49 UTC
Fee
0 UCO

Code (931 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0x7b7ce61197fbaa55b2702237d67ae65105611f41", 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: 0x00006AFF130BEB6BE9B02B80FFC13DB5EABFB0A7D167BAFC9F2DF8F141D7755FB39F, amount: 0.04960075, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 1.4925e-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

    7A89F88B31C8DFBC4C1CCFAA9C6C8B039927A9D13942B01035C65FA6757199BB44697AC16372414EC95749BA56A98498E8E8F6F2DD97E90A3E8F90B7

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001F7C153DB6647C36CFE977770B07E165AD03660EF0526BFDF09BC303E1ABE29C6

Previous signature

2DEC57F988FE9F5CA84D0AEE27CCC44E3FB4B11AF5E94954FDE60F7D67EB02335E88E2C7530CB43F6DCD2B710CD76F94033E338BC7359DB44847D90932B8160F

Origin signature

3046022100BBA62E3C9AE1990CE6E741543A8F8EFF111BBF3E387971D0094E8756E85B1F68022100B02D27ECDF9419DBDBF0AE0C19B3391053D7EAF1FDD008513836577557FCCC7F

Proof of work

01020451684966573439C38DA99334546FBBDE4A6D96A50B4A4ECBB6572CDBED023F079607407E254421D1779525D11C60D55684F0B403B93B95823554E29D1E2CDB16

Proof of integrity

001FB4DCDE00391BCB9163D4B8637EAD60EC3C75512321FBC9B2E658B2181E7688

Coordinator signature

E7F900B7BAE32CC929105D072B989683EBABD0FE1E3ADC07F9403BB20418085EEEFFE24B237F5439260E6169FC9BA0D9F743A4E594AC416296369E57B257F309

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

E6E4025C1689761D6D2C87C24163DF294F6510162A9AA5FBFCF392B78AF6E7681A88DE7816A8340B82E29A10A23BD5DB391C21A609F02D8C577721DF63506906

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

657331154BAFC8BC670A9EF85DC815883261C548955F57D5700EA8B5A50082344EB000D5B0007B9F8CC415C98DF9CC78B330C658BF7F85BAE14E2FAA2B560902