Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
thedavidmeister committed Feb 28, 2024
1 parent 0ea3300 commit d1a6c74
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 60 deletions.
10 changes: 3 additions & 7 deletions src/abstract/FlowCommon.sol
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,7 @@ import {ReentrancyGuardUpgradeable as ReentrancyGuard} from
"openzeppelin-contracts-upgradeable/contracts/security/ReentrancyGuardUpgradeable.sol";
import {LibUint256Matrix} from "rain.solmem/lib/LibUint256Matrix.sol";
import {LibNamespace, StateNamespace} from "rain.interpreter.interface/lib/ns/LibNamespace.sol";
import {
UnsupportedFlowInputs,
InsufficientFlowOutputs
} from "../error/ErrFlow.sol";
import {UnsupportedFlowInputs, InsufficientFlowOutputs} from "../error/ErrFlow.sol";

/// Thrown when the min outputs for a flow is fewer than the sentinels.
/// This is always an implementation bug as the min outputs and sentinel count
Expand Down Expand Up @@ -154,9 +151,8 @@ abstract contract FlowCommon is ERC721Holder, ERC1155Holder, Multicall, Reentran
// Reentrancy is just one of many ways that a malicious deployer
// can cause problems, and it's probably the least of your
// worries if you're using a malicious deployer.
(IInterpreterV2 interpreter, IInterpreterStoreV2 store, address expression, bytes memory io) = config
.deployer
.deployExpression2(config.bytecode, config.constants);
(IInterpreterV2 interpreter, IInterpreterStoreV2 store, address expression, bytes memory io) =
config.deployer.deployExpression2(config.bytecode, config.constants);

{
uint256 flowInputs;
Expand Down
25 changes: 9 additions & 16 deletions src/concrete/erc1155/FlowERC1155.sol
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,7 @@ import {SourceIndexV2} from "rain.interpreter.interface/interface/unstable/IInte
import {FlowCommon, ERC1155Receiver} from "../../abstract/FlowCommon.sol";
import {LibContext} from "rain.interpreter.interface/lib/caller/LibContext.sol";
import {LibNamespace, StateNamespace} from "rain.interpreter.interface/lib/ns/LibNamespace.sol";
import {
InsufficientHandleTransferOutputs,
UnsupportedHandleTransferInputs
} from "../../error/ErrFlow.sol";
import {InsufficientHandleTransferOutputs, UnsupportedHandleTransferInputs} from "../../error/ErrFlow.sol";

/// @title FlowERC1155
/// See `IFlowERC1155V4` for documentation.
Expand Down Expand Up @@ -74,12 +71,9 @@ contract FlowERC1155 is ICloneableV2, IFlowERC1155V4, FlowCommon, ERC1155 {
flowCommonInit(flowERC1155Config.flowConfig, FLOW_ERC1155_MIN_FLOW_SENTINELS);

if (evalHandleTransfer) {
(IInterpreterV2 interpreter, IInterpreterStoreV2 store, address expression, bytes memory io) = flowERC1155Config
.evaluableConfig
.deployer
.deployExpression2(
flowERC1155Config.evaluableConfig.bytecode,
flowERC1155Config.evaluableConfig.constants
(IInterpreterV2 interpreter, IInterpreterStoreV2 store, address expression, bytes memory io) =
flowERC1155Config.evaluableConfig.deployer.deployExpression2(
flowERC1155Config.evaluableConfig.bytecode, flowERC1155Config.evaluableConfig.constants
);

{
Expand Down Expand Up @@ -226,12 +220,11 @@ contract FlowERC1155 is ICloneableV2, IFlowERC1155V4, FlowCommon, ERC1155 {
/// of the flow contract itself. This involves consuming the mint/burn
/// sentinels from the stack and minting/burning the tokens accordingly, then
/// calling `LibFlow.flow` to handle the rest of the flow.
function _flow(EvaluableV2 memory evaluable, uint256[] memory callerContext, SignedContextV1[] memory signedContexts)
internal
virtual
nonReentrant
returns (FlowERC1155IOV1 memory)
{
function _flow(
EvaluableV2 memory evaluable,
uint256[] memory callerContext,
SignedContextV1[] memory signedContexts
) internal virtual nonReentrant returns (FlowERC1155IOV1 memory) {
unchecked {
(Pointer stackBottom, Pointer stackTop, uint256[] memory kvs) =
_flowStack(evaluable, callerContext, signedContexts);
Expand Down
21 changes: 9 additions & 12 deletions src/concrete/erc20/FlowERC20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,10 @@ contract FlowERC20 is ICloneableV2, IFlowERC20V5, FlowCommon, ERC20 {
flowCommonInit(flowERC20Config.flowConfig, FLOW_ERC20_MIN_FLOW_SENTINELS);

if (evalHandleTransfer) {
(IInterpreterV2 interpreter, IInterpreterStoreV2 store, address expression, bytes memory io) = flowERC20Config
.evaluableConfig
.deployer
.deployExpression2(
flowERC20Config.evaluableConfig.bytecode,
flowERC20Config.evaluableConfig.constants);
(IInterpreterV2 interpreter, IInterpreterStoreV2 store, address expression, bytes memory io) =
flowERC20Config.evaluableConfig.deployer.deployExpression2(
flowERC20Config.evaluableConfig.bytecode, flowERC20Config.evaluableConfig.constants
);

{
uint256 handleTransferInputs;
Expand Down Expand Up @@ -203,12 +201,11 @@ contract FlowERC20 is ICloneableV2, IFlowERC20V5, FlowCommon, ERC20 {
/// the mints and burns from the `FlowERC20IOV1` struct. The mints are
/// processed first, then the burns, then the remaining flow is processed
/// as normal.
function _flow(EvaluableV2 memory evaluable, uint256[] memory callerContext, SignedContextV1[] memory signedContexts)
internal
virtual
nonReentrant
returns (FlowERC20IOV1 memory)
{
function _flow(
EvaluableV2 memory evaluable,
uint256[] memory callerContext,
SignedContextV1[] memory signedContexts
) internal virtual nonReentrant returns (FlowERC20IOV1 memory) {
unchecked {
(Pointer stackBottom, Pointer stackTop, uint256[] memory kvs) =
_flowStack(evaluable, callerContext, signedContexts);
Expand Down
17 changes: 7 additions & 10 deletions src/concrete/erc721/FlowERC721.sol
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,8 @@ contract FlowERC721 is ICloneableV2, IFlowERC721V5, FlowCommon, ERC721 {
flowCommonInit(flowERC721Config.flowConfig, FLOW_ERC721_MIN_FLOW_SENTINELS);

if (evalHandleTransfer) {
(IInterpreterV2 interpreter, IInterpreterStoreV2 store, address expression, bytes memory io) = flowERC721Config
.evaluableConfig
.deployer
.deployExpression2(
(IInterpreterV2 interpreter, IInterpreterStoreV2 store, address expression, bytes memory io) =
flowERC721Config.evaluableConfig.deployer.deployExpression2(
flowERC721Config.evaluableConfig.bytecode, flowERC721Config.evaluableConfig.constants
);

Expand Down Expand Up @@ -290,12 +288,11 @@ contract FlowERC721 is ICloneableV2, IFlowERC721V5, FlowCommon, ERC721 {
/// from the stack as additional sentinel separated tuples. The mints are
/// consumed first, then the burns, then the remaining stack is converted to
/// a flow as normal.
function _flow(EvaluableV2 memory evaluable, uint256[] memory callerContext, SignedContextV1[] memory signedContexts)
internal
virtual
nonReentrant
returns (FlowERC721IOV1 memory)
{
function _flow(
EvaluableV2 memory evaluable,
uint256[] memory callerContext,
SignedContextV1[] memory signedContexts
) internal virtual nonReentrant returns (FlowERC721IOV1 memory) {
unchecked {
(Pointer stackBottom, Pointer stackTop, uint256[] memory kvs) =
_flowStack(evaluable, callerContext, signedContexts);
Expand Down
2 changes: 1 addition & 1 deletion src/error/ErrFlow.sol
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ error InsufficientHandleTransferOutputs();
error UnsupportedTokenURIInputs();
error InsufficientTokenURIOutputs();
error UnsupportedFlowInputs();
error InsufficientFlowOutputs();
error InsufficientFlowOutputs();
4 changes: 1 addition & 3 deletions src/interface/unstable/IFlowV5.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ import {
RAIN_FLOW_SENTINEL,
MIN_FLOW_SENTINELS
} from "../deprecated/v4/IFlowV4.sol";
import {
UnregisteredFlow
} from "../../error/ErrFlow.sol";
import {UnregisteredFlow} from "../../error/ErrFlow.sol";

/// @title IFlowV4
/// @notice Interface for a flow contract that does NOT require native minting
Expand Down
13 changes: 2 additions & 11 deletions src/lib/LibFlow.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,7 @@ pragma solidity ^0.8.18;

import {IFlowV4, RAIN_FLOW_SENTINEL} from "../interface/unstable/IFlowV5.sol";
import {Pointer} from "rain.solmem/lib/LibPointer.sol";
import {
FlowTransferV1,
ERC20Transfer,
ERC721Transfer,
ERC1155Transfer
} from "../interface/unstable/IFlowV5.sol";
import {FlowTransferV1, ERC20Transfer, ERC721Transfer, ERC1155Transfer} from "../interface/unstable/IFlowV5.sol";
import {IInterpreterStoreV2} from "rain.interpreter.interface/interface/unstable/IInterpreterStoreV2.sol";
import {LibStackSentinel} from "rain.solmem/lib/LibStackSentinel.sol";
import {DEFAULT_STATE_NAMESPACE} from "rain.interpreter.interface/interface/unstable/IInterpreterV2.sol";
Expand All @@ -17,11 +12,7 @@ import {IERC20} from "openzeppelin-contracts/contracts/token/ERC20/IERC20.sol";
import {SafeERC20} from "openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol";
import {IERC721} from "openzeppelin-contracts/contracts/token/ERC721/IERC721.sol";
import {IERC1155} from "openzeppelin-contracts/contracts/token/ERC1155/IERC1155.sol";
import {
UnsupportedERC20Flow,
UnsupportedERC721Flow,
UnsupportedERC1155Flow
} from "../error/ErrFlow.sol";
import {UnsupportedERC20Flow, UnsupportedERC721Flow, UnsupportedERC1155Flow} from "../error/ErrFlow.sol";

/// @title LibFlow
/// Standard processing used by all variants of `Flow`. These utilities can't
Expand Down

0 comments on commit d1a6c74

Please sign in to comment.