-
Notifications
You must be signed in to change notification settings - Fork 216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(Feature) Enable proxy for both strategies #1024
Conversation
@vbaranov |
@vbaranov |
@vbaranov |
Fixed
I cannot repeat both of them. Could you provide steps to reproduce? |
Steps for reproduce:
|
Still reproducible. Steps:
|
ah, makes sense now, thanks, fixed.
Could you post log from Chrome developer console? I still cannot reproduce the issue |
@dennis00010011b I've added handling of gas estimation for |
@vbaranov Failed transactions https://ropsten.etherscan.io/tx/0xb5aa7bdd0f8185b0024b20ab0d9fb5538339cc4fb4be2ccb07956ba065c3e9e6 |
@dennis00010011b do you have the same problem in I repeated all steps:
and error doesn't exist for me. If error still exists for you please record a video. |
This issue was fixed with last commit . Instead I can't buy from Dutch crowdsale #1024 (comment) |
@vbaranov Crowdsale parameters (one more whitelist account was added later ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested, no issues were found
@dennis00010011b I have fixed #1025 also. Please test it again. |
@vbaranov |
@fernandomg looking forward to your review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR is working fine. All the suggested changes are in order to preserve consistency in the code.
src/components/contribute/index.js
Outdated
try { | ||
estimatedGas = await method.estimateGas(opts) | ||
} catch (e) { | ||
console.log(e) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logger.error
instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
src/components/crowdsale/utils.js
Outdated
let tokensSold = await getTokensSold(...params).call() | ||
console.log('tokensSold:', tokensSold) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logger.log
(I'm the logger police 👮♂️)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
crowdsaleStatus.time_remaining = crowdsaleStatus.time_remaining || crowdsaleStatus[4] | ||
const tokens_remaining = crowdsaleStatus.tokens_remaining || crowdsaleStatus[5] | ||
const _isCrowdsaleFull = await isCrowdsaleFull(...params).call() | ||
const max_sellable = _isCrowdsaleFull.max_sellable || _isCrowdsaleFull[1] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm curious, why in some cases you use the array lookup for the value as an alternative, and in other cases just go with the object key lookup like in?:
https://github.com/poanetwork/token-wizard/pull/1024/files#diff-5c25cfce1eba8feb7668398c93446a0bR118
const wei_raised = crowdsaleInfo.wei_raised
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I use the array lookup because Proxy getters return only arrays. In the line, that you provided, array lookup wasn't made because it was made earlier in this line:
crowdsaleInfo.wei_raised = crowdsaleInfo[0] |
src/components/stepFour/utils.js
Outdated
return [ | ||
() => { | ||
logger.log('###trackProxy:###') | ||
console.log('contractStore:', contractStore) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logger.log
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
src/components/stepFour/utils.js
Outdated
toJS(contractStore.ProxiesRegistry.abi), | ||
contractStore.ProxiesRegistry.addr | ||
) | ||
console.log('contractStore[crowdsaleStore.proxyName].addr:', contractStore[crowdsaleStore.proxyName].addr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logger.log
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
@@ -344,6 +344,46 @@ async function getAllApplicationsInstances() { | |||
return Promise.all(whenCrowdsales).then(crowdsales => crowdsales.filter(crowdsale => crowdsale !== null)) | |||
} | |||
|
|||
async function getOwnerApplicationsInstancesForProxy() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May I suggest you a refactor for this method?
As suggested in this SO Answer, the way to go is with a map. I used a reduce
to enforce the order, having the ability to list from newer to older the crowdsales created.
async function getOwnerApplicationsInstancesForProxy() {
const { web3 } = web3Store
const proxiesRegistryContract = await attachToSpecificCrowdsaleContract('ProxiesRegistry')
const accounts = await web3.eth.getAccounts()
const execIDs = await proxiesRegistryContract.methods.getCrowdsalesForUser(accounts[0]).call()
const { abi } = contractStore.MintedCappedProxy
const mintedCapped = process.env[`${REACT_PREFIX}MINTED_CAPPED_APP_NAME`].toLowerCase()
const dutchAuction = process.env[`${REACT_PREFIX}DUTCH_APP_NAME`].toLowerCase()
return Promise.all(
execIDs.reduce((promise, execID) => {
return promise.then(async () => {
try {
const contractInstance = await attachToContract(abi, execID)
const contractAppName = await contractInstance.methods.app_name.call()
const appName = removeTrailingNUL(web3.utils.toAscii(contractAppName)).toLowerCase()
if (appName.includes(mintedCapped) || appName.includes(dutchAuction)) {
return { appName, execID }
}
} catch (error) {
logger.error(error)
}
})
}, Promise.resolve())
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fernandomg Unfortunately, such refactor won't work because return
doesn't return an iterable object:
I've implemented all useful and working parts from your suggestion. Thanks for sharing. Let's return to the final refactor of getOwnerApplicationsInstancesForProxy
function in a separate PR.
Closes #1022
Closes #957
Closes #1025
The last PR to enable Proxy contracts.
./exec-id
query param =>./addr
query paramregistryExec.exec(...)
=>...proxy.exec(...)
...idx
=>...proxy