Create proxy results in Execution reverted

I have a contract deployed with sdk.
It was created successfully but when I tried to make function tx calls with the sdk, it gave the error “execution reverted”. This is the same with other functions tx.

I tried deploying the same contract via openzeppelin cli and perform functions tx, it executed perfectly.

Wonder if there are any compatibility issues?

1 Like

Hi @skybach,

Please note: we’ve decided it’s best to focus our upgradeability efforts on the Upgrades Plugins exclusively, and have halted development on the OpenZeppelin CLI. For details see:
Building for interoperability: why we’re focusing on Upgrades Plugins

I wasn’t sure what you meant by SDK?

Are you able to provide a simple example (such as with the Box contract) that demonstrates the issue?

As I know, the Upgrades Plugin requires a .openzeppelin folder which won't work in a AWS Lambda based serverless environment where there is no storage, short of specifying a S3 bucket specifically. I guess the plugin does not have such an integration?

So I am left with using the older versions.

this is that the snippets of code looks like

createProxy: async(event, contractName, argCb, lambdaCb) => {

    try {
        console.log(event)
        const json = event.body?JSON.parse(event.body):event
        const params = utils.encryptFields(json)
        console.log(params)

        const contractABI = await module.exports.getContractABI(contractName)
        const proj = await module.exports.getProject(json.gas)

        // api gateway passes in parameters in body sub object as a string.
        // aws-invoke passes in parameters in event as a json object

        // TODO :: refactor accounts
        const [DEPLOYER, OWNER] = await web3.eth.getAccounts()            

        const args = argCb(params, json, OWNER)
        console.log('args', args)

        const proxy = await proj.createProxy(contractABI, { initArgs: args })
        const events = await proxy.getPastEvents()

        console.log('events', events)
        lambdaCb(null, {
            statusCode: 200,
            body: JSON.stringify({
                proxyAddress: proxy.address,
                transactionHash: events[0]?events[0].transactionHash:''
            })
        })
    } catch(error) {
        console.log(error)
        lambdaCb(null, {
            statusCode: 500,
            body: JSON.stringify({
                code: error.code,
                errno: error.errno,
                message: error.message
            })
        })    
    }
},

getProject: async(gas) => {
    // const gasPrice = web3.utils.toBN(parseInt(await web3.eth.getGasPrice()) + EXTRA_GAS_PRICE)
    return new SimpleProject('Arkratos Smart Contract', null, (gas && gas !== '0')?{
        gasPrice: web3.utils.toWei(gas, 'gwei')
    }:{})
},
1 Like

It’s ok, found the reason why.
The OWNER account has run out of ether.
The js library for estimating gas for transaction just failed with “execution reverted” with no reasons given. (code for this portion was not in previous post)

The contract creation works using DEPLOYER account since it has sufficient gas. (which is the code provided in the previous post)

2 Likes