Type
CONTRACT
Validation date
2023-11-22 02:43:31 UTC
Fee
0 UCO

Code (934 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0x550782d441a687256c43014cd8f8e2f80d2a67e5", 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: 0x00001675BECDA24450FAD82114A15B58567979E8E7AEA1CFFC54CE8C1779513EA2AF, amount: 0.0992015, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 2.985e-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

    B24906848817CF0858F344D2C4FD329BBEC582114D4BAAED195300D58A1F5AAB933EC1E3A81B60B96F183F739724E93AA060C86B56910FA6A1AE398E

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

000159E47169C6268F1DEE1D26BBCD28A0DBE6F0DE0BEF98032392EAC7670866D823

Previous signature

FE9BDCA0AAC88073E55B62E0A09E55848AEB32CC68494BA0713AFA493F5D7767FD058BB3F5BB2D85D1058F13332E4F5AFC73604A0E4C08B0CEBD0DA1D8B4F801

Origin signature

304502205BCAFCAFDC85A493C9D1C4B37C124E225482E6A4AB7FB75ECCF8B2C6A74C717E022100D318003E8402018FDB3944FA476E5EE0FDD3ABEBBF137E816D22158A40DCDCB6

Proof of work

010204AA023E1E039788AD4B8F713C8871CA39A177414A99A0788993AD725B1FBB7AD5E4CAC86151A9E03451DCACB1EFC100B1E450FCEDAF5E5005F3A4C503D1D29712

Proof of integrity

00AED5F732BA642930C577487683444EEE6CAC7999EC49142594965F7F861B9715

Coordinator signature

54D6C284160961792487F6B2D78F31E5E0C2D62474096B9ACE1F87B8C0AC2D1551C2659DB910F11FCA3D3AEB4204DF740BD7969BF01D04B53F22BE35C7229403

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

53726F1F4B80985760856945F3C3BB12CD5F2403E5FEFC60C764BB902916DADF56D8B78DCECA6E812CF75E14C00E75EC4BED7FE3DDF7BE419E4E339D6F61C60E

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

267A050DDF7C5E6CD8C862A77B9A3C75962E56E810282A1572E43F82C5544BBA8147568890DDAA4E59250D42CD4A339567788052C8B6EA99CBF969DCA8F1B40D