npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

dustn

v1.0.32

Published

Dustin: High Level Smart Contract for TON Chain

Downloads

12

Readme

DUSTN

A high level smart contract language based with solidity-like syntax for TON Chain

Dustn compiles to Func 4x smaller bytecode vs Tact

Join

Why?

  • We want a developer friendly smart contract
  • We want a shorter and optimized code
  • We want a smaller bytecode on compilation
  • We want a language that writes on both func, fift and base64

Initialize Your Project

npx dustn init

Create a Dustin Smart Contract

npx dustn create ContractName

Compiles the contract

npx dustn compile ContractName

Reference

| Data Type | Func Type | |---|---| | address | slice | | cell | cell | | string | cell | | uint256 | int | | uint128 | int | | uint64 | int | | uint32 | int | | uint16 | int | | uint8 | int | | uint1 | int | | bool | int |

Create receiver methods on the fly with operation codes for internal functions

  /// Adds const op::mint = "op::mint"c; in the header
  function mint(address sender, address toAddress, uint256 amount) internal {}

  /// Adds int op::mint() asm "0x12345 PUSHINT";
  function mint_12345(address sender, address toAddress, uint256 amount) internal {}

  Automatically generates the crc32c Method HEX ID
  /// Adds int op::mint() asm "0xe4a55bbc PUSHINT";
  function mint_asm(address sender, address toAddress, uint256 amount) internal {}

Features

  • Dynamically creates save_data and load_data
  • Internal functions as operations
  • Optimized getter functions via external
  • Extract and fill function parameters from message body
  • Instantly generates the opcodes
  • Instantly generates operation via internal functions
  • Ability to reuse internal functions
  • Added support for dictionaries or hashmap

Simple Counter

contract Counter {
  uint32 id;
  uint32 counter;

  function increment_asm(uint32 increasedBy) internal {
    counter += increasedBy;
    id += 1;
  }

  function getCounter() public returns(uint32) {
    return counter;
  }

  function getID() public returns(uint32) {
    return id;
  }
}

To Func

int op::increment() asm "0xe4a55bbc PUSHINT";
       
slice verify_address(slice address) inline {
  throw_unless(136, address.slice_bits() == 267);
  var h = address.preload_uint(11);
  throw_if(137, h == 1279);
  throw_unless(136, h == 1024);
  return address;
}

_ load_data() inline {
  var ds = get_data().begin_parse();
  return (
    ds~load_uint(32),
    ds~load_uint(32)
     
  );
}

() save_data(int $id, int $counter) impure inline {
  set_data(
    begin_cell()
      .store_uint($id, 32)
      .store_uint($counter, 32)
             
      .end_cell()  
  );
}

() internal_increment(int $increasedBy) impure {
  
  (int $id, int $counter) = load_data();
  $counter += $increasedBy;
  $id += 1;
  save_data($id, $counter);
}
    

() recv_internal(int $msgBalance, int $msgValue, cell in_msg_full, slice in_msg_body) impure {
  if (in_msg_body.slice_empty?()) { ;; ignore all empty messages
    return ();
  }

  var cs = in_msg_full.begin_parse();
  var msg_flags = cs~load_uint(4);
  var $bounced = -(msg_flags & 1);
  slice $sender = verify_address(cs~load_msg_addr());

  if ($bounced) {
    return ();
  }

  int $op = in_msg_body~load_uint(32);
  int $queryId = in_msg_body~load_uint(64);
  
  if ($op == op::increment()) {
     
    int $increasedBy = in_msg_body~load_uint(32);
    internal_increment($increasedBy);
    return ();
  }
      
  throw(0xffff);

}

(int) get_counter() method_id {
  
  (_, int $counter) = load_data();
  return $counter;
}

(int) get_id() method_id {
  
  (int $id, _) = load_data();
  return $id;
}

To Base64 Code

te6ccgEBCAEAgAABFP8A9KQT9LzyyAsBAgFiAgMCAs0EBQIBbgYHAFnTYREGOASK3wAOhpgZg42FHImHBpj+mfmMEIclKt3gldSumPmHgCcBhCB/l4QALddqJoaY/pj5gsUADSAIDkZY/lj+T2qkABe1Rz2omhpj+mPmBhAAF7Y//aiaGmP6Y+YGMA==

Bytecode Size: 0.000139 MB

🫰 Handcrafted in ❤️ by Xircus