yarn deploy:baobab 명령을 이용하여 배포 시 The contract code couldn't be stored, please check your gas limit
라는 에러가 발생합니다. gas limit와 price를 높이거나 낮추어도 같은 에러가 발생합니다. 어떻게 된 일인지 알 수가 없습니다… 아래의 코드는 package.json과 truffle_config.js입니다.
- Web3 대신 caver-js를 사용해도 같은 증상입니다.
{
"name": "contracts",
"version": "1.0.0",
"license": "MIT",
"scripts": {
"build": "truffle compile && typechain --target=truffle-v5 'build/contracts/*.json'",
"test": "concurrently --success first --kill-others \"ganache-cli -l 80000000 -q -k constantinople\" \"truffle test\"",
"deploy:baobab": "truffle deploy --network baobab --reset",
"deploy:cypress": "truffle deploy --network cypress --reset"
},
"dependencies": {
"@klaytn/contracts": "^0.9.0",
"@typechain/truffle-v5": "^6.0.0",
"@types/chai": "^4.3.0",
"@types/mocha": "^9.0.0",
"@types/node": "^16.11.12",
"@types/web3": "^1.2.2",
"concurrently": "^6.4.0",
"dotenv": "^10.0.0",
"ganache-cli": "^6.12.2",
"truffle": "5.1.61",
"truffle-hdwallet-provider-klaytn": "^1.4.1",
"ts-node": "^10.4.0",
"typechain": "^6.0.5",
"typescript": "^4.5.3",
"web3": "^1.6.1",
"web3-eth-contract": "^1.6.1"
}
}
require("dotenv").config();
const env = {
privateKey: process.env.PRIVATE_KEY,
accessKeyId: process.env.ACCESS_KEY_ID,
secretAccessKey: process.env.SECRET_ACCESS_KEY,
};
require("ts-node").register({
files: true,
});
const Provider = require("truffle-hdwallet-provider-klaytn");
const Web3 = require("web3");
module.exports = {
networks: {
development: {
host: "localhost",
port: 8545,
network_id: "*",
gas: 80_000_000,
},
baobab: {
provider: () => {
const option = {
headers: [
{
name: "Authorization",
value: `Basic ${Buffer.from(
`${env.accessKeyId}:${env.secretAccessKey}`
).toString("base64")}`,
},
{
name: "x-chain-id",
value: "1001",
},
],
keepAlive: false,
};
return new Provider(
env.privateKey,
new Web3.providers.HttpProvider(
"https://node-api.klaytnapi.com/v1/klaytn",
option
)
);
},
network_id: "1001",
gas: 8_500_000,
gasPrice: undefined,
},
cypress: {
provider: () => {
const option = {
headers: [
{
name: "Authorization",
value: `Basic ${Buffer.from(
`${env.accessKeyId}:${env.secretAccessKey}`
).toString("base64")}`,
},
{
name: "x-chain-id",
value: "8217",
},
],
keepAlive: false,
};
return new Provider(
env.privateKey,
new Web3.providers.HttpProvider(
"https://node-api.klaytnapi.com/v1/klaytn",
option
)
);
},
network_id: "8217",
gas: 8_500_000,
gasPrice: undefined,
},
},
compilers: {
solc: {
version: "0.5.6",
},
},
};