Skip to main content
The Deno 2 Release Candidate is here
Learn more

Freedomswaps

🦕 module to simplify uniswap interactions by leveraging smart contracts like LightSpeedSwaps fostering the adoption of decentralized exchanges.

Thanks to brightinventions.pl.

Usage Examples Via TypeScript

Exact Input

import { FreedomSwaps } from "https://deno.land/x/freedomswaps/mod.ts"

const tokenIn = "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270" // Matic on Polygon POS
const tokenOut = "0x099471B71c9D8b0C6b616eE9A7C645e22cA9cfF7" // Freiheit on Polygon POS
const amountIn = BigInt(1000000000000000000) // assuming 18 decimals this would swap 1 Coin
const poolFee = 10000
const slippage = 30
const providerURL = Deno.args[0]
const pkTestWallet = Deno.args[1]

if (providerURL === undefined || pkTestWallet === undefined) {
    throw new Error("parameter missing")
}

const freedomSwaps = await FreedomSwaps.getInstance(providerURL)
await freedomSwaps.swap(tokenIn, tokenOut, amountIn, poolFee, slippage, pkTestWallet)

Exact Output

import { FreedomSwaps } from "https://deno.land/x/freedomswaps/mod.ts"

const tokenIn = "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270" // Matic on Polygon POS
const tokenOut = "0xb841a4f979f9510760ecf60512e038656e68f459" // Geld on Polygon POS
const amountOut = BigInt(1296000 * 10**18) // assuming 18 decimals 
const poolFee = 10000
const slippage = 9
const providerURL = Deno.args[0]
const pkTestWallet = Deno.args[1]

if (providerURL === undefined || pkTestWallet === undefined) {
    throw new Error("parameter missing")
}

const freedomSwaps = await FreedomSwaps.getInstance(providerURL)

await freedomSwaps.swapExactOutput(tokenIn, tokenOut, amountOut, poolFee, slippage, pkTestWallet)

Usage Example Static Via Terminal

Exact Input

# deno run --allow-net --allow-read --allow-write --allow-env https://deno.land/x/freedomswaps/usage-example-exact-input-static.ts <tokenIn> <tokenOut> <amountIn> <poolFee> <slippage> <providerURL> <privateKeyTestWallet>
deno run --allow-net --allow-read --allow-write --allow-env https://deno.land/x/freedomswaps/usage-example-exact-input-static.ts 0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270 0x099471B71c9D8b0C6b616eE9A7C645e22cA9cfF7 1000000000000000000 10000 9 https://polygon-mainnet.g.alchemy.com/v2/... <your experimental pk>

Exact Output

deno run –allow-net –allow-read –allow-write –allow-env https://deno.land/x/freedomswaps/usage-example-exact-output-static.ts

deno run –allow-net –allow-read –allow-write –allow-env https://deno.land/x/freedomswaps/usage-example-exact-output-static.ts 0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270 0x099471B71c9D8b0C6b616eE9A7C645e22cA9cfF7 1000000000000000000 10000 9 https://polygon-mainnet.g.alchemy.com/v2/…

About us

We are Friends of Satoshi.

Chancellor on brink of second bailout for banks.

chancellor-on-brink-of-second-bailout-for-banks

chancellor-on-brink-of-second-bailout-for-banks-starter

We are free.