Write
deposit
Deposits the supplied Gobblers/Goo from the owner and sends fractions to the receiver.
function deposit(
uint256[] calldata gobblers,
uint256 gooTokens,
address receiver
) external returns (uint256 fractions);
Name | Type | Description |
---|---|---|
gobblers | uint256[] | Array of Gobbler ids. |
gooTokens | uint256 | Amount of Goo to deposit. |
receiver | address | Address to receive fractions. |
Return Values:
Name | Type | Description |
---|---|---|
fractions | uint256 | Amount of fractions created. |
safeDeposit
Deposits the supplied Gobblers/Goo from the owner and sends fractions to the receiver whilst ensuring a deadline is met, and a minimum amount of fractions are created.
function safeDeposit(
uint256[] calldata gobblers,
uint256 gooTokens,
address receiver,
uint256 minFractionsOut,
uint256 deadline
) external returns (uint256 fractions);
Parameters:
Name | Type | Description |
---|---|---|
gobblers | uint256[] | Array of Gobbler ids to deposit. |
gooTokens | uint256 | Amount of Goo to deposit. |
receiver | address | Address to receive fractions. |
maxFractionsIn | uint256 | Minimum amount of fractions to be sent. |
deadline | uint256 | Unix timestamp by which the transaction must execute. |
Return Values:
Name | Type | Description |
---|---|---|
fractions | uint256 | Amount of fractions created. |
swap
Swaps supplied Gobblers/Goo for Gobblers/Goo in the pool.
Unlike Uni V2, we only need to send the data, because token transfers in are pulled below.
function swap(
uint256[] calldata gobblersIn,
uint256 gooIn,
uint256[] calldata gobblersOut,
uint256 gooOut,
address receiver,
bytes calldata data
) external returns (int256 erroneousGoo);
Parameters:
Name | Type | Description |
---|---|---|
gobblersIn | uint256[] | Gobblers sent from msg.sender. |
gooIn | uint256 | Goo sent from msg.sender. |
gobblersOut | uint256[] | Gobblers optimistically transferred to the receiver. |
gooOut | uint256 | Goo optimistically transferred to the receiver. |
receiver | address | gobblersOut and gooOut transferred to this address. |
data | bytes | Used to trigger flash loan. |
Return Values:
Name | Type | Description |
---|---|---|
erroneousGoo | int256 | Difference in gooOut expected compared to actual. |
safeSwap
Swaps supplied Gobblers/Goo for Gobblers/Goo in the pool, with slippage and deadline control.
Unlike Uni V2, we only need to send the data, because token transfers in are pulled below.
function safeSwap(
uint256 erroneousGooAbs,
uint256 deadline,
uint256[] calldata gobblersIn,
uint256 gooIn,
uint256[] calldata gobblersOut,
uint256 gooOut,
address receiver,
bytes calldata data
) external returns (int256 erroneousGoo);
Parameters:
Name | Type | Description |
---|---|---|
erroneousGooAbs | uint256 | Slippage limit on erroneousGoo. |
deadline | uint256 | Unix timestamp by which the transaction must execute. |
gobblersIn | uint256[] | Gobblers sent from msg.sender. |
gooIn | uint256 | Goo sent from msg.sender. |
gobblersOut | uint256[] | Gobblers optimistically transferred to the receiver. |
gooOut | uint256 | Goo optimistically transferred to the receiver. |
receiver | address | gobblersOut and gooOut transferred to this address. |
data | bytes | Used to trigger flash loan. |
Return Values:
Name | Type | Description |
---|---|---|
erroneousGoo | int256 | Difference in gooOut expected compared to actual. |
withdraw
Withdraws the requested Gobblers and Goo from the vault.
function withdraw(
uint256[] calldata gobblers,
uint256 gooTokens,
address receiver,
address owner)
external returns (uint256 fractions);
Parameters:
Name | Type | Description |
---|---|---|
gobblers | uint256[] | Array of Gobbler ids to withdraw. |
gooTokens | uint256 | Amount of Goo to withdraw. |
receiver | address | Address to receive the Goo and Gobblers. |
owner | address | Owner of the fractions to be destroyed. |
Return Values:
Name | Type | Description |
---|---|---|
fractions | uint256 | Amount of fractions destroyed |
safeWithdraw
Withdraws the requested Gobblers/Goo from the vault to the receiver and destroys fractions from the owner whilst ensuring a deadline is met, and a maximum amount of fractions are destroyed.
function safeWithdraw(
uint256[] calldata gobblers,
uint256 gooTokens,
address receiver,
address owner,
uint256 maxFractionsIn,
uint256 deadline
) external returns (uint256 fractions);
Parameters:
Name | Type | Description |
---|---|---|
gobblers | uint256[] | Array of Gobbler ids to withdraw. |
gooTokens | uint256 | Amount of Goo to withdraw. |
receiver | address | Address to receive the Goo and Gobblers. |
owner | address | Owner of the fractions to be destroyed. |
maxFractionsIn | uint256 | Maximum amount of fractions to be destroyed. |
deadline | uint256 | Unix timestamp by which the transaction must execute. |
Return Values:
Name | Type | Description |
---|---|---|
fractions | uint256 | Amount of fractions destroyed |