在solidity中动态创建变量

a94*_*a94 1 inline-assembly ethereum solidity evm

我想在我的合约中包含一个内部方法,该方法允许在由参数命名的存储中创建一个新的 uint256。就像是:

function createUint (string memory _name) internal {
    /*
     * creates a new uint256 named _name in storage
     */
}
Run Code Online (Sandbox Code Playgroud)

我的猜测是它需要内联汇编,但我不知道如何

use*_*559 5

映射怎么样?

mapping(string => uint256) myMap;

function setValue(string memory name, uint256 value) internal {
    myMap[name] = value;
}
Run Code Online (Sandbox Code Playgroud)