답변 감사합니다!
traceTransaction 을 통한 debugging 은 상당히 어렵네요.
아래는 traceTransaction 을 실행한 결과 입니다.
{
failed: true,
gas: 34741,
returnValue: "",
structLogs: [{
depth: 1,
gas: 69000,
gasCost: 0,
memory: [],
op: "PUSH1",
pc: 0,
stack: [],
storage: {}
}, {
depth: 1,
gas: 68997,
gasCost: 0,
memory: [],
op: "PUSH1",
pc: 2,
stack: ["0000000000000000000000000000000000000000000000000000000000000080"],
storage: {}
}, {
depth: 1,
gas: 68994,
gasCost: 12,
memory: ["0000000000000000000000000000000000000000000000000000000000000000", "0000000000000000000000000000000000000000000000000000000000000000", "0000000000000000000000000000000000000000000000000000000000000000"],
op: "MSTORE",
pc: 4,
stack: ["0000000000000000000000000000000000000000000000000000000000000080", "0000000000000000000000000000000000000000000000000000000000000040"],
storage: {}
}, {
depth: 1,
gas: 68982,
gasCost: 12,
memory: ["0000000000000000000000000000000000000000000000000000000000000000", "0000000000000000000000000000000000000000000000000000000000000000", "0000000000000000000000000000000000000000000000000000000000000080"],
op: "PUSH1",
pc: 5,
stack: [],
storage: {}
}, ... ]
}
이 외에 여러가지 방법을 찾아보다가 해결이 되었는데요, 아래와 같이 solidity 코드를 수정하고 해결이 되었습니다.
function test(address recipient, address token, uint256 amount) public returns (bool) {
(bool success, bytes memory data) = token.delegatecall(abi.encodeWithSignature("transfer(address,uint256)", recipient, amount));
return success;
}
기본적으로 solidity compiler 가 method 호출을 call 로 compile 하여, 기대했던 msg.sender 값이 실제와 달랐던 것 같아요.