Skip to content
This repository has been archived by the owner on Aug 29, 2023. It is now read-only.

Commit

Permalink
add call actor by id precompile (#165)
Browse files Browse the repository at this point in the history
  • Loading branch information
emmanuelm41 committed Jan 18, 2023
1 parent b5407f4 commit 36bb785
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion contracts/v0.8/utils/Actor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,27 @@ library Actor {

function call(
uint method_num,
bytes memory actor_id,
bytes memory actor_address,
bytes memory raw_request,
uint64 codec,
uint256 amount
) internal returns (bytes memory) {
(bool success, bytes memory data) = address(CALL_ACTOR_ADDRESS).delegatecall(
abi.encode(uint64(method_num), amount, DEFAULT_FLAG, codec, raw_request, actor_address)
);
require(success == true, CALL_ERROR_MESSAGE);

return data;
}

function callByID(
uint64 actor_id,
uint method_num,
uint64 codec,
bytes memory raw_request,
uint256 amount
) internal returns (bytes memory) {
(bool success, bytes memory data) = address(CALL_ACTOR_ID).delegatecall(
abi.encode(uint64(method_num), amount, DEFAULT_FLAG, codec, raw_request, actor_id)
);
require(success == true, CALL_ERROR_MESSAGE);
Expand Down

0 comments on commit 36bb785

Please sign in to comment.