ZivoeDAO.sol
DAO -> Decentralized Autonomous Organization
Introduction
This contract escrows assets for the Zivoe protocol and is governed by TimelockController (effectively $ZVE Governance).
This contract has the following responsibilities:
Push assets (ERC20, ERC721, ERC1155) to a locker.
Pull assets (ERC20, ERC721, ERC1155) from a locker.
Enforce a whitelist of "lockers" (ZivoeLockers).
State Variables
address
GBL
The ZivoeGlobals contract.
Sections
push() - Pushes an ERC20 token from ZivoeDAO to locker.
pull() - Pulls ERC20 from locker to ZivoeDAO.
pullPartial() - Pulls specific amount of ERC20 from locker to ZivoeDAO.
pushMulti() - Pushes ERC20(s) from locker to ZivoeDAO.
pullMulti() - Pulls ERC20(s) from locker to ZivoeDAO.
pullMultiPartial() - Pulls specific amount(s) of ERC20(s) from locker to ZivoeDAO.
pushERC721() - Pushes an NFT from ZivoeDAO to locker.
pushMultiERC721() - Pushes NFT(s) from ZivoeDAO to locker.
pullERC721() - Pulls an NFT from locker to ZivoeDAO.
pushMultiERC721() - Pulls NFT(s) from locker to ZivoeDAO.
pushERC1155() - Pushes ERC1155 assets from ZivoeDAO to locker.
pullERC1155() - Pulls ERC1155 assets from locker to ZivoeDAO.
Write Functions
push()
push()
Pushes an ERC20 token from ZivoeDAO to locker.
function push(
address locker,
address asset,
uint256 amount,
bytes calldata data
) external onlyOwner nonReentrant;
address
locker
The locker to push an ERC20 token to.
address
asset
The ERC20 token to push.
uint256
amount
The amount of "asset" to push.
bytes
data
Accompanying transaction data.
Emits the Pushed() event
pull()
pull()
Pulls ERC20 from locker to ZivoeDAO.
function pull(
address locker,
address asset,
bytes calldata data
) external onlyOwner nonReentrant;
address
locker
The locker to pull from.
address
asset
The asset to pull.
bytes
data
Accompanying transaction data.
Emits the Pulled() event
pullPartial()
pullPartial()
Pulls specific amount of ERC20 from locker to ZivoeDAO.
function pullPartial(
address locker,
address asset,
uint256 amount,
bytes calldata data
) external onlyOwner nonReentrant;
address
locker
The locker to pull from.
address
asset
The asset to pull.
uint256
amount
The amount to pull (may not refer to "asset", but rather a different asset within the locker).
bytes
data
Accompanying transaction data.
Emits the PulledPartial() event
pushMulti()
pushMulti()
Pushes ERC20(s) from locker to ZivoeDAO.
function pushMulti(
address locker,
address[] calldata assets,
uint256[] calldata amounts,
bytes[] calldata data
) external onlyOwner nonReentrant;
address
locker
The locker to push capital to.
address[]
assets
The assets to push to locker.
uint256[]
amounts
The amount of "asset" to push.
bytes[]
data
Accompanying transaction data.
Emits the Pushed() event (multiple times)
pullMulti()
pullMulti()
Pulls ERC20(s) from locker to ZivoeDAO.
function pullMulti(
address locker,
address[] calldata assets,
bytes[] calldata data
) external onlyOwner nonReentrant;
address
locker
The locker to pull from.
address[]
assets
The assets to pull.
bytes[]
data
Accompanying transaction data.
Emits the Pulled() event (multiple times)
pullMultiPartial()
pullMultiPartial()
Pulls specific amount(s) of ERC20(s) from locker to ZivoeDAO.
function pullMultiPartial(
address locker,
address[] calldata assets,
uint256[] calldata amounts,
bytes[] calldata data
) external onlyOwner nonReentrant;
address
locker
The locker to pull from.
address[]
assets
The asset(s) to pull.
uint256[]
amounts
The amount(s) to pull (may not refer to "asset", rather a different asset within the locker).
bytes[]
data
Accompanying transaction data.
Emits the PulledPartial() event (multiple times)
pushERC721()
pushERC721()
Pushes an NFT from ZivoeDAO to locker.
function pushERC721(
address locker,
address asset,
uint256 tokenId,
bytes calldata data
) external onlyOwner nonReentrant;
address
locker
The locker to push an NFT to.
address
asset
The NFT contract.
uint256
tokenId
The NFT tokenId to push.
bytes
data
Accompanying data for the transaction.
Emits the PushedERC721()
pushMultiERC721()
pushMultiERC721()
Pushes NFT(s) from ZivoeDAO to locker.
function pushMultiERC721(
address locker,
address[] calldata assets,
uint[] calldata tokenIds,
bytes[] calldata data
) external onlyOwner nonReentrant;
address
locker
The locker to push NFTs to.
address[]
assets
The NFT contract(s).
uint256[]
tokenIds
The NFT tokenId(s) to push.
bytes[]
data
Accompanying data for the transaction(s).
Emits the PushedERC721() event (multiple times)
pullERC721()
pullERC721()
Pulls an NFT from locker to ZivoeDAO.
function pullERC721(
address locker,
address asset,
uint tokenId,
bytes calldata data
) external onlyOwner nonReentrant;
address
locker
The locker to pull from.
address
asset
The NFT contract.
uint256
amount
The NFT tokenId to pull.
bytes
data
Accompanying data for the transaction.
Emits the PulledERC721()
pullMultiERC721()
pullMultiERC721()
Pulls NFT(s) from locker to ZivoeDAO.
function pullMultiERC721(
address locker,
address[] calldata assets,
uint[] calldata tokenIds,
bytes[] calldata data
) external onlyOwner nonReentrant;
address
locker
The locker to pull from.
address[]
assets
The NFT contract(s).
uint256[]
tokenIds
The NFT tokenId(s) to pull.
bytes[]
data
Accompanying data for the transaction(s).
Emits the PulledERC721() event (multiple times)
pushERC1155()
pushERC1155()
Pushes ERC1155 assets from ZivoeDAO to locker.
function pushERC1155Batch(
address locker,
address asset,
uint256[] calldata ids,
uint256[] calldata amounts,
bytes calldata data
) external onlyOwner nonReentrant;
address
locker
The locker to push ERC1155 assets to.
address
asset
The ERC1155 asset to push to locker.
uint256[]
ids
The ids of "assets" to push.
uint256[]
amounts
The amounts of "assets" to push.
bytes
data
Accompanying data for the transaction.
Emits the PushedERC1155() event
pullERC1155()
pullERC1155()
Pulls ERC1155 assets from locker to ZivoeDAO.
function pullERC1155Batch(
address locker,
address asset,
uint256[] calldata ids,
uint256[] calldata amounts,
bytes calldata data
) external onlyOwner nonReentrant;
address
locker
The locker to pull from.
address
asset
The ERC1155 asset to pull.
uint256[]
ids
The ids of "assets" to pull.
uint256[]
amounts
The amounts of "assets" to pull.
bytes
data
Accompanying data for the transaction.
Emits the PulledERC1155() event
Events
Pushed()
Pushed()
Emitted during push() and pushMulti()
event Pushed(
address indexed locker,
address indexed asset,
uint256 amount,
bytes data
);
address
True
locker
The locker receiving "asset".
address
True
asset
The asset being pushed.
uint256
False
amount
The amount of "asset" being pushed.
bytes
False
data
Accompanying transaction data.
Pulled()
Pulled()
Emitted during pull() and pullMulti()
event Pulled(
address indexed locker,
address indexed asset,
bytes data
);
address
True
locker
The locker "asset" is pulled from.
address
True
asset
The asset being pulled.
bytes
False
data
Accompanying transaction data.
PulledPartial()
PulledPartial()
Emitted during pullPartial() and pullMultiPartial()
event PulledPartial(
address indexed locker,
address indexed asset,
uint256 amount,
bytes data
);
address
True
locker
The locker "asset" is pulled from.
address
True
asset
The asset being pulled.
uint256
False
amount
The amount of "asset" being pulled (or could represent a percentage, in basis points).
bytes
False
data
Accompanying transaction data.
PushedERC721()
PushedERC721()
Emitted during pushERC721() and pushMultiERC721()
event PushedERC721(
address indexed locker,
address indexed asset,
uint256 indexed tokenId,
bytes data
);
address
True
locker
The locker receiving "asset".
address
True
asset
The ERC721 contract.
tokenId
The ID for a given "asset" / NFT.
bytes
False
data
Accompanying data for the transaction.
PulledERC721()
PulledERC721()
Emitted during pullERC721() and pullMultiERC721()
event PulledERC721(
address indexed locker,
address indexed asset,
uint256 indexed tokenId,
bytes data
);
address
True
locker
The locker "assets" are pulled from.
address
True
asset
The ERC721 contract.
uint256
True
tokenId
The ID for a given "asset" / NFT.
bytes
False
data
Accompanying data for the transaction.
PushedERC1155()
PushedERC1155()
Emitted during pushERC1155()
event PushedERC1155(
address indexed locker,
address indexed asset,
uint256[] ids,
uint256[] amounts,
bytes data
);
address
True
locker
The locker receiving "asset".
address
True
asset
The ERC1155 contract.
uint256[]
False
ids
The IDs for a given "asset" (ERC1155), corresponds to "amounts".
uint256[]
False
amounts
The amount of "id" to transfer.
bytes
False
data
Accompanying data for the transaction.
PulledERC1155()
PulledERC1155()
Emitted during pullERC1155()
event PulledERC1155(
address indexed locker,
address indexed asset,
uint256[] ids,
uint256[] amounts,
bytes data
);
address
True
locker
The locker "asset" is pulled from.
address
True
asset
The ERC1155 contract.
uint256[]
False
ids
The IDs for a given "asset" (ERC1155), corresponds to "amounts".
uint256[]
False
amounts
The amount of "id" to transfer.
bytes
False
data
Accompanying data for the transaction.
Last updated