Skip to content

Commit

Permalink
lib cleaning by removing TODOs (Zondax#247)
Browse files Browse the repository at this point in the history
  • Loading branch information
emmanuelm41 authored and longfeiWan9 committed Mar 7, 2023
1 parent d5457f6 commit a4c65fc
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 28 deletions.
4 changes: 0 additions & 4 deletions contracts/v0.8/AccountAPI.sol
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ library AccountAPI {
using AccountCBOR for *;
using BytesCBOR for bytes;

/// @notice TODO fill this a proper description
/// @param target The account address (filecoin bytes format) you want to interact with
function authenticateMessage(bytes memory target, AccountTypes.AuthenticateMessageParams memory params) internal {
bytes memory raw_request = params.serializeAuthenticateMessageParams();
Expand All @@ -42,7 +41,6 @@ library AccountAPI {
require(result.length == 0, "unexpected response received");
}

/// @notice TODO fill this a proper description
/// @param target The account actor id you want to interact with
function authenticateMessage(uint64 target, AccountTypes.AuthenticateMessageParams memory params) internal {
bytes memory raw_request = params.serializeAuthenticateMessageParams();
Expand All @@ -53,7 +51,6 @@ library AccountAPI {
require(result.length == 0, "unexpected response received");
}

/// @notice TODO fill this a proper description
/// @param target The account address (filecoin bytes format) you want to interact with
function universalReceiverHook(bytes memory target, AccountTypes.UniversalReceiverParams memory params) internal {
bytes memory raw_request = params.serializeUniversalReceiverParams();
Expand All @@ -64,7 +61,6 @@ library AccountAPI {
require(result.length == 0, "unexpected response received");
}

/// @notice TODO fill this a proper description
/// @param target The account actor id you want to interact with
function universalReceiverHook(uint64 target, AccountTypes.UniversalReceiverParams memory params) internal {
bytes memory raw_request = params.serializeUniversalReceiverParams();
Expand Down
2 changes: 0 additions & 2 deletions contracts/v0.8/InitAPI.sol
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import "./utils/Actor.sol";
library InitAPI {
using InitCBOR for *;

/// @notice TODO fill this a proper description
function exec(InitTypes.ExecParams memory params) internal returns (InitTypes.ExecReturn memory) {
bytes memory raw_request = params.serializeExecParams();

Expand All @@ -40,7 +39,6 @@ library InitAPI {
return result.deserializeExecReturn();
}

/// @notice TODO fill this a proper description
function exec4(InitTypes.Exec4Params memory params) internal returns (InitTypes.Exec4Return memory) {
bytes memory raw_request = params.serializeExec4Params();

Expand Down
16 changes: 0 additions & 16 deletions contracts/v0.8/MinerAPI.sol
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,6 @@ library MinerAPI {
return result.deserializeGetBeneficiaryReturn();
}

/// @notice TODO fill me up
/// @param target The miner address (filecoin bytes format) you want to interact with
function changeWorkerAddress(bytes memory target, MinerTypes.ChangeWorkerAddressParams memory params) internal {
bytes memory raw_request = params.serializeChangeWorkerAddressParams();
Expand All @@ -254,7 +253,6 @@ library MinerAPI {
require(result.length == 0, "unexpected response received");
}

/// @notice TODO fill me up
/// @param target The miner actor id you want to interact with
function changeWorkerAddress(uint64 target, MinerTypes.ChangeWorkerAddressParams memory params) internal {
bytes memory raw_request = params.serializeChangeWorkerAddressParams();
Expand All @@ -265,7 +263,6 @@ library MinerAPI {
require(result.length == 0, "unexpected response received");
}

/// @notice TODO fill me up
/// @param target The miner address (filecoin bytes format) you want to interact with
function changePeerId(bytes memory target, MinerTypes.ChangePeerIDParams memory params) internal {
bytes memory raw_request = params.serializeChangePeerIDParams();
Expand All @@ -276,7 +273,6 @@ library MinerAPI {
require(result.length == 0, "unexpected response received");
}

/// @notice TODO fill me up
/// @param target The miner actor id you want to interact with
function changePeerId(uint64 target, MinerTypes.ChangePeerIDParams memory params) internal {
bytes memory raw_request = params.serializeChangePeerIDParams();
Expand All @@ -287,7 +283,6 @@ library MinerAPI {
require(result.length == 0, "unexpected response received");
}

/// @notice TODO fill me up
/// @param target The miner address (filecoin bytes format) you want to interact with
function changeMultiaddresses(bytes memory target, MinerTypes.ChangeMultiaddrsParams memory params) internal {
bytes memory raw_request = params.serializeChangeMultiaddrsParams();
Expand All @@ -298,7 +293,6 @@ library MinerAPI {
require(result.length == 0, "unexpected response received");
}

/// @notice TODO fill me up
/// @param target The miner actor id you want to interact with
function changeMultiaddresses(uint64 target, MinerTypes.ChangeMultiaddrsParams memory params) internal {
bytes memory raw_request = params.serializeChangeMultiaddrsParams();
Expand All @@ -309,7 +303,6 @@ library MinerAPI {
require(result.length == 0, "unexpected response received");
}

/// @notice TODO fill me up
/// @param target The miner address (filecoin bytes format) you want to interact with
function repayDebt(bytes memory target) internal {
bytes memory raw_request = new bytes(0);
Expand All @@ -320,7 +313,6 @@ library MinerAPI {
require(result.length == 0, "unexpected response received");
}

/// @notice TODO fill me up
/// @param target The miner actor id you want to interact with
function repayDebt(uint64 target) internal {
bytes memory raw_request = new bytes(0);
Expand All @@ -331,7 +323,6 @@ library MinerAPI {
require(result.length == 0, "unexpected response received");
}

/// @notice TODO fill me up
/// @param target The miner address (filecoin bytes format) you want to interact with
function confirmChangeWorkerAddress(bytes memory target) internal {
bytes memory raw_request = new bytes(0);
Expand All @@ -342,7 +333,6 @@ library MinerAPI {
require(result.length == 0, "unexpected response received");
}

/// @notice TODO fill me up
/// @param target The miner actor id you want to interact with
function confirmChangeWorkerAddress(uint64 target) internal {
bytes memory raw_request = new bytes(0);
Expand All @@ -353,7 +343,6 @@ library MinerAPI {
require(result.length == 0, "unexpected response received");
}

/// @notice TODO fill me up
/// @param target The miner address (filecoin bytes format) you want to interact with
function getPeerId(bytes memory target) internal returns (MinerTypes.GetPeerIDReturn memory) {
bytes memory raw_request = new bytes(0);
Expand All @@ -365,7 +354,6 @@ library MinerAPI {
return result.deserializeGetPeerIDReturn();
}

/// @notice TODO fill me up
/// @param target The miner actor id you want to interact with
function getPeerId(uint64 target) internal returns (MinerTypes.GetPeerIDReturn memory) {
bytes memory raw_request = new bytes(0);
Expand All @@ -377,7 +365,6 @@ library MinerAPI {
return result.deserializeGetPeerIDReturn();
}

/// @notice TODO fill me up
/// @param target The miner address (filecoin bytes format) you want to interact with
function getMultiaddresses(bytes memory target) internal returns (MinerTypes.GetMultiaddrsReturn memory) {
bytes memory raw_request = new bytes(0);
Expand All @@ -389,7 +376,6 @@ library MinerAPI {
return result.deserializeGetMultiaddrsReturn();
}

/// @notice TODO fill me up
/// @param target The miner actor id you want to interact with
function getMultiaddresses(uint64 target) internal returns (MinerTypes.GetMultiaddrsReturn memory) {
bytes memory raw_request = new bytes(0);
Expand All @@ -401,7 +387,6 @@ library MinerAPI {
return result.deserializeGetMultiaddrsReturn();
}

/// @notice TODO fill me up
/// @param target The miner address (filecoin bytes format) you want to interact with
/// @param params the amount you want to withdraw
function withdrawBalance(bytes memory target, MinerTypes.WithdrawBalanceParams memory params) internal returns (MinerTypes.WithdrawBalanceReturn memory) {
Expand All @@ -414,7 +399,6 @@ library MinerAPI {
return result.deserializeWithdrawBalanceReturn();
}

/// @notice TODO fill me up
/// @param target The miner actor id you want to interact with
/// @param params the amount you want to withdraw
function withdrawBalance(uint64 target, MinerTypes.WithdrawBalanceParams memory params) internal returns (MinerTypes.WithdrawBalanceReturn memory) {
Expand Down
3 changes: 1 addition & 2 deletions contracts/v0.8/SendAPI.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,9 @@ pragma solidity ^0.8.17;
import "./utils/Misc.sol";
import "./utils/Actor.sol";

/// @title TODO complete me
/// @title This library is helper method to send funds to some specfici address. Calling one of its methods will result in a cross-actor call being performed.
/// @author Zondax AG
library SendAPI {
/// @notice TODO fill this a proper description
/// @param toAddress The address (filecoin bytes format) you want to send funds to
function send(bytes memory toAddress, uint256 amount) internal {
bytes memory rawResponse = Actor.call(0, toAddress, new bytes(0), Misc.NONE_CODEC, amount, false);
Expand Down
4 changes: 0 additions & 4 deletions contracts/v0.8/cbor/BigIntCbor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ struct BigInt {

library BigIntCBOR {
function serializeBigInt(BigInt memory num) internal pure returns (bytes memory) {
// TODO improve gas efficiency by using assembly code
bytes memory raw = new bytes(num.val.length + 1);

if (num.neg) {
Expand All @@ -43,9 +42,6 @@ library BigIntCBOR {
}

function deserializeBigInt(bytes memory raw) internal pure returns (BigInt memory) {
// TODO improve gas efficiency by using assembly code

// Is an empty byte a valid BigInt ? We should have the sign byte at least
if (raw.length == 0) {
return BigInt(hex"00", false);
}
Expand Down

0 comments on commit a4c65fc

Please sign in to comment.