Skip to content

Commit

Permalink
ui trade fungibles wip
Browse files Browse the repository at this point in the history
  • Loading branch information
bokkypoobah committed Sep 12, 2024
1 parent e9aef4a commit 54ee85e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 26 deletions.
2 changes: 1 addition & 1 deletion docs/parsers.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function parseTokenEventLogs(logs, chainId, latestBlockNumber) {
}
}
}
console.log(now() + " INFO functions:parseTokenEventLogs - records: " + JSON.stringify(records, null, 2));
// console.log(now() + " INFO functions:parseTokenEventLogs - records: " + JSON.stringify(records, null, 2));
return records;
}

Expand Down
52 changes: 27 additions & 25 deletions docs/tradeFungibles.js
Original file line number Diff line number Diff line change
Expand Up @@ -936,34 +936,36 @@ tokenAgentFactoryEvents: {{ tokenAgentFactoryEvents }}
console.log(now() + " INFO TradeFungibles:methods.loadData - approvalAddresses: " + JSON.stringify(approvalAddresses));
console.log(now() + " INFO TradeFungibles:methods.loadData - balanceAddresses: " + JSON.stringify(balanceAddresses));

const tokenApprovalsfilter = {
address: null,
fromBlock: 0,
toBlock: blockNumber,
topics: [
[
// ERC-20 event Approval(address indexed owner, address indexed spender, uint tokens);
ethers.utils.id("Approval(address,address,uint256)"),
// ERC-721 Approval (address indexed owner, address indexed approved, uint256 indexed tokenId)
// ethers.utils.id("Approval(address,address,uint256)"),
// ERC-721 event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
// ethers.utils.id("ApprovalForAll(address,address,bool)"),
// ERC-1155 event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
// ethers.utils.id("ApprovalForAll(address,address,bool)"),
],
null,
approvalAddresses.map(e => '0x000000000000000000000000' + e.substring(2, 42).toLowerCase()),
// [ '0x000000000000000000000000' + this.settings.tokenAgentAddress.substring(2, 42).toLowerCase() ],
],
};
// console.log(now() + " INFO TradeFungibles:methods.loadData - tokenApprovalsfilter: " + JSON.stringify(tokenApprovalsfilter, null, 2));
const tokenApprovalsEventLogs = await provider.getLogs(tokenApprovalsfilter);
// console.log(now() + " INFO TradeFungibles:methods.loadData - tokenApprovalsEventLogs: " + JSON.stringify(tokenApprovalsEventLogs, null, 2));
const tokenApprovals = parseTokenEventLogs(tokenApprovalsEventLogs, this.chainId, blockNumber);
console.log(now() + " INFO TradeFungibles:methods.loadData - tokenApprovals: " + JSON.stringify(tokenApprovals));
// localStorage.tokenAgentTradeFungiblesApprovals = JSON.stringify(this.approvals);

}

return;
const tokenApprovalsfilter = {
address: null,
fromBlock: 0,
toBlock: blockNumber,
topics: [
[
// ERC-20 event Approval(address indexed owner, address indexed spender, uint tokens);
ethers.utils.id("Approval(address,address,uint256)"),
// ERC-721 Approval (address indexed owner, address indexed approved, uint256 indexed tokenId)
// ethers.utils.id("Approval(address,address,uint256)"),
// ERC-721 event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
ethers.utils.id("ApprovalForAll(address,address,bool)"),
// ERC-1155 event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
// ethers.utils.id("ApprovalForAll(address,address,bool)"),
],
null,
[ '0x000000000000000000000000' + this.settings.tokenAgentAddress.substring(2, 42).toLowerCase() ],
],
};
console.log(now() + " INFO TradeFungibles:methods.loadData - tokenApprovalsfilter: " + JSON.stringify(tokenApprovalsfilter, null, 2));
const tokenApprovalsEventLogs = await provider.getLogs(tokenApprovalsfilter);
// console.log(now() + " INFO TradeFungibles:methods.loadData - tokenApprovalsEventLogs: " + JSON.stringify(tokenApprovalsEventLogs, null, 2));
this.approvals = parseTokenEventLogs(tokenApprovalsEventLogs, this.chainId, blockNumber);
// console.log(now() + " INFO TradeFungibles:methods.loadData - this.approvals: " + JSON.stringify(this.approvals, null, 2));
localStorage.tokenAgentTradeFungiblesApprovals = JSON.stringify(this.approvals);

const tokenAgentEventsfilter = {
address: this.settings.tokenAgentAddress,
Expand Down

0 comments on commit 54ee85e

Please sign in to comment.