Skip to content

Commit

Permalink
adds worldchain
Browse files Browse the repository at this point in the history
  • Loading branch information
0xNe0x1 committed Oct 7, 2024
1 parent d50f9c4 commit dec99d5
Show file tree
Hide file tree
Showing 11 changed files with 172 additions and 8 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ This library supports the following blockchains:
- [Avalanche](https://www.avax.network)
- [Gnosis](https://gnosis.io)
- [Base](https://base.org)
- [Worldchain](https://worldcoin.org/world-chain)
This library supports the following decentralized exchanges:
Expand Down
29 changes: 28 additions & 1 deletion dist/esm/index.evm.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 28 additions & 1 deletion dist/esm/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4202,7 +4202,7 @@ const exchange$9 = {
slippage: true,
fees: [100, 500, 3000, 10000],

blockchains: ['ethereum', 'bsc', 'polygon', 'optimism', 'arbitrum', 'base', 'avalanche'],
blockchains: ['ethereum', 'bsc', 'polygon', 'optimism', 'arbitrum', 'base', 'avalanche', 'worldchain'],

ethereum: {
router: {
Expand Down Expand Up @@ -4358,6 +4358,28 @@ const exchange$9 = {
}
},

worldchain: {
router: {
address: '0x091AD9e2e6e5eD44c1c66dB50e49A601F9f36cF6',
api: UniswapV3.ROUTER
},
factory: {
address: '0x7a5028BDa40e7B173C278C5342087826455ea25a',
api: UniswapV3.FACTORY
},
pool: {
api: UniswapV3.POOL
},
quoter: {
address: '0x10158D43e6cc414deE1Bd1eB0EfC6a5cBCfF244c',
api: UniswapV3.QUOTER
},
permit: {
address: '0x000000000022d473030f116ddee9f6b43ac78ba3',
api: UniswapV3.PERMIT2
}
},

};

var uniswap_v3 = (scope)=>{
Expand Down Expand Up @@ -4855,6 +4877,11 @@ exchanges.gnosis = [
];
exchanges.gnosis.forEach((exchange)=>{ exchanges.gnosis[exchange.name] = exchange; });

exchanges.worldchain = [
uniswap_v3('worldchain'),
];
exchanges.worldchain.forEach((exchange)=>{ exchanges.worldchain[exchange.name] = exchange; });

let route = ({
blockchain,
tokenIn,
Expand Down
29 changes: 28 additions & 1 deletion dist/umd/index.evm.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 28 additions & 1 deletion dist/umd/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4207,7 +4207,7 @@
slippage: true,
fees: [100, 500, 3000, 10000],

blockchains: ['ethereum', 'bsc', 'polygon', 'optimism', 'arbitrum', 'base', 'avalanche'],
blockchains: ['ethereum', 'bsc', 'polygon', 'optimism', 'arbitrum', 'base', 'avalanche', 'worldchain'],

ethereum: {
router: {
Expand Down Expand Up @@ -4363,6 +4363,28 @@
}
},

worldchain: {
router: {
address: '0x091AD9e2e6e5eD44c1c66dB50e49A601F9f36cF6',
api: UniswapV3.ROUTER
},
factory: {
address: '0x7a5028BDa40e7B173C278C5342087826455ea25a',
api: UniswapV3.FACTORY
},
pool: {
api: UniswapV3.POOL
},
quoter: {
address: '0x10158D43e6cc414deE1Bd1eB0EfC6a5cBCfF244c',
api: UniswapV3.QUOTER
},
permit: {
address: '0x000000000022d473030f116ddee9f6b43ac78ba3',
api: UniswapV3.PERMIT2
}
},

};

var uniswap_v3 = (scope)=>{
Expand Down Expand Up @@ -4860,6 +4882,11 @@
];
exchanges.gnosis.forEach((exchange)=>{ exchanges.gnosis[exchange.name] = exchange; });

exchanges.worldchain = [
uniswap_v3('worldchain'),
];
exchanges.worldchain.forEach((exchange)=>{ exchanges.worldchain[exchange.name] = exchange; });

let route = ({
blockchain,
tokenIn,
Expand Down
23 changes: 23 additions & 0 deletions examples/uniswap_v3/worldchain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# 1 Pool

## ETH TO TOKEN

### amountOutMin

```javascript
let route = await Web3Exchanges.uniswap_v3.route({
blockchain: 'worldchain',
tokenIn: Web3Blockchains.worldchain.currency.address,
tokenOut: '0x79A02482A880bCE3F13e09Da970dC34db4CD24d1', // USDC.e
amountOutMin: 0.01
})

let wallets = await Web3Wallets.getWallets()
let wallet = wallets[0]
let account = await wallet.account()

let prep = await route.getPrep({ account })

let transaction = await route.getTransaction({ account })
wallet.sendTransaction(transaction)
```
2 changes: 1 addition & 1 deletion package.evm.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@depay/web3-exchanges-evm",
"moduleName": "Web3Exchanges",
"version": "13.10.0",
"version": "13.11.0",
"description": "JavaScript library simplifying decentralized web3 exchange routing for multiple blockchains and exchanges.",
"main": "dist/umd/index.evm.js",
"module": "dist/esm/index.evm.js",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@depay/web3-exchanges",
"moduleName": "Web3Exchanges",
"version": "13.10.0",
"version": "13.11.0",
"description": "JavaScript library simplifying decentralized web3 exchange routing for multiple blockchains and exchanges.",
"main": "dist/umd/index.js",
"module": "dist/esm/index.js",
Expand Down
2 changes: 1 addition & 1 deletion package.solana.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@depay/web3-exchanges-solana",
"moduleName": "Web3Exchanges",
"version": "13.10.0",
"version": "13.11.0",
"description": "JavaScript library simplifying decentralized web3 exchange routing for multiple blockchains and exchanges.",
"main": "dist/umd/index.solana.js",
"module": "dist/esm/index.solana.js",
Expand Down
10 changes: 10 additions & 0 deletions src/exchanges.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ exchanges.gnosis = [
]
exchanges.gnosis.forEach((exchange)=>{ exchanges.gnosis[exchange.name] = exchange })

exchanges.worldchain = [
uniswap_v3('worldchain'),
]
exchanges.worldchain.forEach((exchange)=>{ exchanges.worldchain[exchange.name] = exchange })


/*#elif _SOLANA

Expand Down Expand Up @@ -227,6 +232,11 @@ exchanges.gnosis = [
]
exchanges.gnosis.forEach((exchange)=>{ exchanges.gnosis[exchange.name] = exchange })

exchanges.worldchain = [
uniswap_v3('worldchain'),
]
exchanges.worldchain.forEach((exchange)=>{ exchanges.worldchain[exchange.name] = exchange })

//#endif

export default exchanges
24 changes: 23 additions & 1 deletion src/exchanges/uniswap_v3.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const exchange = {
slippage: true,
fees: [100, 500, 3000, 10000],

blockchains: ['ethereum', 'bsc', 'polygon', 'optimism', 'arbitrum', 'base', 'avalanche'],
blockchains: ['ethereum', 'bsc', 'polygon', 'optimism', 'arbitrum', 'base', 'avalanche', 'worldchain'],

ethereum: {
router: {
Expand Down Expand Up @@ -167,6 +167,28 @@ const exchange = {
}
},

worldchain: {
router: {
address: '0x091AD9e2e6e5eD44c1c66dB50e49A601F9f36cF6',
api: UniswapV3.ROUTER
},
factory: {
address: '0x7a5028BDa40e7B173C278C5342087826455ea25a',
api: UniswapV3.FACTORY
},
pool: {
api: UniswapV3.POOL
},
quoter: {
address: '0x10158D43e6cc414deE1Bd1eB0EfC6a5cBCfF244c',
api: UniswapV3.QUOTER
},
permit: {
address: '0x000000000022d473030f116ddee9f6b43ac78ba3',
api: UniswapV3.PERMIT2
}
},

}

export default (scope)=>{
Expand Down

0 comments on commit dec99d5

Please sign in to comment.