Skip to content

Commit

Permalink
[PAY-489] Add endpoint to get ethereum-nft-gated premium track signat…
Browse files Browse the repository at this point in the history
…ures (#4241)

* Add endpoint to get ethereum-nft-gated premium track signatures

* Fix bugs

* Add comments

* Update premium conditions in track schemas

* Update premium conditions type

* Update generated types

* Make parallel requests to check multiple nft collection ownership concurrently

* Fix lint

* Fix track schema json

* Fix bug and temporarily punt on some lint issues (sorry)

* Rename endpoint and extract abis into json files

* Use one thread pool executor

* Update query params format

* Update generated types

* Update track schema json to properly allow null

* Update track schema json again

Co-authored-by: Saliou Diallo <saliou@audius.co>
  • Loading branch information
sddioulde and Saliou Diallo committed Nov 4, 2022
1 parent a752d1d commit 70f0f7a
Show file tree
Hide file tree
Showing 15 changed files with 1,276 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,25 @@ def test_access(app):
"track_id": 2,
"owner_id": 3,
"is_premium": True,
"premium_conditions": {"nft_collection": "some-nft-collection"},
"premium_conditions": {
"nft_collection": {
"chain": "eth",
"standard": "ERC721",
"address": "some-nft-collection",
}
},
}
premium_track_entity_2 = {
"track_id": 3,
"owner_id": 2,
"is_premium": True,
"premium_conditions": {"nft_collection": "some-nft-collection"},
"premium_conditions": {
"nft_collection": {
"chain": "eth",
"standard": "ERC721",
"address": "some-nft-collection",
}
},
}
track_entities = [
non_premium_track_entity,
Expand Down Expand Up @@ -98,13 +110,25 @@ def test_batch_access(app):
premium_track_entity_1 = {
"track_id": 3,
"is_premium": True,
"premium_conditions": {"nft_collection": "some-nft-collection"},
"premium_conditions": {
"nft_collection": {
"chain": "eth",
"standard": "ERC721",
"address": "some-nft-collection",
}
},
}
premium_track_entity_2 = {
"track_id": 4,
"owner_id": user_entity_3["user_id"],
"is_premium": True,
"premium_conditions": {"nft_collection": "some-nft-collection"},
"premium_conditions": {
"nft_collection": {
"chain": "eth",
"standard": "ERC721",
"address": "some-nft-collection",
}
},
}
track_entities = [
non_premium_track_entity,
Expand Down
314 changes: 314 additions & 0 deletions discovery-provider/src/abis/ERC1155.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,314 @@
[
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "account",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "operator",
"type": "address"
},
{
"indexed": false,
"internalType": "bool",
"name": "approved",
"type": "bool"
}
],
"name": "ApprovalForAll",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "operator",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "to",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256[]",
"name": "ids",
"type": "uint256[]"
},
{
"indexed": false,
"internalType": "uint256[]",
"name": "values",
"type": "uint256[]"
}
],
"name": "TransferBatch",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "operator",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "to",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "id",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "TransferSingle",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "string",
"name": "value",
"type": "string"
},
{
"indexed": true,
"internalType": "uint256",
"name": "id",
"type": "uint256"
}
],
"name": "URI",
"type": "event"
},
{
"inputs": [
{
"internalType": "address",
"name": "account",
"type": "address"
},
{
"internalType": "uint256",
"name": "id",
"type": "uint256"
}
],
"name": "balanceOf",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address[]",
"name": "accounts",
"type": "address[]"
},
{
"internalType": "uint256[]",
"name": "ids",
"type": "uint256[]"
}
],
"name": "balanceOfBatch",
"outputs": [
{
"internalType": "uint256[]",
"name": "",
"type": "uint256[]"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "account",
"type": "address"
},
{
"internalType": "address",
"name": "operator",
"type": "address"
}
],
"name": "isApprovedForAll",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "from",
"type": "address"
},
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256[]",
"name": "ids",
"type": "uint256[]"
},
{
"internalType": "uint256[]",
"name": "amounts",
"type": "uint256[]"
},
{
"internalType": "bytes",
"name": "data",
"type": "bytes"
}
],
"name": "safeBatchTransferFrom",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "from",
"type": "address"
},
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "id",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "data",
"type": "bytes"
}
],
"name": "safeTransferFrom",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "operator",
"type": "address"
},
{
"internalType": "bool",
"name": "approved",
"type": "bool"
}
],
"name": "setApprovalForAll",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes4",
"name": "interfaceId",
"type": "bytes4"
}
],
"name": "supportsInterface",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "id",
"type": "uint256"
}
],
"name": "uri",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "view",
"type": "function"
}
]

0 comments on commit 70f0f7a

Please sign in to comment.