Giter VIP home page Giter VIP logo

0x-starter-project's People

Contributors

aj07 avatar akagi201 avatar alexkroeger avatar bmillman19 avatar chriskalani avatar dekz avatar dependabot-preview[bot] avatar dependabot-support avatar dhl avatar fabioberger avatar fragosti avatar jlin27 avatar kimpers avatar logvinovleon avatar scoriiu avatar sotawatanabe avatar zkjet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

0x-starter-project's Issues

How to Unwrap ETH

Hey,

I was just wondering, how can we perform reverse of Wrapping ETH, that means converting WETH to ETH again through code ?

Please Suggest.
Thanks

not works with mainnet

tried on mainnet ubuntu 18 with infura and stucks the pc is lagged and stucks leak of memory..
not working with mainnet building ....

0x protocol version 2 Get token by symbol

As we are using
await zeroEx.tokenRegistry.getTokenBySymbolIfExistsAsync('WETH') this method is used in Verion v0 how to get this in verison v2 Can any one please help me in this ?

Error running yarn on windows

Hello guys,
I'm trying to run the 0x-starter-project on windows 10.
I got stuck at early stages while running the "yarn" command line .
I got this error as shown in the screenshot
erryarn

I have looked it up, and im guessing perhaps it was produced cause i haven't ran : brew install yarn --without-node. But obviously i can not run it since Homebrew is specific to MacOSX and it doesn't exist
for windows...

Does anyone have an idea how to make it work?
Thank you !

How to lock the token

Hi,

I just wanted to know how to lock the token
Ex: We are unlocking the token using

0x.js

zeroEx.token.setUnlimitedProxyAllowanceAsync vise versa as a revert process i want to lock the token
Thanks in advance

By placing an order facing issue

I tried to place the order as we released our site in server, but it was working in local after changing the according to Production terms i am getting an error like Bad Gateway only for placing order API. What may be the mistake

Place order in 0x V2

Getting error in console as INVALID_SIGNATURE. What mistake i did that it comes like this
image
Can any one help me in this

How was the ganache snapshot generated?

I'm trying to test my own smart contracts that call 0x as well as other exchanges. I can't use the ganache snapshot provided by 0x because I am already using a snapshot provided by another project.

How can I deploy the 0x contracts to my ganache network without using your snapshot?

v2 support

Hey there, was just wondering if there is going to be a starter-project using version 2 of the 0x protocol.

Module ''bn.js'' has no exported member 'BigNumber'.

yarn run order_actions

yarn run v1.6.0
$ run-s build tutorial:order_actions
$ tsc
node_modules/web3/types.d.ts(1,10): error TS2305: Module ''bn.js'' has no exported member 'BigNumber'.
node_modules/web3/types.d.ts(1,27): error TS2497: Module ''bn.js'' resolves to a non-module entity and cannot be imported using this construct.
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
ERROR: "build" exited with 1.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

[Question] How to finish the trade with ETH not WETH for maker and taker?

0x Protocol doesn't directly support Token-ETH trade, so it needs to wrapper ETH to WETH.
If I use fillOrder to finish the order, taker should wrapper ETH to WETH before. If marketBuyOrdersWithEth, taker can trade with ETH directly. (I know the contract wrapper ETH to WETH instead of taker)
But, for maker, him always receives the WETH Token. is any way that can make maker receives ETH directly?

Missing code for validating order is fillable before calling fillOrder

In src/scenarios/fill_order_erc20.ts, originally there was code that validates the order is fillable before calling fillOrder. However, this part was missing in the new version. I understand the function was moved to OrderUtils, but i’d be nice to add this function back so that people can see how to use it.

Failed to install dependencies

I got this error when installing the dependencies. Can anyone help?

$ yarn install
00h00m00s 0/0: : ERROR: [Errno 2] No such file or directory: 'install'

when I run npm run dev i show these errors

when I run npm run dev i show these errors [email protected] dev C:\Users\hicham\Desktop\project\0x
npm run build; node ./lib/index.js

m ERR! missing script: build;

m ERR! A complete log of this run can be found in:
m ERR! C:\Users\hicham\AppData\Roaming\npm-cache_logs\2018-01-12T16_07_12
80Z-debug.log
m ERR! code ELIFECYCLE
m ERR! errno 1
m ERR! [email protected] dev: npm run build; node ./lib/index.js
m ERR! Exit status 1
m ERR!
m ERR! Failed at the [email protected] dev script.
m ERR! This is probably not a problem with npm. There is likely additional log
ng output above.

m ERR! A complete log of this run can be found in:
m ERR! C:\Users\hicham\AppData\Roaming\npm-cache_logs\2018-01-12T16_07_12
58Z-debug.log

Clone the repo issue

git clone [email protected]:0xProject/0x.js-starter-project.git
When I run this command I am getting the below error

**Cloning into '0x.js-starter-project'...
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.**

I tried running with sudo, doesn't work either.
However cloning this https://github.com/0xProject/0x-starter-project.git worked, but the problem I was facing from the one mentioned in the 0x wiki command.

Fill order

Getting this error when i try to fill the order

image

'JSON RPC response has no result' when using fillLimitOrder

Hello, It is my first time testing the 0x API for limit orders.

Im creating some hardhat tasks to create and fill Limit Orders. Ive followed the tutorial fill_order_example but Im receiving this error `JSON RPC response has no result' I don't know why.

The exact message error is:

Error: JSON RPC response has no result
    at Web3Wrapper.<anonymous> (<folder>/node_modules/@0x/web3-wrapper/src/web3_wrapper.ts:789:19)
    at Generator.next (<anonymous>)
    at fulfilled (<folder>/node_modules/@0x/web3-wrapper/lib/src/web3_wrapper.js:5:58)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)

Below is the code of my task:

const utils = require('@0x/protocol-utils')
const { ContractWrappers, ERC20TokenContract } = require('@0x/contract-wrappers')
const BigNumber = require('bignumber.js')
const contractAddresses = require('@0x/contract-addresses')

task('fillLimitOrder', 'Fill Limit Order')
  .addOptionalParam('gasmultiplier', 'gasmultiplier')
  .setAction(async ({ gasmultiplier = 2 }, hre) => {
    console.log('fillLimitOrder')

    // 1) Get Exchange Address for Polygon
    // 2) Approve Maker Token (CCB Token)
    // 3) Approve Taker Token (USDC)
    // 4) Fetch ordertxHash
    // 5) Use the number 4) to fill the order

    const CHAIN_ID = 137
    const marketTokenAddress = '0x41d2f09f4899f16ed0ed86f8487018cc8c91f547'
    const takerTokenAddress = '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174'
    const marketTokenContract = await hre.ethers.getContractAt('ERC20', marketTokenAddress)
    const takerTokenContract = await hre.ethers.getContractAt('ERC20', takerTokenAddress)
    const MAX_UINT = hre.ethers.MaxUint256

    const contractWrappers = new ContractWrappers(hre.ethers.provider, { chainId: CHAIN_ID })

    const [makerSigner, takerSigner] = await hre.ethers.getSigners()
    const takerAddress = await takerSigner.getAddress()
    console.log('takerAddress', takerAddress)

    const addresses = contractAddresses.getContractAddressesForChainOrThrow(
      CHAIN_ID
    )
    const exchangeAddress = addresses.exchangeProxy

    console.log('approving maker token')
    await marketTokenContract.approve(exchangeAddress, MAX_UINT)

    console.log('approving taker token')
    await takerTokenContract.connect(takerSigner).approve(exchangeAddress, MAX_UINT)

    const order = {
      sender: '0x0000000000000000000000000000000000000000',
      maker: '0x7e28184ebf20437051034232e7b9cbaa43d901d6',
      taker: '0x0000000000000000000000000000000000000000',
      takerTokenFeeAmount: '0',
      makerAmount: '1000000000000000000',
      takerAmount: '1000000',
      makerToken: '0x41d2f09f4899f16ed0ed86f8487018cc8c91f547',
      takerToken: '0x2791bca1f2de4661ed88a30c99a7a9449aa84174',
      salt: '1698147146829',
      verifyingContract: '0xdef1c0ded9bec7f1a1670819833240f027b25eff',
      feeRecipient: '0x0000000000000000000000000000000000000000',
      expiry: '1698150146',
      chainId: 137,
      pool: '0x0000000000000000000000000000000000000000000000000000000000000000'
    }
    const orderSignature = {
      signatureType: 2,
      r: '0xe83f724835b9f932da5e08a749aab5ecf866b4febad9e0a4a0e43b67034f4c42',
      s: '0x767590a016cab96469d5513a91e1223fa0564c067242e17218562ea8f530c644',
      v: 28
    }
    const takerAssetAmount = new BigNumber('100000')

    // get the protocol fee multiplier
    // protocol fee = multiplier * gasPrice * numOrders
    const protocolFeeMultiplier = new BigNumber(
      await contractWrappers.exchangeProxy.getProtocolFeeMultiplier().callAsync()
    )

    const feeData = hre.provider.getFeeData()
    console.log('feeData', feeData)

    const calculateProtocolFee = (
      numOrders,
      multiplier
    ) => {
      return multiplier.times(feeData.gasPrice).times(numOrders)
    }
    // Fill the Order via 0x Exchange Proxy contract
    try {
      const txHash = await contractWrappers.exchangeProxy
        .fillLimitOrder(order, orderSignature, takerAssetAmount)
        .sendTransactionAsync({
          from: taker,
          value: calculateProtocolFee(1, protocolFeeMultiplier),
          gasPrice: feeData.gasPrice * 2n
        })

      console.log(txHash)
    } catch (err) {
      console.log(err)
    }
  })

Exports error

While importing 0x.js using script in index html it shows Uncaught ReferenceError: exports is not defined at 0x.js:43
Object.defineProperty(exports, "__esModule", { value: true }); // shows error at this line

Action required: Greenkeeper could not be activated 🚨

🚨 You need to enable Continuous Integration on Greenkeeper branches of this repository. 🚨

To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because it uses your CI build statuses to figure out when to notify you about breaking changes.

Since we didn’t receive a CI status on the greenkeeper/initial branch, it’s possible that you don’t have CI set up yet. We recommend using Travis CI, but Greenkeeper will work with every other CI service as well.

If you have already set up a CI for this repository, you might need to check how it’s configured. Make sure it is set to run on all new branches. If you don’t want it to run on absolutely every branch, you can whitelist branches starting with greenkeeper/.

Once you have installed and configured CI on this repository correctly, you’ll need to re-trigger Greenkeeper’s initial pull request. To do this, please click the 'fix repo' button on account.greenkeeper.io.

maybe something wrong with your code

Description

I follow this" https://0xproject.com/wiki#Create,-Validate,-Fill-Orderat " to try,but after typing yarn order_actions ,it return:

dean@dean-ST-S:~/0x-starter-project yarn order_actionsyarn run v1.6.0 yarnorder
​a
​​ ctionsyarnrunv1.6.0 run-s build tutorial:order_actions
$ tsc
src/tutorials/order_actions/index.ts(2,27): error TS2307: Cannot find module '@0xproject/utils'.
src/tutorials/relayer_actions/index.ts(14,27): error TS2307: Cannot find module '@0xproject/utils'.
src/tutorials/relayer_websocket/custom_orderbook_channel_handler.ts(10,27): error TS2307: Cannot find module '@0xproject/utils'.
src/tutorials/relayer_websocket/generate_initial_book.ts(12,27): error TS2307: Cannot find module '@0xproject/utils'.
src/tutorials/relayer_websocket/generate_new_orders_with_interval.ts(12,27): error TS2307: Cannot find module '@0xproject/utils'.
src/utils/server.ts(2,27): error TS2307: Cannot find module '@0xproject/utils'.
../node_modules/web3/types.d.ts(1,10): error TS2305: Module ''bn.js'' has no exported member 'BigNumber'.
../node_modules/web3/types.d.ts(1,27): error TS2497: Module ''bn.js'' resolves to a non-module entity and cannot be imported using this construct.
../node_modules/web3/types.d.ts(2,21): error TS7016: Could not find a declaration file for module 'underscore'. '/home/dean/node_modules/underscore/underscore.js' implicitly has an 'any' type.
  Try `npm install @types/underscore` if it exists or add a new declaration (.d.ts) file containing `declare module 'underscore';`
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
ERROR: "build" exited with 1.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

I think there is something wrong with your code in github because there is not @0xproject/utils
where is the BigNumber?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.