axelarnetwork / axelar-gmp-sdk-solidity Goto Github PK
View Code? Open in Web Editor NEWSolidity libraries and utilities provided by Axelar.
Solidity libraries and utilities provided by Axelar.
I saw this warning message in VS Code when I looked at Create3.sol: https://github.com/axelarnetwork/axelar-gmp-sdk-solidity/blob/main/contracts/deploy/Create3.sol#L20:
"selfdestruct" has been deprecated. The underlying opcode will eventually undergo breaking changes, and its use is not recommended.
I was trying to deploy a contract using the constAddressDeployer (deployContractConstant)
But I was getting some error which wasn't particular useful upon further investigation
I realised that Arbitrum gas usage works different than other EVM and L1 calldata adds overhead
so that the current multiplier was insufficient.
const tx = await deployer
.connect(wallet)
.deploy(bytecode, salt, { gasLimit: BigInt(Math.floor(gas * 1.2)) });
I could deploy by increasing the multiplier to 2
I think it's great to be able to make contributions and to take into account the versions of packages that can give conflicts and avoid wasting time with that!
This could be in the same README.md file
I added role based access to a cross chain token contract using OpenZeppelin's grantRole, and used deployUpgradable
like in the examples.
DEFAULT_ADMIN_ROLE
and MINTER_ROLE
are granted on deployment of the contract:
function _setup(bytes calldata params) internal override {
_grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
_grantRole(MINTER_ROLE, msg.sender);
}
After deployment when I try to execute this function that requires an account having MINTER_ROLE:
function mint(address to, uint256 amount) public onlyRole(MINTER_ROLE) {
_mint(to, amount);
}
an error occurs that says [wallet account] is missing role [hash of MINTER_ROLE] even though [wallet account] is the one that originally initiated the deployment.
When I run getRoleMember I found that msg.sender
happened to be constAddressDeployer
address when grantRole
was called, instead of the [wallet account].
So how can we make sure that grantRole
takes [wallet account] that initiated the deployment?
It would've been good if it was possible to reuse the transaction bytecode (at https://etherscan.io/getRawTx?tx=0xb56d861ab7c8bd843113ff2fe8589bbaa225bbe76e054c9577dbbcbd17bac099) of ConstAddressDeployer
creation so that anyone could deploy ConstAddressDeployer
to 0x98b2920d53612483f91f12ed7754e51b4a77919e
on any blockchain that does not yet have it.
Otherwise, in the current situation we'd have to beg/hope/wait for Axelar to deploy ConstAddressDeployer
onto some new blockchain that we want to try. If I had already used ConstAddressDeployer
to deploy my contract on other existing blockchains (all to the same address), then in order to deploy the contract onto the new blockchain to the same address as the others, I'd have to use ConstAddressDeployer
which should be at 0x98b2920d53612483f91f12ed7754e51b4a77919e
on the new blockchain, right? If, for whatever reason, Axelar doesn't deploy ConstAddressDeployer
onto the new blockchain then I wouldn't be able to deploy my contract to the same address as my contract on the other blockchains.
With https://github.com/Arachnid/deterministic-deployment-proxy it is possible to reuse the deployment transaction bytecode to deploy their CREATE2 factory contract at the same address on any blockchain. You can see the same bytecode was used on different blockchains:
https://etherscan.io/getRawTx?tx=0xeddf9e61fb9d8f5111840daef55e5fde0041f5702856532cdbb5a02998033d26
https://goerli.etherscan.io/getRawTx?tx=0xeddf9e61fb9d8f5111840daef55e5fde0041f5702856532cdbb5a02998033d26
https://sepolia.etherscan.io/getRawTx?tx=0xeddf9e61fb9d8f5111840daef55e5fde0041f5702856532cdbb5a02998033d26
https://goerli.basescan.org/getRawTx?tx=0xeddf9e61fb9d8f5111840daef55e5fde0041f5702856532cdbb5a02998033d26
https://optimistic.etherscan.io/getRawTx?tx=0xeddf9e61fb9d8f5111840daef55e5fde0041f5702856532cdbb5a02998033d26
https://testnet.bobascan.com/getRawTx?tx=0xeddf9e61fb9d8f5111840daef55e5fde0041f5702856532cdbb5a02998033d26
I can use these existing CREATE2 factory contracts to deploy my contract to each blockchain and they'd all have the same address. When a new blockchain comes along I can deploy the CREATE2 factory contract onto it using the same deployment transaction bytecode, then use it to deploy my own contract.
Can there be a solution for Axelar's CREATE2 deployer?
I replaced deployUpgradable
with deployCreate3Upgradable
in the cross-chain-token example (and deployed Create3Deployer
and passed its address in place of ConstAddressDeployer
address):
https://github.com/axelarnetwork/axelar-examples/blob/main/examples/evm/cross-chain-token/index.js#L21
Deployment using npm run deploy evm/cross-chain-token local
causes this error output:
Error: too many arguments: in Contract constructor (count=3, expectedCount=0, code=UNEXPECTED_ARGUMENT, version=contracts/5.7.0)
at Logger.makeError (/root/projects/axelar-examples/node_modules/@ethersproject/logger/lib/index.js:238:21)
at Logger.throwError (/root/projects/axelar-examples/node_modules/@ethersproject/logger/lib/index.js:247:20)
at Logger.checkArgumentCount (/root/projects/axelar-examples/node_modules/@ethersproject/logger/lib/index.js:313:18)
at ContractFactory.getDeployTransaction (/root/projects/axelar-examples/node_modules/@ethersproject/contracts/lib/index.js:1125:16)
at deployCreate3Contract (/root/projects/axelar-examples/node_modules/@axelar-network/axelar-gmp-sdk-solidity/scripts/create3Deployer.js:89:28)
at deployCreate3Upgradable (/root/projects/axelar-examples/node_modules/@axelar-network/axelar-gmp-sdk-solidity/scripts/upgradable.js:70:23)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Object.deploy (/root/projects/axelar-examples/examples/evm/cross-chain-token/index.js:21:22)
at async Promise.all (index 4)
at async deploy (/root/projects/axelar-examples/scripts/libs/deploy.js:17:5) {
reason: 'too many arguments: in Contract constructor',
code: 'UNEXPECTED_ARGUMENT',
count: 3,
expectedCount: 0
Please fix this so that we can deploy using CREATE3.
Thank you.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.