Marketplace Facet

Note that this page has not been updated to reflect the current state of Beanstalk, but is left here as a reference.

The Marketplace Facet handles logic for buying and selling Pods on the Pod Market.

Call Functions

function createPodListing(
    uint256 index,
    uint256 start,
    uint256 amount,
    uint24 pricePerPod,
    uint256 maxHarvestableIndex,
    uint256 minFillAmount,
    LibTransfer.To mode
) external payable;

WIP

Parameter
Type
Description

index

uint256

WIP

start

uint256

WIP

amount

uint256

WIP

pricePerPod

uint24

WIP

maxHarvestableIndex

uint256

WIP

minFillAmount

uint256

WIP

mode

To

WIP

function createPodListingV2(
    uint256 index,
    uint256 start,
    uint256 amount,
    uint256 maxHarvestableIndex,
    uint256 minFillAmount,
    bytes calldata pricingFunction,
    LibTransfer.To mode
) external payable;

WIP

Parameter
Type
Description

index

uint256

WIP

start

uint256

WIP

amount

uint256

WIP

maxHarvestableIndex

uint256

WIP

minFillAmount

uint256

WIP

pricingFunction

bytes

WIP

mode

To

WIP

function fillPodListing(
    PodListing calldata l,
    uint256 beanAmount,
    LibTransfer.From mode
) external payable;

WIP

Parameter
Type
Description

l

PodListing

WIP

beanAmount

uint256

WIP

mode

From

WIP

function fillPodListingV2(
    PodListing calldata l,
    uint256 beanAmount,
    bytes calldata pricingFunction,
    LibTransfer.From mode
) external payable;

WIP

Parameter
Type
Description

l

PodListing

WIP

beanAmount

uint256

WIP

pricingFunction

bytes

WIP

mode

From

WIP

function cancelPodListing(uint256 index) external payable;

WIP

Parameter
Type
Description

index

uint256

WIP

function createPodOrder(
    uint256 beanAmount,
    uint24 pricePerPod,
    uint256 maxPlaceInLine,
    uint256 minFillAmount,
    LibTransfer.From mode
) external payable returns (bytes32 id);

WIP

Parameter
Type
Description

beanAmount

uint256

WIP

pricePerPod

uint24

WIP

maxPlaceInLine

uint256

WIP

minFillAmount

uint256

WIP

mode

From

WIP

Return Value
Type
Description

id

bytes32

WIP

function createPodOrderV2(
    uint256 beanAmount,
    uint256 maxPlaceInLine,
    uint256 minFillAmount,
    bytes calldata pricingFunction,
    LibTransfer.From mode
) external payable returns (bytes32 id);
Parameter
Type
Description

beanAmount

uint256

WIP

maxPlaceInLine

uint256

WIP

minFillAmount

uint256

WIP

pricingFunction

bytes

WIP

mode

From

WIP

Return Value
Type
Description

id

bytes32

WIP

function fillPodOrder(
    PodOrder calldata o,
    uint256 index,
    uint256 start,
    uint256 amount,
    LibTransfer.To mode
) external payable;

WIP

Parameter
Type
Description

o

PodOrder

WIP

index

uint256

WIP

start

uint256

WIP

amount

uint256

WIP

mode

To

WIP

function fillPodOrderV2(
    PodOrder calldata o,
    uint256 index,
    uint256 start,
    uint256 amount,
    bytes calldata pricingFunction,
    LibTransfer.To mode
) external payable;

WIP

Parameter
Type
Description

o

PodOrder

WIP

index

uint256

WIP

start

uint256

WIP

amount

uint256

WIP

pricingFunction

bytes

WIP

mode

To

WIP

function cancelPodOrder(
    uint24 pricePerPod,
    uint256 maxPlaceInLine,
    uint256 minFillAmount,
    LibTransfer.To mode
) external payable;

WIP

Parameter
Type
Description

pricePerPod

uint24

WIP

maxPlaceInLine

uint256

WIP

minFillAmount

uint256

WIP

mode

To

WIP

function cancelPodOrderV2(
    uint256 maxPlaceInLine,
    uint256 minFillAmount,
    bytes calldata pricingFunction,
    LibTransfer.To mode
) external payable;

WIP

Parameter
Type
Description

maxPlaceInLine

uint256

WIP

minFillAmount

uint256

WIP

pricingFunction

bytes

WIP

mode

To

WIP

function transferPlot(
    address sender,
    address recipient,
    uint256 id,
    uint256 start,
    uint256 end
) external payable nonReentrant;

WIP

Parameter
Type
Description

sender

address

WIP

recipient

address

WIP

id

uint256

WIP

start

uint256

WIP

end

uint256

WIP

function approvePods(address spender, uint256 amount)
    external
    payable
    nonReentrant;

WIP

Parameter
Type
Description

spender

address

WIP

amount

uint256

WIP

function getAmountPodsFromFillListingV2(
    uint256 placeInLine, 
    uint256 podListingAmount,
    uint256 fillBeanAmount,
    bytes calldata pricingFunction
) public pure returns (uint256 amount);

WIP

Parameter
Type
Description

placeInLine

uint256

WIP

podListingAmount

uint256

WIP

fillBeanAmount

uint256

WIP

pricingFunction

bytes

WIP

Return Value
Type
Description

amount

uint256

WIP

function getAmountBeansToFillOrderV2(
    uint256 placeInLine, 
    uint256 amountPodsFromOrder,
    bytes calldata pricingFunction
) public pure returns (uint256 beanAmount);

WIP

Parameter
Type
Description

placeInLine

uint256

WIP

amountPodsFromOrder

uint256

WIP

pricingFunction

bytes

WIP

Return Value
Type
Description

beanAmount

uint256

WIP

View Functions

function podOrder(
    address account,
    uint24 pricePerPod,
    uint256 maxPlaceInLine,
    uint256 minFillAmount
) external view returns (uint256);

WIP

Parameter
Type
Description

account

address

WIP

pricePerPod

uint24

WIP

maxPlaceInLine

uint256

WIP

minFillAmount

uint256

WIP

Return Value
Description

uint256

WIP

function podOrderV2(
    address account,
    uint256 maxPlaceInLine,
    uint256 minFillAmount,
    bytes calldata pricingFunction
) external view returns (uint256);

WIP

Parameter
Type
Description

account

address

WIP

maxPlaceInLine

uint256

WIP

minFillAmount

uint256

WIP

pricingFunction

bytes

WIP

Return Type
Description

uint256

WIP

function podOrderById(bytes32 id) external view returns (uint256);

WIP

Parameter
Type
Description

id

bytes32

WIP

Return Type
Description

uint256

WIP

function podListing(uint256 index) external view returns (bytes32);

WIP

Parameter
Type
Description

index

uint256

WIP

Return Type
Description

bytes32

WIP

function allowancePods(address owner, address spender)
    public
    view
    returns (uint256);

WIP

Parameter
Type
Description

owner

address

WIP

spender

address

WIP

Return Type
Description

uint256

WIP

Events

event PodListingCreated(
    address indexed account, 
    uint256 index, 
    uint256 start, 
    uint256 amount, 
    uint24 pricePerPod, 
    uint256 maxHarvestableIndex, 
    uint256 minFillAmount,
    bytes pricingFunction,
    LibTransfer.To mode,
    LibPolynomial.PriceType pricingType
);

WIP

Parameter
Type
Description

account

address

WIP

index

uint256

WIP

start

uint256

WIP

amount

uint256

WIP

pricePerPod

uint24

WIP

maxHarvestableIndex

uint256

WIP

minFillAmount

uint256

WIP

pricingFunction

bytes

WIP

mode

To

WIP

pricingType

PriceType

WIP

event PodListingFilled(
    address indexed from,
    address indexed to,
    uint256 index,
    uint256 start,
    uint256 amount,
    uint256 costInBeans
);

WIP

Parameter
Type
Description

from

address

WIP

to

address

WIP

index

uint256

WIP

start

uint256

WIP

amount

uint256

WIP

costInBeans

uint256

WIP

event PodListingCancelled(address indexed account, uint256 index);

WIP

Parameter
Type
Description

account

address

WIP

index

uint256

WIP

event PodOrderCreated(
    address indexed account,
    bytes32 id,
    uint256 amount,
    uint24 pricePerPod,
    uint256 maxPlaceInLine,
    uint256 minFillAmount,
    bytes pricingFunction,
    LibPolynomial.PriceType priceType
);

WIP

Parameter
Type
Description

account

address

WIP

id

bytes32

WIP

amount

uint256

WIP

pricePerPod

uint24

WIP

maxPlaceInLine

uint256

WIP

minFillAmount

uint256

WIP

pricingFunction

bytes

WIP

priceType

PriceType

WIP

event PodOrderFilled(
    address indexed from,
    address indexed to,
    bytes32 id,
    uint256 index,
    uint256 start,
    uint256 amount,
    uint256 costInBeans
);

WIP

Parameter
Type
Description

from

address

WIP

to

address

WIP

id

bytes32

WIP

index

uint256

WIP

start

uint256

WIP

amount

uint256

WIP

costInBeans

uint256

WIP

event PodOrderCancelled(address indexed account, bytes32 id);

WIP

Parameter
Type
Description

account

address

WIP

id

bytes32

WIP

event PlotTransfer(
    address indexed from,
    address indexed to,
    uint256 indexed id,
    uint256 pods
);

WIP

Parameter
Type
Description

from

address

WIP

to

address

WIP

id

uint256

WIP

pods

uint256

WIP

event PodApproval(
    address indexed owner,
    address indexed spender,
    uint256 pods
);

WIP

Parameter
Type
Description

owner

address

WIP

spender

address

WIP

pods

uint256

WIP

Last updated