-
Notifications
You must be signed in to change notification settings - Fork 121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Examples to integrate with Wyvern from a smart contract #55
Comments
For a PoC so far this is what I ended up with, but currently have 2 problems:
bytes constant emptyBytes = bytes("");
bytes constant replacementPattern = bytes(hex"000000000000000000000000000000000000000000000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000000000000000000000000000");
function putForSale(
address owner,
uint256 tokenId,
uint256 salePrice
) public virtual isDirectory()
{
uint zero = 0;
uint one = 1;
address zeroAddr = address(0);
bytes memory transferCalldata = abi.encodeWithSignature("transferFrom(address,address,uint256)", owner, zeroAddr, tokenId);
address[7] memory addrs;
uint[9] memory uints;
{
addrs = [
// Exchange
address(_wyvernExchange),
// Maker
address(this),
// Taker
zeroAddr,
// Fee Recipient
_openSeaWallet,
// Target (Asset Contract)
address(_directory),
// Static Target
zeroAddr,
// Token used to pay for the order, or the zero-address as a sentinel value for Ether
zeroAddr
];
}
{
uints = [
// Maker Relayer Fee
500,
// Taker Relayer Fee
zero,
// Maker Protocol Fee
zero,
// Taker Protocol Fee
zero,
// Base price of the order (in paymentTokens)
salePrice,
// Auction extra parameter - minimum bid increment for English auctions, starting/ending price difference
zero,
// Expiration timestamp - 0 for no expiry
block.timestamp,
zero,
// Order salt, used to prevent duplicate hashes
uint(keccak256(abi.encodePacked(block.difficulty, block.timestamp)))
];
}
{
_approveWyvernOrder(
addrs,
uints,
transferCalldata
);
}
}
function _approveWyvernOrder(
address[7] memory addrs,
uint[9] memory uints,
bytes memory transferCalldata
) internal {
_wyvernExchange.approveOrder_(
addrs,
uints,
// Fee Method (split fee): Maker fees are deducted from the token amount that the maker receives. Taker fees are extra tokens that must be paid by the taker.
WyvernExchangeInterface.FeeMethod.SplitFee,
// Side (sell)
WyvernExchangeInterface.Side.Sell,
// Sale Kind (fixed price)
WyvernExchangeInterface.SaleKind.FixedPrice,
// How to call (call)
WyvernExchangeInterface.HowToCall.Call,
// Call Data
transferCalldata,
// Replacement Pattern
replacementPattern,
// staticExtradata
emptyBytes,
// orderbookInclusionDesired
true
);
} |
This is an example NFT where I called approveOrder_ but don't see it listed on OpenSea: https://testnets.opensea.io/assets/0xda25087323285AE25e00E8C373a9184fb558D831/100 on this transaction https://rinkeby.etherscan.io/tx/0xe32bf43e6a08e9fa0e28c54e55db68d0d2849d0c93e3d26acb81ab880cabfc47#eventlog |
Now I figured out I have to call OpenSea API to "post" the order... There's a problem which I'm guessing is on OpenSea backend side. I'm using a different "maker" than the "owner" in the calldata... So currently, I have
And I think this is because OpenSea backend expects "owner == marketer" which is just one way of working with Wyvern protocol if I'm not mistaken... For more context, calldata is for
|
@cwgoes @MarvinJanssen would you be able to help me on above? |
@aramalipoor Hey Aram, we are also trying to initiate a sell and buy orders via smart contract. Have you manage to make any progress? |
Hi @Rotemy @aramalipoor -- we are facing a similar issue |
Yes, but the seller or buyer should either be the smart contract or the user has to sign the sell/buy order in advanced |
Hi @Rotemy, Thanks a lot for your reply. Then, this would be correct?
where address(this) would be the contract address and then the buyer. |
well, there is a replacement pattern that will change the address(0) to the
buyer, so you can keep it like that or change zeroAddres to buyer address.
…On Fri, Nov 19, 2021 at 2:24 PM priviprotocol ***@***.***> wrote:
Hi Rotemy,
Thanks a lot for your reply.
Then, this would be correct?
bytes memory transferCalldata =
abi.encodeWithSignature("transferFrom(address,address,uint256)",
address(this), zeroAddr, tokenId);`
where address(this) would be the contract address and then the buyer.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#55 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAFOG75E5AWCAUIIK6WPQRLUMY6YVANCNFSM47HLK4KQ>
.
--
Kind regards,
Rotem Yakir
+972547545695
|
Thanks again for the answer @Rotemy. Let me state better our problem. We are trying to list a selling offer on Opensea from our contract. This is the post request we are doing:
after calling approveOrder on Wyvern Exchange https://rinkeby.etherscan.io/tx/0x2153ca6f7cc1aac8f08e7a65df424bab1b2d4b3209dccd9d9a6f0c4885cb6602#eventlog However the response we are getting is:
I would be great if you could give some guidance or support on that. Thanks in advance. |
Hi @Rotemy, @priviprotocol, I am also trying to initiate sell order via smart contract. |
Hello guys, do you know how to get the orderbook of a token from the wyvern exchange? |
you mean how to get order data for available atomic matches on Wyvern? I want to know the same |
Hello there,
Thanks for the amazing platform! We're building a NFT platform with some special rules, because of these (specifically that "transferFrom" and "approve" cannot be called by owners themselves) we have to automatically list them on OpenSea.
From my understanding so far we need to call
approveOrder_
from a contract who has the ability to do approve and transferFrom on those NFTs. We were thinking of having a "Marketer" contract which has a special access to do these operations on all NFTs on behalf of holders.Assuming, above is correct there are a few questions I have:
Thank you so much in advance :)
The text was updated successfully, but these errors were encountered: