Skip to content

πŸ¦„ πŸ¦„ πŸ¦„ Core smart contracts of Uniswap v3 implemented in CosmWasm

Notifications You must be signed in to change notification settings

oraidex/oraiswap-v3

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

ORAI SWAP - Uniswap V3 in CosmWasm

  β–‘β–‘
β–‘β–‘β–‘β–‘              β–‘β–‘β–‘β–‘β–‘β–‘
β–‘β–‘β–‘β–‘  β–‘β–‘            β–‘β–‘β–‘β–‘β–‘β–‘
β–‘β–‘β–‘β–‘  β–‘β–‘        β–‘β–‘    β–‘β–‘β–’β–’
β–‘β–‘β–‘β–‘β–‘β–‘β–’β–’          β–‘β–‘β–’β–’β–‘β–‘β–’β–’
  β–‘β–‘β–’β–’                β–‘β–‘β–’β–’
    β–‘β–‘β–’β–’  β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘  β–‘β–‘β–’β–’
      β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘
    β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–ˆβ–ˆβ–‘β–‘β–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–‘
    β–’β–’β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–’β–’
  β–‘β–‘β–‘β–‘β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–‘β–‘β–‘β–‘
  β–‘β–‘β–‘β–‘  β–’β–’β–‘β–‘    β–‘β–‘β–’β–’  β–‘β–‘β–‘β–‘
  β–‘β–‘    β–’β–’        β–’β–’    β–‘β–‘


                                ,,)))))));,
                                __))))))))))))));,
                            -\(((((''''((((((((
                    --==//////((''  .     `)))))),
                            ))| @    ;-.     (((((
                            ( `|    /  )      )))/- ----------_\__---~~__--~~--_
                                |   |   |       (/      ---~~~/__-----~~  ,;::'  \         ,
                                o_);   ;        /      ----~~/           \,-~~~\  |       /|
                                    ;        (      ---~~/         `:::|      |;|      < >
                                    |   _      `----~~~~'      /      `:|       \;\_____//
                                ______/\/~    |                 /        /         ~------~
                            /~;;.____/;;'  /          ___----(   `;;;/
                            / //  _;______;'------~~~~~    |;;/\    /
                            //  | |                        /  |  \;;,\
                        (<_  | ;                      /',/-----'  _>
                            \_| ||_                     //~;~~~~~~~~~
                                `\_|                   (,~~
                                                        \~\
                                                        ~~

build wasm sdk

cd wasm && wasm-pack build --features tsify/js

convert all wasm_bingen to camel case

node convert.js

const { readdirSync, readFileSync, writeFileSync } = require('fs');
const { join } = require('path');

function walk(dir, ext = '.rs') {
  return readdirSync(dir, { withFileTypes: true })
    .flatMap((file) => (file.isDirectory() ? walk(join(dir, file.name), ext) : file.name.endsWith(ext) ? join(dir, file.name) : null))
    .filter(Boolean);
}

const reg = /(?<=#\[wasm_bindgen)\]([\n\t\s])+(?=pub\s+fn\s+([\w_]+)\()/g;

const rustFiles = walk('wasm');

for (const file of rustFiles) {
  const fileContent = readFileSync(file)
    .toString()
    .replace(reg, (_, g1, g2) => {
      const fnName = g2
        .split('_')
        .map((part, i) => (i > 0 ? part[0].toUpperCase() + part.substr(1) : part))
        .join('');
      return `(js_name = ${fnName})]${g1}#[allow(non_snake_case)]${g1}`;
    });

  writeFileSync(file, fileContent);
}

About

πŸ¦„ πŸ¦„ πŸ¦„ Core smart contracts of Uniswap v3 implemented in CosmWasm

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages