This repo contains extensions of JBETHERC20ProjectPayer
which which makes it possible for JB treasuries to integrate with Slice, and more in general to receive ERC721 and ERC1155 tokens.
JBETHERC20ProjectPayerTokensReceiver
includes logic to:
- Receive ERC1155 and ERC721 tokens
- Transfer ERC1155, ERC721 and ERC20 tokens received (OnlyOwner)
This basically turns the contract into a NFT vault for JB treasuries, while allowing projects to use Slice protocol and split payments or sell anything fully on-chain via decentralized stores.
The contract can be deployed directly, via a
JBETHERC20ProjectPayerERC1155ReceiverDeployer
contract, or via a clone factoryJBETHERC20ProjectPayerTokensReceiverCloneDeployer
(cheapest method).
- Deploy or clone contract
- Send ERC1155 or ERC721 tokens to it
- Contract owner (ideally also JB project owner) can send them out of contract to a desired address
This contract is able to receive Slices
(ERC1155 tokens) and receive income from a slicer. It acts as a bridge contract between the Slice protocol and a JB treasury.
- Slices can be sent either during slicer creation or via token transfer
- Earnings from a slicer can be withdrawn by going to its page on Slice.so and releasing the due amount from the
See owners
section
These extensions can be deployed by running scripts/clone.ts
, or using the interface provided by Slice at slice.so/jbpayer (on Rinkeby, testnet.slice.so/jbpayer)
Immutable clones allow to reduce deployment cost of
project payer
by ~80-85%.
The following contracts can be found in contracts/clone
:
JBETHERC20ProjectPayerClone
: Clone implementation of originalJBETHERC20ProjectPayer
JBETHERC20ProjectPayerERC1155ReceiverClone
: Clone implementation ofJBETHERC20ProjectPayerERC1155Receiver
JBETHERC20ProjectPayerERC1155ReceiverCloneDeployer
: Factory contract to deploy and initializeJBETHERC20ProjectPayerERC1155ReceiverClone
clones.JBETHERC20ProjectPayerTokensReceiverClone
: Clone implementation ofJBETHERC20ProjectPayerTokensReceiver
JBETHERC20ProjectPayerTokensReceiverCloneDeployer
: Factory contract to deploy and initializeJBETHERC20ProjectPayerTokensReceiverClone
clones.
JBETHERC20ProjectPayerERC1155Receiver
contracts contains the same logic, just without support for ERC721 tokens.
- Rinkeby Clone Factory:
0x3991cb7d214Ffb94ad792a45D329d2bCF977961B
- Ethereum Mainnet Clone Factory:
0x76dad5968ab456b5a36698a252b30488a1a4f767
See full list of addresses in addresses.json
deploy
: Deploys instance ofJBETHERC20ProjectPayerTokensReceiver
deployFactory
: Deploys instance ofJBETHERC20ProjectPayerTokensReceiverCloneDeployer
orJBETHERC20ProjectPayerTokensReceiverDeployer
(default is clone factory)clone
: Deploys immutable clone proxy ofJBETHERC20ProjectPayerTokensReceiverClone
, via factory contracttransferERC20
: Script to test ERC20 transfers from jb-payer contracttransferERC1155
: Script to test ERC1155 transfers from jb-payer contract
- Example clone implementation contract: 0xa258299345ea4490A0323035249fE33198283789
- This JB V2 treasury on Rinkeby has used the contract above to direct income from Slice directly into the treasury, upon withdraw. (Note: tx don't appear in the activity section as
addToBalance
is used instead ofpay
. See this transaction on Etherscan for more details) - See all relevant Rinkeby and mainnet deployments in addresses.json
- Slice mints SLX tokens to slicer owners, so the jb-payer contract also ends up holding an amount of SLX when used with Slice protocol. The
_transferERC20To
function was added to allow the contract owner to transfer these tokens out of the contract.