Type
CONTRACT
Validation date
2023-11-14 10:58:36 UTC
Fee
0 UCO

Code (934 B)

  @version 1

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

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

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

    617E169BB9FA2D238583F91DD54C9419E9B464A4CDCC5CAE818B65EB3B03FBF3CD9ED0813603C66C03A10132F78AAA081904AABF660A8DAA84AEA41C

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001F696908CD5C1D3220F24A94130E7B3E23328F8AC70FB5DBF113423B68210AC50

Previous signature

22E3BFDB35FA1CB1C1D8FD946BEE8354C9EF8647B619BF01F20ACA90B60735AE076C617BF882A53DCA3AF12D09967F5B66FAB73F87B81DCAD70D58B9D4B3E10E

Origin signature

3045022100A00A2094E22CD5B706AAED52062400FEE8C048A2272CF3BD1ED54DDF1334032E02207E4351C0D6E224D58BB3B586E1085A53DB3AE9BEFF23F80FD834A3F080E50A54

Proof of work

010204892A04DBE05192BCB662689E7E19700F3F7202028EF0A9F20635C4948436ED85A43BA3017281EE97781342DD8F24ED6F583B5FE542830FDB5191A11843A72A61

Proof of integrity

0067FA36CAA7581BF0C30E63F84C70A7EE1EF7CA5BACC20AE96A61EAB803CB91F1

Coordinator signature

A5FF2D3B9FDF65D44F07373C0BE547758EA50D3D84C928197B77E06F20EE3B4F2B6CB9231F04CE5221D6274EBD61C630774FA5FACB83B08D9B9D5309FBB2DC01

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

4FA41BA9558E97BF4E0471CD8F6E764E27AB03F6741691D932EBBBA6CB06852BC1AC3D54E6511A6C8DDBBB7D3EADB01D0D3DC2F53D99F453EAE50ABBC30B600B

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

35A0FCE97A11B7D55FB00F46274C7AC81B1B82326F4F06AF7D105AA8BA0E5831B631073DE233351B5ACC7682D52681FDE397487DE4734E30F2D7028D6E193607