合约调用合约失败问题,怎么处理哈?

image.png

contract Score {
    struct Studetn {
        address stuAddress;
        uint score;
    }

    mapping (address => Studetn) stuMap;

    address public owner;

    Studetn public Stu;

    constructor() {
        owner = msg.sender;
    }

    modifier OnlyOwner {
        require(owner == msg.sender,"not techer");
        _;
    }

    // 更改权限
    function changeOwner(address _owner) view public {
        _owner = owner;
    }

    // 添加学生分数
    function addStuScore(address _stuAddress, uint _stuScore) public OnlyOwner {

        Stu = stuMap[_stuAddress];
        Stu.score = _stuScore;
        Stu.stuAddress = _stuAddress;
    }

    // 修改学生分数
    function changeStuScore(address _stuAddress, uint changeScore) public OnlyOwner {
        Stu = stuMap[_stuAddress];
        require(Stu.score <= 100, "not > 100 score");
        Stu.stuAddress = _stuAddress;
        Stu.score = changeScore;
    }

}

interface IScore {

    function changeStuScore(address _stuAddress, uint changeScore) external;
}

contract Techer {

    //修改分数
    function getStudentScore(address _score, address _stuAddress, uint score) external {
        IScore(_score).changeStuScore(_stuAddress,score);
    }
}

但是我在合约调用合约的时候 不能进行修改Score上面学生的一个分数,好奇怪.没找到什么原因,有老师可以帮忙可以看看吗?

Error encoding arguments: Error: invalid address (argument="address", value="30", code=INVALID_ARGUMENT, version=address/5.5.0) (argument=null, value="30", code=INVALID_ARGUMENT, version=abi/5.5.0)

请先 登录 后评论

2 个回答

阿拉斯加的狗 - 区块链开发
请先 登录 后评论
hunter666
请先 登录 后评论
  • 2 关注
  • 0 收藏,2656 浏览
  • 阿拉斯加的狗 提出于 2022-08-26 01:42