Skip to main content

BunniZone

BunniZone is a contract that validates orders for the Flood protocol, specifically for autonomously rebalancing Bunni pools. It's used to restrict executing rebalance swap orders to a whitelisted set of fulfillers as well as the am-AMM manager of a pool.

State Variables

isWhitelisted

mapping(address => bool) public isWhitelisted;

A mapping that stores whether an address is whitelisted or not.

Constructor

constructor(address initialOwner)

Initializes the contract with the given initial owner.

Parameters:

NameTypeDescription
initialOwneraddressThe address of the initial owner

Functions

setIsWhitelisted

function setIsWhitelisted(address account, bool isWhitelisted_) external onlyOwner

Sets the whitelist status for a given account. Only callable by the owner.

Parameters:

NameTypeDescription
accountaddressThe address to set the whitelist status for
isWhitelisted_boolThe new whitelist status

validate

function validate(IFloodPlain.Order calldata order, address fulfiller) external view returns (bool)

Validates an order for the Flood protocol. Only allows whitelisted fulfillers and the am-AMM manager of the pool to fulfill orders.

Parameters:

NameTypeDescription
orderIFloodPlain.OrderThe order to validate
fulfilleraddressThe address attempting to fulfill the order

Returns:

TypeDescription
boolTrue if the fulfiller is allowed, false otherwise

fee

function fee(IFloodPlain.Order calldata, address) external pure returns (IZone.FeeInfo memory)

Returns the fee information for an order. In this implementation, it always returns zero fees.

Parameters:

NameTypeDescription
orderIFloodPlain.OrderThe order
-addressUnused parameter

Returns:

TypeDescription
IZone.FeeInfoThe fee information (always zero in this implementation)

Events

SetIsWhitelisted

event SetIsWhitelisted(address indexed account, bool indexed isWhitelisted)

Emitted when the whitelist status of an account is changed.

Parameters:

NameTypeIndexedDescription
accountaddressYesThe address whose status changed
isWhitelistedboolYesThe new whitelist status