github.com/iotexproject/iotex-core@v1.14.1-rc1/action/protocol/execution/testdata-shanghai/factory.sol (about)

     1  // SPDX-License-Identifier: GPL-3.0
     2  
     3  pragma solidity ^0.8.14;
     4  
     5  contract A {
     6      uint256[] public amounts;
     7  
     8      function init(uint256[] memory _amounts) public {
     9          amounts = _amounts;
    10      }
    11  }
    12  
    13  contract Factory {
    14      struct AData {
    15          uint256[] amounts;
    16      }
    17      mapping(address => AData) listOfData;
    18  
    19      function set(uint256[] memory _amounts) public {
    20          listOfData[msg.sender] = AData(_amounts);
    21      }
    22  
    23      function make() public returns (address) {
    24          A a = new A();
    25          a.init(listOfData[msg.sender].amounts);
    26          return address(a);
    27      }
    28  }