Giter VIP home page Giter VIP logo

blur-analysis's Issues

execution reverted: Sell failed authorization

Hello. Trying to execute, but getting error "Sell failed authorization"

What's wrong with my code?

const ethers = require("ethers");

const OracleOrder = [
  { name: 'order', type: 'Order' },
  { name: 'blockNumber', type: 'uint256' },
]
const Order = [
  { name: 'trader', type: 'address' },
  { name: 'side', type: 'uint8' },
  { name: 'matchingPolicy', type: 'address' },
  { name: 'collection', type: 'address' },
  { name: 'tokenId', type: 'uint256' },
  { name: 'amount', type: 'uint256' },
  { name: 'paymentToken', type: 'address' },
  { name: 'price', type: 'uint256' },
  { name: 'listingTime', type: 'uint256' },
  { name: 'expirationTime', type: 'uint256' },
  { name: 'fees', type: 'Fee[]' },
  { name: 'salt', type: 'uint256' },
  { name: 'extraParams', type: 'bytes' }
]
const Fee = [
  { name: 'rate', type: 'uint16' },
  { name: 'recipient', type: 'address' },
]
const domain = {
	name: 'Blur Exchange',
	version: '1.0',
	chainId: '1',
	verifyingContract: '0x000000000000ad05ccc4f10045630fb830b95127',
}

const execute = async () => {
	const node = new ethers.providers.JsonRpcProvider("https://rpc.ankr.com/eth");
	
	const listingTime = String((((Date.now() - 1000000) / 1000)).toFixed());
	const expirationTime = String(((Date.now() + 1000 * 60 * 60 * 24 * 3) / 1000).toFixed());
	const salt = "5287962905876209576"
	const block = await node.getBlockNumber();
	
	const sellOrder = {
		"trader":sellerAddress,
		"side":"1",
		"matchingPolicy":"0x00000000006411739DA1c40B106F8511de5D1FAC",
		"collection":"0xaC3748673eE62a248D859191a74FBf837A448FD3",
		"tokenId":"2",
		"amount":"1",
		"paymentToken":"0x0000000000000000000000000000000000000000",
		"price":"1000000000000000",
		"listingTime":listingTime,
		"expirationTime":expirationTime,
		"fees":[{
			"rate":"10000",
			"recipient":buyerAddress
			}],
		"salt":salt,
		"extraParams":"0x"
		}
	
	sell_signature = await sellerSigner._signTypedData(domain, {Order, Fee}, sellOrder);
	sell_signature = await ethers.utils.splitSignature(sell_signature);
	
	const buyOrder = {
		"trader":buyerAddress,
		"side":"0","matchingPolicy":"0x00000000006411739DA1c40B106F8511de5D1FAC",
		"collection":"0xaC3748673eE62a248D859191a74FBf837A448FD3",
		"tokenId":"2",
		"amount":"1",
		"paymentToken":"0x0000000000000000000000000000000000000000",
		"price":"1000000000000000",
		"listingTime":listingTime,
		"expirationTime":expirationTime,
		"fees":[],
		"salt":salt,
		"extraParams":"0x"
		}
	
	const sell = {
		"order": sellOrder,
		"v": sell_signature.v,
		"r": sell_signature.r,
		"s": sell_signature.s,
		"extraSignature": "0x",
		"signatureVersion": "0",
		"blockNumber": block
		}
	const buy = {
		"order": buyOrder,
		"v": 0,
		"r": "0x0000000000000000000000000000000000000000000000000000000000000000",
		"s": "0x0000000000000000000000000000000000000000000000000000000000000000",
		"extraSignature": "0x",
		"signatureVersion": "0",
		"blockNumber": block
		}
		console.log(JSON.stringify(sell))
		console.log(JSON.stringify(buy))
	const contract = new ethers.Contract("0x000000000000ad05ccc4f10045630fb830b95127", Blur_ABI, buyerSigner);
	const transaction = await contract.execute(
		sell, buy
	)
	console.log(transaction);
}
execute()

📌 Follow the Step-by-Step Guide to Claim Your $700 Now!

Introduction:

Welcome to the exciting world of crypto airdrops! Here's a curated list of active airdrops that you wouldn't want to miss. Dive in and explore the opportunities:

📌 Follow the Step-by-Step Guide to Claim Your Tokens!

  1. Share on Social Media:

    🚀 Claim Your Share: Pyth Network Airdrop 🚀 Unlock the potential of $PYTH tokens in this step-by-step guide. Claim yours now! Share on Twitter

    — Pyth Network (@pythnetwork) November 28, 2023
  2. Verify Eligibility:
    After sharing and connecting your walle

Active Airdrops:

  1. Layer Zero Airdrop

    Layer Zero Banner
  2. Pyth Network Airdrop

    Pyth Network Banner
  3. Mantle Network Airdrop

    Mantle Network Banner

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.