Giter VIP home page Giter VIP logo

Comments (12)

fabioberger avatar fabioberger commented on August 19, 2024

@narmadhasugumar to reverse the process set the allowance to 0. You can do this using:

zeroEx.token.setProxyAllowanceAsync(new BigNumber(0));

Or in-case you are using the V2 0x.js library (>= 1.0.1):

contractWrappers.erc20Token.setProxyAllowanceAsync(new BigNumber(0));

from 0x-starter-project.

narmadhasugumar avatar narmadhasugumar commented on August 19, 2024

@fabioberger, This is for locking the token?..
zeroEx.token.setProxyAllowanceAsync(new BigNumber(0));

And if i want to get the unlocked contract tokens and loked contract tokens dynamically how to get that one ?

from 0x-starter-project.

narmadhasugumar avatar narmadhasugumar commented on August 19, 2024

How to get
const zeroEx = new ZeroEx(web3js.currentProvider, { networkId: networkId })
networkid dynamically?
If i am trying to get dynamically it shows error like this
image

from 0x-starter-project.

narmadhasugumar avatar narmadhasugumar commented on August 19, 2024

@narmadhasugumar to reverse the process set the allowance to 0. You can do this using:

zeroEx.token.setProxyAllowanceAsync(new BigNumber(0));

Or in-case you are using the V2 0x.js library (>= 1.0.1):

contractWrappers.erc20Token.setProxyAllowanceAsync(new BigNumber(0));

by locking it doesn't sign into metamask for permission?As u suggested i tried but not working i think
@fabioberger

from 0x-starter-project.

fabioberger avatar fabioberger commented on August 19, 2024

@narmadhasugumar I cannot understand your issue fully. Please write in full sentences and try and describe the issue you are facing fully.

As for the networkId issue, make sure the networkId you are passing in is a number, not a string.

from 0x-starter-project.

narmadhasugumar avatar narmadhasugumar commented on August 19, 2024

First Issue:
I just want to UNLOCK and LOCK the token, here in below image WETH can locked & unlocked, so i am able to UNLOCK the token but unable to LOCK the token, and unable to get the UNLOCKED tokens from. Just want to know how to LOCK and how to get the UNLOCKED list of tokens
image.

SECOND ISSUE:
Is we have any possibilities to get the networkId dynamically instead of mentioning the networkid : 1 (statically)

Are you getting my issue @fabioberger

from 0x-starter-project.

fabioberger avatar fabioberger commented on August 19, 2024

@narmadhasugumar the UI showing "locked" and "unlocked" is a simplification of the reality. In reality, users are setting and unsetting their addresses' allowance to the 0x proxy contract. Locked is when the allowance set is 0, unlocked is when it's set to the largest possible allowance amount 2^256-1.

Setting allowances always requires the user to send a TX to the network.

from 0x-starter-project.

narmadhasugumar avatar narmadhasugumar commented on August 19, 2024

ok thank you @fabioberger for the explanation you gave for locking and unlocking i will try

below code is for unlock

 await Promise.all(addresses.map(address => {
      return zeroEx.token.setUnlimitedProxyAllowanceAsync(WETH_ADDRESS, address)
 }))

and, for lock
zeroEx.token.setProxyAllowanceAsync(new BigNumber(0))

from 0x-starter-project.

fabioberger avatar fabioberger commented on August 19, 2024

Np. Yes, that is correct but be sure to also await that those transactions are mined (you can use: https://0xproject.com/docs/web3-wrapper#Web3Wrapper-awaitTransactionSuccessAsync).

Good luck!

from 0x-starter-project.

narmadhasugumar avatar narmadhasugumar commented on August 19, 2024

ok thankyou @fabioberger .

One more think i want to know,

const zeroExConfig: ZeroExConfig = {
       networkId: 50, // testrpc
};

Is this the only way to get networkid directly, we cnt't take dynamically ? I am new to this platform so have so many doubts

from 0x-starter-project.

fpChan avatar fpChan commented on August 19, 2024

First Issue:
I just want to UNLOCK and LOCK the token, here in below image WETH can locked & unlocked, so i am able to UNLOCK the token but unable to LOCK the token, and unable to get the UNLOCKED tokens from. Just want to know how to LOCK and how to get the UNLOCKED list of tokens
image.

SECOND ISSUE:
Is we have any possibilities to get the networkId dynamically instead of mentioning the networkid : 1 (statically)

Are you getting my issue @fabioberger

how do you know the state of Token ? like WETH is locked , is there a function in 0x.js?

from 0x-starter-project.

narmadhasugumar avatar narmadhasugumar commented on August 19, 2024

Yes, @fpChan it is called Checking the allowance status of the tokens, Here below i mentioned
const allowance = await contractWrappers.erc20Token.getProxyAllowanceAsync(tokenAddress, address)

from 0x-starter-project.

Related Issues (20)

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.