I'm trying to be able to add strings to the array inside the mapping but I keep getting this error on line 13:

TypeError Member "push" not found or not visible after argument-dependant lookup in uint256[] storage ref.

I have looked around and evry video i have seen uses push even with the same mapped array, granted they where 1 year old.

Any ideas welcome as this has stumped me all day. Thanks.

pragma solidity >= 0.6.12;
import "./SafeMath.sol";
import "./Ownable.sol";
import "./Context.sol";

contract Trail1 is Ownable {
    using SafeMath for uint256;
    mapping(string => uint[]) public Pairs;
    mapping(string => mapping(string => uint256)) public Orders;
    function AddPair(string memory Pair, bool Create)public onlyOwner{
        if(Create == true){

1 Answer 1


You have inconsistency in your types. You're trying to push a string (Pair) into an array of uint. Instead, you'll need to change the type of the storage memory inside Pairs as follows:

mapping(string => string[]) public Pairs;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.