alaya-truffle 编译出错

编译@openzeppelin/contracts/utils/EnumerableSet.sol合约提示InternalCompilerError: Conversion from rational numbers to address types is not supported

1 Like

您好,感谢反馈哈,问题正在排查,有进展了及时回复您,我们有PlatON开发者群,您也可以加我微信18657117189。

是不是合约源码里面对空地址的判断是0x0的格式?

在platon网络中的空地址是lat1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq542u6a


这个合约引用到openzeppelin/contracts/utils/EnumerableSet.sol ,

上面address(0),在alaya测试网我把它改成address(atp1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq542u6a) 编译提示Undeclared identifier.


下面是开源挖矿项目合约:

得加个字符串呀,address(“atp1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq542u6a”)

有点麻烦哦,我把openzeppelin/contracts/token/ERC20/ERC20.sol 库里address(0) 改成 address(“atp1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq542u6a”)
编译也遇到问题,感觉合约如果有引入openzeppelin库的项目,就不好办了。

address(uint160(0))

thanks, very much!

alaya-truffle migrations ,使用@openzeppelin/truffle-upgrades 提示truffle 版本太低:Global Truffle config not found: Truffle >=5.1.35 is required. Truffle exec not yet supported,这个要怎么办?

When I deploy upgradeable contracts , encountered this bug, how can I deploy upgradeable contracts by using @openzeppelin/truffle-upgrades on alaya network(alaya-truffle)

这个功能我没有用过

你这个合约的源码可以看下吗?

用@openzeppelin/truffle-upgrades测试部署合约Box.sol

// contracts/Box.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
 
contract Box {
    uint256 private value;
 
    // Emitted when the stored value changes
    event ValueChanged(uint256 newValue);
 
    // Stores a new value in the contract
    function store(uint256 newValue) public {
        value = newValue;
        emit ValueChanged(newValue);
    }
 
    // Reads the last stored value
    function retrieve() public view returns (uint256) {
        return value;
    }
}

部署js 2_deploy_box.js

// migrations/2_deploy_box.js
const Box = artifacts.require('Box');
 
const { deployProxy } = require('@openzeppelin/truffle-upgrades');
 
module.exports = async function (deployer) {
  await deployProxy(Box, [42], { deployer, initializer: 'store' });
};

这部分的部署可升级合约的功能我们需要做一些适配,感谢您的反馈,我们评估后后续考虑支持该功能

看一下truffle-config.js呢