* refactor contracts usage

* add docker support for barge

* add tests
This commit is contained in:
Alex Coseru 2022-02-14 10:35:55 +02:00 committed by GitHub
parent 01e2a33021
commit f04fe156ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
36 changed files with 7918 additions and 46501 deletions

7
.dockerignore Normal file
View File

@ -0,0 +1,7 @@
node_modules
contracts
.env.local
.env
build
coverage
__mocks__

View File

@ -15,47 +15,56 @@ jobs:
max-parallel: 1
steps:
- uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v2
- uses: actions/setup-node@v2
with:
node-version: '16'
- name: Cache node modules
- name: Cache node_modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-lint-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-lint-${{ env.cache-name }}-
key: ${{ runner.os }}-test-integration-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-test-integration-${{ env.cache-name }}-
- uses: actions/checkout@v2
name: Checkout Barge
# Env var expansion workaround
# https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable
- name: Set ADDRESS_FILE
run: echo "ADDRESS_FILE=${HOME}/.ocean/ocean-contracts/artifacts/address.json" >> $GITHUB_ENV
- name: Checkout Barge
uses: actions/checkout@v2
with:
repository: 'oceanprotocol/barge'
path: 'barge'
- run: npm ci
ref: v4
- name: Login to Docker Hub
if: ${{ env.DOCKERHUB_PASSWORD && env.DOCKERHUB_USERNAME }}
run: |
echo "Login to Docker Hub";echo "$DOCKERHUB_PASSWORD" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Run Barge
working-directory: ${{ github.workspace }}/barge
env:
ADDRESS_FILE: ${HOME}/.ocean/ocean-contracts/artifacts/address.json
run: |
bash -x start_ocean.sh --with-thegraph --no-dashboard 2>&1 > start_ocean.log &
for i in $(seq 1 1500); do
sleep 5
bash -x start_ocean.sh --with-thegraph --skip-subgraph-deploy --no-dashboard 2>&1 > start_ocean.log &
- run: npm ci
- name: Wait for contracts deployment
working-directory: ${{ github.workspace }}/barge
run: |
for i in $(seq 1 250); do
sleep 10
[ -f "$HOME/.ocean/ocean-contracts/artifacts/ready" ] && break
done
cat "$HOME/.ocean/ocean-contracts/artifacts/address.json"
- run: npm run bargesetup
env:
ADDRESS_FILE: /home/runner/.ocean/ocean-contracts/artifacts/address.json
- name: create and deploy subgraph
run: |
npm run codegen
npm run build
npm run create:local-barge
npm run deploy:local-barge
npm run quickstart:development
sleep 20
env:
ADDRESS_FILE: /home/runner/.ocean/ocean-contracts/artifacts/address.json

9
Dockerfile Normal file
View File

@ -0,0 +1,9 @@
FROM node:16
COPY package*.json /usr/src/app/
WORKDIR /usr/src/app
RUN npm install
COPY . /usr/src/app
ENV DEPLOY_SUBGRAPH=true
ENTRYPOINT ["/usr/src/app/docker-entrypoint.sh"]

View File

@ -137,27 +137,35 @@ cd ocean-subgraph
npm i
```
3. Let the components know where to pickup the smart contract addresses:
3. If you use barge, then let the components know where to pickup the smart contract addresses. For production networks, skip this step
```
export ADDRESS_FILE="${HOME}/.ocean/ocean-contracts/artifacts/address.json"
```
4. Generate the subgraph
4. Generate the subgraphs
```bash
node ./scripts/generatenetworkssubgraphs.js
npm run codegen
npm run bargesetup
```
5. To deploy a subgraph connected to Barge, use:
To generate subgraph for just one network, add the network name as parameter
```bash
node ./scripts/generatenetworkssubgraphs.js rinkeby
```
5. To deploy a subgraph use:
npm run create:local-[network]
npm run deploy:local-[network]
```bash
npm run create:local-barge
npm run deploy:local-barge
npm run create:local-development
npm run deploy:local-development
```
- Alternatively, if you want to get the sub-graph quickly running on barge, you can run `npm run quickstart:barge` which combines steps 3-5 above.
You now have a local graph-node running on http://localhost:9000
You now have a local graph-node running on http://127.0.0.1:9000/subgraphs/name/oceanprotocol/ocean-subgraph/graphql

File diff suppressed because one or more lines are too long

View File

@ -1,314 +0,0 @@
{
"_format": "hh-sol-artifact-1",
"contractName": "BMath",
"sourceName": "contracts/pools/balancer/BMath.sol",
"abi": [
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint256",
"name": "swapFeeAmount",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "oceanFeeAmount",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "marketFeeAmount",
"type": "uint256"
},
{
"indexed": false,
"internalType": "address",
"name": "tokenFees",
"type": "address"
}
],
"name": "SWAP_FEES",
"type": "event"
},
{
"inputs": [],
"name": "BONE",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "BPOW_PRECISION",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "EXIT_FEE",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "INIT_POOL_SUPPLY",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "MAX_BOUND_TOKENS",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "MAX_BPOW_BASE",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "MAX_FEE",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "MAX_IN_RATIO",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "MAX_OUT_RATIO",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "MAX_TOTAL_WEIGHT",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "MAX_WEIGHT",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "MIN_BALANCE",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "MIN_BOUND_TOKENS",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "MIN_BPOW_BASE",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "MIN_FEE",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "MIN_WEIGHT",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "_swapPublishMarketFee",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"name": "communityFees",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "getOPCFee",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"name": "publishMarketFees",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
}
],
"bytecode": "0x608060405234801561001057600080fd5b50610451806100206000396000f3fe608060405234801561001057600080fd5b506004361061012c5760003560e01c8063992e2a92116100ad578063bc694ea211610071578063bc694ea2146101eb578063c36596a614610153578063c6580d12146101f3578063e4a28a5214610131578063ec093021146101fb57600080fd5b8063992e2a92146101cb578063b0e0d136146101d3578063b7b800a4146101d3578063ba019dab146101db578063bc063e1a146101e357600080fd5b806376c7a3c7116100f457806376c7a3c71461018a5780637a284be4146101925780637c5918b31461019b578063867378c5146101bb5780639381cd2b146101c357600080fd5b806309a3bbe414610131578063189d00ca1461014b578063218b53821461015357806329b88a6a14610162578063300621921461016a575b600080fd5b610139610203565b60405190815260200160405180910390f35b610139610219565b610139670de0b6b3a764000081565b610139610230565b61013961017836600461034c565b60056020526000908152604090205481565b6101396102aa565b61013960005481565b6101396101a936600461034c565b60066020526000908152604090205481565b6101396102bf565b6101396102d6565b6101396102e9565b610139600281565b610139600181565b610139610307565b61013961031a565b610139600081565b610139610339565b610216670de0b6b3a76400006032610392565b81565b6102166402540be400670de0b6b3a76400006103b1565b6002546004805460405163b8421e2b60e01b81526001600160a01b0391821692810192909252600092169063b8421e2b90602401602060405180830381865afa158015610281573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102a591906103d3565b905090565b610216620f4240670de0b6b3a76400006103b1565b61021664e8d4a51000670de0b6b3a76400006103b1565b610216670de0b6b3a76400006064610392565b6102fc6003670de0b6b3a76400006103b1565b6102169060016103ec565b610216600a670de0b6b3a76400006103b1565b600161032f670de0b6b3a76400006002610392565b6102169190610404565b6102166002670de0b6b3a76400006103b1565b60006020828403121561035e57600080fd5b81356001600160a01b038116811461037557600080fd5b9392505050565b634e487b7160e01b600052601160045260246000fd5b60008160001904831182151516156103ac576103ac61037c565b500290565b6000826103ce57634e487b7160e01b600052601260045260246000fd5b500490565b6000602082840312156103e557600080fd5b5051919050565b600082198211156103ff576103ff61037c565b500190565b6000828210156104165761041661037c565b50039056fea2646970667358221220bb7675d200528b1ac138059c595a95fd2adb2b36b61e0bac3f6baeafc4fc887c64736f6c634300080a0033",
"deployedBytecode": "0x608060405234801561001057600080fd5b506004361061012c5760003560e01c8063992e2a92116100ad578063bc694ea211610071578063bc694ea2146101eb578063c36596a614610153578063c6580d12146101f3578063e4a28a5214610131578063ec093021146101fb57600080fd5b8063992e2a92146101cb578063b0e0d136146101d3578063b7b800a4146101d3578063ba019dab146101db578063bc063e1a146101e357600080fd5b806376c7a3c7116100f457806376c7a3c71461018a5780637a284be4146101925780637c5918b31461019b578063867378c5146101bb5780639381cd2b146101c357600080fd5b806309a3bbe414610131578063189d00ca1461014b578063218b53821461015357806329b88a6a14610162578063300621921461016a575b600080fd5b610139610203565b60405190815260200160405180910390f35b610139610219565b610139670de0b6b3a764000081565b610139610230565b61013961017836600461034c565b60056020526000908152604090205481565b6101396102aa565b61013960005481565b6101396101a936600461034c565b60066020526000908152604090205481565b6101396102bf565b6101396102d6565b6101396102e9565b610139600281565b610139600181565b610139610307565b61013961031a565b610139600081565b610139610339565b610216670de0b6b3a76400006032610392565b81565b6102166402540be400670de0b6b3a76400006103b1565b6002546004805460405163b8421e2b60e01b81526001600160a01b0391821692810192909252600092169063b8421e2b90602401602060405180830381865afa158015610281573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102a591906103d3565b905090565b610216620f4240670de0b6b3a76400006103b1565b61021664e8d4a51000670de0b6b3a76400006103b1565b610216670de0b6b3a76400006064610392565b6102fc6003670de0b6b3a76400006103b1565b6102169060016103ec565b610216600a670de0b6b3a76400006103b1565b600161032f670de0b6b3a76400006002610392565b6102169190610404565b6102166002670de0b6b3a76400006103b1565b60006020828403121561035e57600080fd5b81356001600160a01b038116811461037557600080fd5b9392505050565b634e487b7160e01b600052601160045260246000fd5b60008160001904831182151516156103ac576103ac61037c565b500290565b6000826103ce57634e487b7160e01b600052601260045260246000fd5b500490565b6000602082840312156103e557600080fd5b5051919050565b600082198211156103ff576103ff61037c565b500190565b6000828210156104165761041661037c565b50039056fea2646970667358221220bb7675d200528b1ac138059c595a95fd2adb2b36b61e0bac3f6baeafc4fc887c64736f6c634300080a0033",
"linkReferences": {},
"deployedLinkReferences": {}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,234 +0,0 @@
{
"_format": "hh-sol-artifact-1",
"contractName": "ERC20Roles",
"sourceName": "contracts/utils/ERC20Roles.sol",
"abi": [
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "user",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "signer",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "timestamp",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "blockNumber",
"type": "uint256"
}
],
"name": "AddedMinter",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "user",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "signer",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "timestamp",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "blockNumber",
"type": "uint256"
}
],
"name": "AddedPaymentManager",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "signer",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "timestamp",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "blockNumber",
"type": "uint256"
}
],
"name": "CleanedPermissions",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "user",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "signer",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "timestamp",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "blockNumber",
"type": "uint256"
}
],
"name": "RemovedMinter",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "user",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "signer",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "timestamp",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "blockNumber",
"type": "uint256"
}
],
"name": "RemovedPaymentManager",
"type": "event"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"name": "authERC20",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "user",
"type": "address"
}
],
"name": "getPermissions",
"outputs": [
{
"components": [
{
"internalType": "bool",
"name": "minter",
"type": "bool"
},
{
"internalType": "bool",
"name": "paymentManager",
"type": "bool"
}
],
"internalType": "struct ERC20Roles.RolesERC20",
"name": "",
"type": "tuple"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"name": "permissions",
"outputs": [
{
"internalType": "bool",
"name": "minter",
"type": "bool"
},
{
"internalType": "bool",
"name": "paymentManager",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
}
],
"bytecode": "0x608060405234801561001057600080fd5b506101df806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c806301e8820814610046578063160a79251461008e578063ef867ff41461010b575b600080fd5b610072610054366004610160565b60006020819052908152604090205460ff8082169161010090041682565b6040805192151583529015156020830152015b60405180910390f35b6100ec61009c366004610160565b6040805180820190915260008082526020820152506001600160a01b03166000908152602081815260409182902082518084019093525460ff808216151584526101009091041615159082015290565b6040805182511515815260209283015115159281019290925201610085565b61011e610119366004610190565b610136565b6040516001600160a01b039091168152602001610085565b6001818154811061014657600080fd5b6000918252602090912001546001600160a01b0316905081565b60006020828403121561017257600080fd5b81356001600160a01b038116811461018957600080fd5b9392505050565b6000602082840312156101a257600080fd5b503591905056fea2646970667358221220ccf3df6db224ddd4890801a3179ede2341d3b79e67297621cef6008f522b4b9e64736f6c634300080a0033",
"deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c806301e8820814610046578063160a79251461008e578063ef867ff41461010b575b600080fd5b610072610054366004610160565b60006020819052908152604090205460ff8082169161010090041682565b6040805192151583529015156020830152015b60405180910390f35b6100ec61009c366004610160565b6040805180820190915260008082526020820152506001600160a01b03166000908152602081815260409182902082518084019093525460ff808216151584526101009091041615159082015290565b6040805182511515815260209283015115159281019290925201610085565b61011e610119366004610190565b610136565b6040516001600160a01b039091168152602001610085565b6001818154811061014657600080fd5b6000918252602090912001546001600160a01b0316905081565b60006020828403121561017257600080fd5b81356001600160a01b038116811461018957600080fd5b9392505050565b6000602082840312156101a257600080fd5b503591905056fea2646970667358221220ccf3df6db224ddd4890801a3179ede2341d3b79e67297621cef6008f522b4b9e64736f6c634300080a0033",
"linkReferences": {},
"deployedLinkReferences": {}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

17
docker-entrypoint.sh Executable file
View File

@ -0,0 +1,17 @@
#!/bin/bash
# default to true in case it is not set
DEPLOY_SUBGRAPH="${DEPLOY_SUBGRAPH:-true}"
echo "deploy subgraph is ${DEPLOY_SUBGRAPH}"
if [ "${DEPLOY_SUBGRAPH}" = "true" ]
then
echo "Waiting for contracts to be deployed"
while [ ! -f "/ocean-contracts/artifacts/ready" ]; do
sleep 2
done
export ADDRESS_FILE="/ocean-contracts/artifacts/address.json"
/usr/src/app/
npm run quickstart:barge
fi
tail -f /dev/null

39368
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -3,11 +3,12 @@
"version": "1.2.0",
"scripts": {
"start": "",
"quickstart:barge": "export ADDRESS_FILE=\"${HOME}/.ocean/ocean-contracts/artifacts/address.json\" && npm run codegen && npm run bargesetup && npm run create:local-barge && npm run deploy:local-barge",
"bargesetup": "node ./scripts/generatebargesubgraph.js",
"quickstart:development": "node ./scripts/generatenetworkssubgraphs.js development && npm run codegen && npm run create:local-development && npm run deploy:local-development",
"quickstart:barge": "node ./scripts/generatenetworkssubgraphs.js development && npm run codegen && npm run create:local-barge && npm run deploy:local-barge",
"create": "graph create oceanprotocol/ocean-subgraph --node https://api.thegraph.com/deploy/",
"create:local": "graph create oceanprotocol/ocean-subgraph --node http://127.0.0.1:8020",
"create:local-barge": "graph create oceanprotocol/ocean-subgraph --node http://127.0.0.1:9020",
"create:local-development": "graph create oceanprotocol/ocean-subgraph --node http://127.0.0.1:9020",
"create:local-barge": "graph create oceanprotocol/ocean-subgraph --node http://172.15.0.15:8020",
"create:local-rinkeby": "graph create oceanprotocol/ocean-subgraph --node http://127.0.0.1:8020",
"create:local-ropsten": "graph create oceanprotocol/ocean-subgraph --node http://127.0.0.1:8020",
"create:local-polygon": "graph create oceanprotocol/ocean-subgraph --node http://127.0.0.1:8020",
@ -21,32 +22,35 @@
"create:local-moonriver": "graph create oceanprotocol/ocean-subgraph --node http://127.0.0.1:8020",
"codegen": "graph codegen --output-dir src/@types",
"build": "graph build",
"deploy": "graph deploy oceanprotocol/ocean-subgraph --ipfs https://api.thegraph.com/ipfs/ --node https://api.thegraph.com/deploy/",
"deploy:beta": "graph deploy oceanprotocol/ocean-subgraph-beta --ipfs https://api.thegraph.com/ipfs/ --node https://api.thegraph.com/deploy/",
"deploy:local": "graph deploy oceanprotocol/ocean-subgraph subgraph.yaml --debug --ipfs http://127.0.0.1:5001 --node http://127.0.0.1:8020",
"deploy:local-barge": "graph deploy oceanprotocol/ocean-subgraph subgraph.barge.yaml --debug --ipfs http://127.0.0.1:5001 --node http://127.0.0.1:9020",
"deploy:local-rinkeby": "graph deploy oceanprotocol/ocean-subgraph subgraph.rinkeby.yaml --debug --ipfs http://127.0.0.1:5001 --node http://127.0.0.1:8020",
"deploy:local-ropsten": "graph deploy oceanprotocol/ocean-subgraph subgraph.ropsten.yaml --debug --ipfs http://127.0.0.1:5001 --node http://127.0.0.1:8020",
"deploy:local-polygon": "graph deploy oceanprotocol/ocean-subgraph subgraph.polygon.yaml --debug --ipfs http://127.0.0.1:5001 --node http://127.0.0.1:8020",
"deploy:local-moonbeamalpha": "graph deploy oceanprotocol/ocean-subgraph subgraph.moonbeamalpha.yaml --debug --ipfs http://127.0.0.1:5001 --node http://127.0.0.1:8020",
"deploy:local-gaiaxtestnet": "graph deploy oceanprotocol/ocean-subgraph subgraph.gaiaxtestnet.yaml --debug --ipfs http://127.0.0.1:5001 --node http://127.0.0.1:8020",
"deploy:local-catenaxtestnet": "graph deploy oceanprotocol/ocean-subgraph subgraph.catenaxtestnet.yaml --debug --ipfs http://127.0.0.1:5001 --node http://127.0.0.1:8020",
"deploy:local-mumbai": "graph deploy oceanprotocol/ocean-subgraph subgraph.mumbai.yaml --debug --ipfs http://127.0.0.1:5001 --node http://127.0.0.1:8020",
"deploy:local-bsc": "graph deploy oceanprotocol/ocean-subgraph subgraph.bsc.yaml --debug --ipfs http://127.0.0.1:5001 --node http://127.0.0.1:8020",
"deploy:local-celoalfajores": "graph deploy oceanprotocol/ocean-subgraph subgraph.celoalfajores.yaml --debug --ipfs http://127.0.0.1:5001 --node http://127.0.0.1:8020",
"deploy:local-energyweb": "graph deploy oceanprotocol/ocean-subgraph subgraph.energyweb.yaml --debug --ipfs http://127.0.0.1:5001 --node http://127.0.0.1:8020",
"deploy:local-moonriver": "graph deploy oceanprotocol/ocean-subgraph subgraph.moonriver.yaml --debug --ipfs http://127.0.0.1:5001 --node http://127.0.0.1:8020",
"xx": "graph deploy --help",
"deploy": "graph deploy oceanprotocol/ocean-subgraph -l $npm_package_version --ipfs https://api.thegraph.com/ipfs/ --node https://api.thegraph.com/deploy/",
"deploy:beta": "graph deploy oceanprotocol/ocean-subgraph-beta -l $npm_package_version --ipfs https://api.thegraph.com/ipfs/ --node https://api.thegraph.com/deploy/",
"deploy:local": "graph deploy oceanprotocol/ocean-subgraph subgraph.yaml -l $npm_package_version --debug --ipfs http://127.0.0.1:5001 --node http://127.0.0.1:8020",
"deploy:local-development": "graph deploy oceanprotocol/ocean-subgraph subgraph.yaml -l $npm_package_version --debug --ipfs http://127.0.0.1:5001 --node http://127.0.0.1:9020",
"deploy:local-barge": "graph deploy oceanprotocol/ocean-subgraph subgraph.yaml -l $npm_package_version --debug --ipfs http://172.15.0.16:5001 --node http://172.15.0.15:8020",
"deploy:local-rinkeby": "graph deploy oceanprotocol/ocean-subgraph subgraph.rinkeby.yaml -l $npm_package_version --debug --ipfs http://127.0.0.1:5001 --node http://127.0.0.1:8020",
"deploy:local-ropsten": "graph deploy oceanprotocol/ocean-subgraph subgraph.ropsten.yaml -l $npm_package_version --debug --ipfs http://127.0.0.1:5001 --node http://127.0.0.1:8020",
"deploy:local-polygon": "graph deploy oceanprotocol/ocean-subgraph subgraph.polygon.yaml -l $npm_package_version --debug --ipfs http://127.0.0.1:5001 --node http://127.0.0.1:8020",
"deploy:local-moonbeamalpha": "graph deploy oceanprotocol/ocean-subgraph subgraph.moonbeamalpha.yaml -l $npm_package_version --debug --ipfs http://127.0.0.1:5001 --node http://127.0.0.1:8020",
"deploy:local-gaiaxtestnet": "graph deploy oceanprotocol/ocean-subgraph subgraph.gaiaxtestnet.yaml -l $npm_package_version --debug --ipfs http://127.0.0.1:5001 --node http://127.0.0.1:8020",
"deploy:local-catenaxtestnet": "graph deploy oceanprotocol/ocean-subgraph subgraph.catenaxtestnet.yaml -l $npm_package_version --debug --ipfs http://127.0.0.1:5001 --node http://127.0.0.1:8020",
"deploy:local-mumbai": "graph deploy oceanprotocol/ocean-subgraph subgraph.mumbai.yaml -l $npm_package_version --debug --ipfs http://127.0.0.1:5001 --node http://127.0.0.1:8020",
"deploy:local-bsc": "graph deploy oceanprotocol/ocean-subgraph subgraph.bsc.yaml -l $npm_package_version --debug --ipfs http://127.0.0.1:5001 --node http://127.0.0.1:8020",
"deploy:local-celoalfajores": "graph deploy oceanprotocol/ocean-subgraph subgraph.celoalfajores.yaml -l $npm_package_version --debug --ipfs http://127.0.0.1:5001 --node http://127.0.0.1:8020",
"deploy:local-energyweb": "graph deploy oceanprotocol/ocean-subgraph subgraph.energyweb.yaml -l $npm_package_version --debug --ipfs http://127.0.0.1:5001 --node http://127.0.0.1:8020",
"deploy:local-moonriver": "graph deploy oceanprotocol/ocean-subgraph subgraph.moonriver.yaml -l $npm_package_version --debug --ipfs http://127.0.0.1:5001 --node http://127.0.0.1:8020",
"test": "npm run codegen && npm run lint && npm run type-check",
"test-integration": "TS_NODE_PROJECT='test/integration/tsconfig.json' mocha --config=test/integration/.mocharc.json --node-env=test --exit 'test/integration/**/*.test.ts'",
"lint": "eslint --ignore-path .gitignore --ext .js --ext .ts --ext .tsx .",
"lint:fix": "eslint --ignore-path .gitignore --ext .js,.ts,.tsx . --fix",
"format": "prettier --ignore-path .gitignore './**/*.{css,yml,js,ts,tsx,json,yaml}' --write",
"type-check": "tsc --noEmit",
"release": "release-it --non-interactive",
"changelog": "auto-changelog -p"
},
"devDependencies": {
"@graphprotocol/graph-cli": "^0.22.4",
"@graphprotocol/graph-ts": "^0.22.1",
"@graphprotocol/graph-cli": "^0.26.0",
"@graphprotocol/graph-ts": "^0.24.1",
"@types/chai": "^4.2.22",
"@types/chai-spies": "^1.0.3",
"@types/mocha": "^9.0.0",
@ -70,7 +74,7 @@
"typescript": "^4.4.3"
},
"dependencies": {
"@oceanprotocol/lib": "^0.19.2",
"@oceanprotocol/lib": "^1.0.0-next.15",
"cross-fetch": "^3.1.4"
},
"repository": {

View File

@ -1,57 +0,0 @@
/* eslint-disable no-unused-vars */
var fs = require('fs')
async function replaceContractAddresses() {
// load barge addresses first
try {
// const data = JSON.parse(
// fs.readFileSync(
// '/home/mihai/.ocean/ocean-contracts/artifacts/address.json',
// 'utf8'
// )
// )
// const {
// DTFactory,
// // eslint-disable-next-line no-unused-vars
// ERC721Factory
// } = data.development
// let subgraph = fs.readFileSync('subgraph.yaml', 'utf8')
// if (!data) {
// return false
// }
const ERC721Factory = '0x0599a4a2873B38D836E10302De1ca4834F7BDF4E'
const FixedRateExchange = '0x2356DeCd8CFB6c6f2bf46b5ED4531818B4662337'
const Dispenser = '0xb119b8895801111ff323ba63a77D4Fe78ED057a5'
// ERC721Factory
subgraph = subgraph.replace(
/0x0599a4a2873B38D836E10302De1ca4834F7BDF4E/g,
ERC721Factory
)
subgraph = subgraph.replace(
/0x2356DeCd8CFB6c6f2bf46b5ED4531818B4662337/g,
FixedRateExchange
)
subgraph = subgraph.replace(
/0xb119b8895801111ff323ba63a77D4Fe78ED057a5/g,
Dispenser
)
// network
subgraph = subgraph.replace(/network: mainnet/g, 'network: barge')
// startBlocks
subgraph = subgraph.replace(/startBlock:[ 0-9].*/g, 'startBlock: 0')
fs.writeFileSync('subgraph.barge.yaml', subgraph, 'utf8')
} catch (e) {
console.error('Failed to load address.json')
console.error(e)
process.exit(1)
}
}
replaceContractAddresses()

View File

@ -0,0 +1,47 @@
/* eslint-disable no-unused-vars */
var fs = require('fs')
var addresses = require('@oceanprotocol/contracts/addresses/address.json')
async function replaceContractAddresses() {
// load addresses file first
if (process.env.ADDRESS_FILE) {
console.log('Using custom ADDRESS_FILE instead of ocean-contracts npm dep')
addresses = JSON.parse(fs.readFileSync(process.env.ADDRESS_FILE, 'utf8'))
}
console.log(process.argv)
for (const network in addresses) {
if (process.argv[2] && process.argv[2] != network) {
console.log('Skipping ' + network)
continue
}
console.log('Creating subgraph.' + network + '.yaml')
let subgraph = fs.readFileSync('./scripts/subgraph.yaml', 'utf8')
subgraph = subgraph.replace(/__NETWORK__/g, network)
subgraph = subgraph.replace(
/__STARTBLOCK__/g,
addresses[network].startBlock
)
subgraph = subgraph.replace(
/__ERC721FACTORYADDRESS__/g,
"'" + addresses[network].ERC721Factory + "'"
)
subgraph = subgraph.replace(
/__FIXEDRATEEXCHANGEADDRESS__/g,
"'" + addresses[network].FixedPrice + "'"
)
subgraph = subgraph.replace(
/__DISPENSERADDRESS__/g,
"'" + addresses[network].FixedPrice + "'"
)
subgraph = subgraph.replace(
/__FACTORYROUTERADDRESS__/g,
"'" + addresses[network].Router + "'"
)
if (network != 'development')
fs.writeFileSync('subgraph.' + network + '.yaml', subgraph, 'utf8')
else fs.writeFileSync('subgraph.yaml', subgraph, 'utf8')
}
}
replaceContractAddresses()

View File

@ -6,11 +6,11 @@ schema:
dataSources:
- kind: ethereum/contract
name: ERC721Factory
network: rinkeby
network: __NETWORK__
source:
address: '0xD9b5488363463E3689C1430030F5A17b427718E1'
address: __ERC721FACTORYADDRESS__
abi: ERC721Factory
startBlock: 10065057
startBlock: __STARTBLOCK__
mapping:
kind: ethereum/events
apiVersion: 0.0.6
@ -20,7 +20,7 @@ dataSources:
- ERC721Factory
abis:
- name: ERC721Factory
file: ./abis/ERC721Factory.json
file: ./node_modules/@oceanprotocol/contracts/artifacts/contracts/ERC721Factory.sol/ERC721Factory.json
eventHandlers:
- event: NFTCreated(indexed address,indexed address,string,address,string,string)
handler: handleNftCreated
@ -28,11 +28,11 @@ dataSources:
handler: handleNewToken
- kind: ethereum/contract
name: FixedRateExchange
network: rinkeby
network: __NETWORK__
source:
address: '0xdf29DA8FF979170eBfEd7133068dA247dc04CdC9'
address: __FIXEDRATEEXCHANGEADDRESS__
abi: FixedRateExchange
startBlock: 10065057
startBlock: __STARTBLOCK__
mapping:
kind: ethereum/events
apiVersion: 0.0.6
@ -42,7 +42,7 @@ dataSources:
- FixedRateExchange
abis:
- name: FixedRateExchange
file: ./abis/FixedRateExchange.json
file: ./node_modules/@oceanprotocol/contracts/artifacts/contracts/pools/fixedRate/FixedRateExchange.sol/FixedRateExchange.json
- name: ERC20
file: ./abis/ERC20.json
eventHandlers:
@ -62,11 +62,11 @@ dataSources:
handler: handleSwap
- kind: ethereum/contract
name: Dispenser
network: rinkeby
network: __NETWORK__
source:
address: '0x5FfDe8179E095803de22CBe1D405Eeef18406852'
address: __DISPENSERADDRESS__
abi: Dispenser
startBlock: 10065057
startBlock: __STARTBLOCK__
mapping:
kind: ethereum/events
apiVersion: 0.0.6
@ -76,7 +76,7 @@ dataSources:
- Dispenser
abis:
- name: Dispenser
file: ./abis/Dispenser.json
file: ./node_modules/@oceanprotocol/contracts/artifacts/contracts/pools/dispenser/Dispenser.sol/Dispenser.json
eventHandlers:
- event: DispenserCreated(indexed address,indexed address,uint256,uint256,address)
handler: handleNewDispenser
@ -93,11 +93,11 @@ dataSources:
- kind: ethereum/contract
name: FactoryRouter
network: rinkeby
network: __NETWORK__
source:
address: '0x5De02B776106d0dC81d4335f58E29ECaE717e90A'
address: __FACTORYROUTERADDRESS__
abi: FactoryRouter
startBlock: 10065057
startBlock: __STARTBLOCK__
mapping:
kind: ethereum/events
apiVersion: 0.0.6
@ -107,7 +107,7 @@ dataSources:
- FactoryRouter
abis:
- name: FactoryRouter
file: ./abis/FactoryRouter.json
file: ./node_modules/@oceanprotocol/contracts/artifacts/contracts/pools/FactoryRouter.sol/FactoryRouter.json
eventHandlers:
- event: NewPool(indexed address,bool)
handler: handleNewPool
@ -115,7 +115,7 @@ dataSources:
templates:
- name: ERC20Template
kind: ethereum/contract
network: rinkeby
network: __NETWORK__
source:
abi: ERC20Template
mapping:
@ -127,13 +127,13 @@ templates:
- ERC20Template
abis:
- name: ERC20Template
file: ./abis/ERC20Template.json
file: ./node_modules/@oceanprotocol/contracts/artifacts/contracts/templates/ERC20Template.sol/ERC20Template.json
- name: ERC20TemplateEnterprise
file: ./abis/ERC20TemplateEnterprise.json
file: ./node_modules/@oceanprotocol/contracts/artifacts/contracts/templates/ERC20TemplateEnterprise.sol/ERC20TemplateEnterprise.json
- name: ERC20
file: ./abis/ERC20.json
- name: ERC20Roles
file: ./abis/ERC20Roles.json
file: ./node_modules/@oceanprotocol/contracts/artifacts/contracts/utils/ERC20Roles.sol/ERC20Roles.json
eventHandlers:
- event: OrderStarted(indexed address,address,uint256,uint256,uint256,indexed address,uint256)
handler: handleOrderStarted
@ -144,7 +144,7 @@ templates:
- name: BPool
kind: ethereum/contract
network: rinkeby
network: __NETWORK__
source:
abi: BPool
mapping:
@ -156,11 +156,11 @@ templates:
- BPool
abis:
- name: BPool
file: ./abis/BPool.json
file: ./node_modules/@oceanprotocol/contracts/artifacts/contracts/pools/balancer/BPool.sol/BPool.json
- name: BToken
file: ./abis/BToken.json
file: ./node_modules/@oceanprotocol/contracts/artifacts/contracts/pools/balancer/BToken.sol/BToken.json
- name: BMath
file: ./abis/BMath.json
file: ./node_modules/@oceanprotocol/contracts/artifacts/contracts/pools/balancer/BMath.sol/BMath.json
- name: ERC20
file: ./abis/ERC20.json
eventHandlers:
@ -174,9 +174,10 @@ templates:
handler: handleSetup
- event: Transfer(indexed address,indexed address,uint256)
handler: handlerBptTransfer
- name: ERC721Template
kind: ethereum/contract
network: rinkeby
network: __NETWORK__
source:
abi: ERC721Template
mapping:
@ -188,7 +189,9 @@ templates:
- ERC721Template
abis:
- name: ERC721Template
file: ./abis/ERC721Template.json
file: ./node_modules/@oceanprotocol/contracts/artifacts/contracts/templates/ERC721Template.sol/ERC721Template.json
- name: ERC721RolesAddress
file: ./node_modules/@oceanprotocol/contracts/artifacts/contracts/utils/ERC721RolesAddress.sol/ERC721RolesAddress.json
eventHandlers:
- event: MetadataCreated(indexed address,uint8,string,bytes,bytes,bytes32,uint256,uint256)
handler: handleCreated

View File

@ -1,213 +0,0 @@
specVersion: 0.0.2
description: Ocean provides data sharing through IDOs
repository: https://github.com/oceanprotocol/ocean-subgraph
schema:
file: ./schema.graphql
dataSources:
- kind: ethereum/contract
name: Factory
network: bsc
source:
address: '0xc313e19146Fc9a04470689C9d41a4D3054693531'
abi: Factory
startBlock: 8114772
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/factory.ts
entities:
- PoolFactory
abis:
- name: Factory
file: ./abis/BFactory.json
eventHandlers:
- event: BPoolRegistered(address,indexed address)
handler: handleNewPool
- kind: ethereum/contract
name: DTFactory
network: bsc
source:
address: '0xE9397625Df9B63f0C152f975234b7988b54710B8'
abi: DTFactory
startBlock: 8114772
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/dtfactory.ts
entities:
- DatatokenFactory
abis:
- name: DTFactory
file: ./abis/DTFactory.json
eventHandlers:
- event: TokenRegistered(indexed address,string,string,uint256,indexed address,indexed string)
handler: handleNewToken
- kind: ethereum/contract
name: Metadata
network: bsc
source:
address: '0x1d535147a97bd87c8443125376E6671B60556E07'
abi: Metadata
startBlock: 8114772
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/metadata.ts
entities:
- Metadata
abis:
- name: Metadata
file: ./abis/Metadata.json
eventHandlers:
- event: MetadataCreated(indexed address,indexed address,bytes,bytes)
handler: handleMetadataCreated
- event: MetadataUpdated(indexed address,indexed address,bytes,bytes)
handler: handleMetadataUpdated
- kind: ethereum/contract
name: FixedRateExchange
network: bsc
source:
address: '0x98679D582AB3398C03D3308dEB9c7AeC50B52ded'
abi: FixedRateExchange
startBlock: 8114772
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/fixedrateexchange.ts
entities:
- FixedRateExchange
abis:
- name: FixedRateExchange
file: ./abis/FixedRateExchange.json
- name: ERC20
file: ./abis/ERC20.json
- name: ERC20SymbolBytes
file: ./abis/ERC20SymbolBytes.json
- name: ERC20NameBytes
file: ./abis/ERC20NameBytes.json
eventHandlers:
- event: ExchangeCreated(indexed bytes32,indexed address,indexed address,address,uint256)
handler: handleExchangeCreated
- event: ExchangeActivated(indexed bytes32,indexed address)
handler: handleExchangeActivated
- event: ExchangeDeactivated(indexed bytes32,indexed address)
handler: handleExchangeDeactivated
- event: ExchangeRateChanged(indexed bytes32,indexed address,uint256)
handler: handleExchangeRateChanged
- event: Swapped(indexed bytes32,indexed address,uint256,uint256)
handler: handleSwapped
- kind: ethereum/contract
name: Dispenser
network: bsc
source:
address: '0xFe7967A5176fDAFa8DE109b3507016B885a82D6e'
abi: Dispenser
startBlock: 8114772
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/dispenser.ts
entities:
- Dispenser
abis:
- name: Dispenser
file: ./abis/Dispenser.json
eventHandlers:
- event: Activated(indexed address)
handler: handleDispenserActivated
- event: Deactivated(indexed address)
handler: handleDispenserDeactivated
- event: AcceptedMinter(indexed address)
handler: handleDispenserAcceptedMinter
- event: RemovedMinter(indexed address)
handler: handleDispenserRemovedMinter
- event: TokensDispensed(indexed address,indexed address,uint256)
handler: handleDispenserTokensDispensed
- event: OwnerWithdrawed(indexed address,indexed address,uint256)
handler: handleDispenserOwnerWithdrawed
templates:
- kind: ethereum/contract
name: Pool
network: bsc
source:
abi: Pool
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/pool.ts
entities:
- Pool
- PoolFactory
- Swap
abis:
- name: Pool
file: ./abis/BPool.json
- name: BToken
file: ./abis/BToken.json
- name: ERC20
file: ./abis/ERC20.json
- name: ERC20SymbolBytes
file: ./abis/ERC20SymbolBytes.json
- name: ERC20NameBytes
file: ./abis/ERC20NameBytes.json
eventHandlers:
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0x34e1990700000000000000000000000000000000000000000000000000000000'
handler: handleSetSwapFee
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0x92eefe9b00000000000000000000000000000000000000000000000000000000'
handler: handleSetController
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0x49b5955200000000000000000000000000000000000000000000000000000000'
handler: handleSetPublicSwap
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0x4bb278f300000000000000000000000000000000000000000000000000000000'
handler: handleFinalize
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0xd1d7bc9100000000000000000000000000000000000000000000000000000000'
handler: handleSetup
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0x3fdddaa200000000000000000000000000000000000000000000000000000000'
handler: handleRebind
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0xe4e1e53800000000000000000000000000000000000000000000000000000000'
handler: handleRebind
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0x8c28cbe800000000000000000000000000000000000000000000000000000000'
handler: handleGulp
- event: LOG_JOIN(indexed address,indexed address,uint256)
handler: handleJoinPool
- event: LOG_EXIT(indexed address,indexed address,uint256)
handler: handleExitPool
- event: LOG_SWAP(indexed address,indexed address,indexed address,uint256,uint256)
handler: handleSwap
- event: Transfer(indexed address,indexed address,uint256)
handler: handleTransfer
- kind: ethereum/contract
name: DataToken
network: bsc
source:
abi: DataToken
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/datatoken.ts
entities:
- DataToken
- DatatokenFactory
abis:
- name: DataToken
file: ./abis/DataTokenTemplate.json
eventHandlers:
- event: Transfer(indexed address,indexed address,uint256)
handler: handleTransfer
- event: OrderStarted(indexed address,indexed address,uint256,uint256,uint256,indexed address,uint256)
handler: handleOrderStarted

View File

@ -1,213 +0,0 @@
specVersion: 0.0.2
description: Ocean provides data sharing through IDOs
repository: https://github.com/oceanprotocol/ocean-subgraph
schema:
file: ./schema.graphql
dataSources:
- kind: ethereum/contract
name: Factory
network: catenaxtestnet
source:
address: '0x3C5605202eD47C162450AE975415473e73F93072'
abi: Factory
startBlock: 9223
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/factory.ts
entities:
- PoolFactory
abis:
- name: Factory
file: ./abis/BFactory.json
eventHandlers:
- event: BPoolRegistered(address,indexed address)
handler: handleNewPool
- kind: ethereum/contract
name: DTFactory
network: catenaxtestnet
source:
address: '0x2112Eb973af1DBf83a4f11eda82f7a7527D7Fde5'
abi: DTFactory
startBlock: 9221
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/dtfactory.ts
entities:
- DatatokenFactory
abis:
- name: DTFactory
file: ./abis/DTFactory.json
eventHandlers:
- event: TokenRegistered(indexed address,string,string,uint256,indexed address,indexed string)
handler: handleNewToken
- kind: ethereum/contract
name: Metadata
network: catenaxtestnet
source:
address: '0xDEfD0018969cd2d4E648209F876ADe184815f038'
abi: Metadata
startBlock: 9225
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/metadata.ts
entities:
- Metadata
abis:
- name: Metadata
file: ./abis/Metadata.json
eventHandlers:
- event: MetadataCreated(indexed address,indexed address,bytes,bytes)
handler: handleMetadataCreated
- event: MetadataUpdated(indexed address,indexed address,bytes,bytes)
handler: handleMetadataUpdated
- kind: ethereum/contract
name: FixedRateExchange
network: catenaxtestnet
source:
address: '0x30E4CC2C7A9c6aA2b2Ce93586E3Df24a3A00bcDD'
abi: FixedRateExchange
startBlock: 9224
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/fixedrateexchange.ts
entities:
- FixedRateExchange
abis:
- name: FixedRateExchange
file: ./abis/FixedRateExchange.json
- name: ERC20
file: ./abis/ERC20.json
- name: ERC20SymbolBytes
file: ./abis/ERC20SymbolBytes.json
- name: ERC20NameBytes
file: ./abis/ERC20NameBytes.json
eventHandlers:
- event: ExchangeCreated(indexed bytes32,indexed address,indexed address,address,uint256)
handler: handleExchangeCreated
- event: ExchangeActivated(indexed bytes32,indexed address)
handler: handleExchangeActivated
- event: ExchangeDeactivated(indexed bytes32,indexed address)
handler: handleExchangeDeactivated
- event: ExchangeRateChanged(indexed bytes32,indexed address,uint256)
handler: handleExchangeRateChanged
- event: Swapped(indexed bytes32,indexed address,uint256,uint256)
handler: handleSwapped
- kind: ethereum/contract
name: Dispenser
network: catenaxtestnet
source:
address: '0x9C9eE07b8Ce907D2f9244F8317C1Ed29A3193bAe'
abi: Dispenser
startBlock: 9226
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/dispenser.ts
entities:
- Dispenser
abis:
- name: Dispenser
file: ./abis/Dispenser.json
eventHandlers:
- event: Activated(indexed address)
handler: handleDispenserActivated
- event: Deactivated(indexed address)
handler: handleDispenserDeactivated
- event: AcceptedMinter(indexed address)
handler: handleDispenserAcceptedMinter
- event: RemovedMinter(indexed address)
handler: handleDispenserRemovedMinter
- event: TokensDispensed(indexed address,indexed address,uint256)
handler: handleDispenserTokensDispensed
- event: OwnerWithdrawed(indexed address,indexed address,uint256)
handler: handleDispenserOwnerWithdrawed
templates:
- kind: ethereum/contract
name: Pool
network: catenaxtestnet
source:
abi: Pool
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/pool.ts
entities:
- Pool
- PoolFactory
- Swap
abis:
- name: Pool
file: ./abis/BPool.json
- name: BToken
file: ./abis/BToken.json
- name: ERC20
file: ./abis/ERC20.json
- name: ERC20SymbolBytes
file: ./abis/ERC20SymbolBytes.json
- name: ERC20NameBytes
file: ./abis/ERC20NameBytes.json
eventHandlers:
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0x34e1990700000000000000000000000000000000000000000000000000000000'
handler: handleSetSwapFee
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0x92eefe9b00000000000000000000000000000000000000000000000000000000'
handler: handleSetController
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0x49b5955200000000000000000000000000000000000000000000000000000000'
handler: handleSetPublicSwap
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0x4bb278f300000000000000000000000000000000000000000000000000000000'
handler: handleFinalize
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0xd1d7bc9100000000000000000000000000000000000000000000000000000000'
handler: handleSetup
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0x3fdddaa200000000000000000000000000000000000000000000000000000000'
handler: handleRebind
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0xe4e1e53800000000000000000000000000000000000000000000000000000000'
handler: handleRebind
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0x8c28cbe800000000000000000000000000000000000000000000000000000000'
handler: handleGulp
- event: LOG_JOIN(indexed address,indexed address,uint256)
handler: handleJoinPool
- event: LOG_EXIT(indexed address,indexed address,uint256)
handler: handleExitPool
- event: LOG_SWAP(indexed address,indexed address,indexed address,uint256,uint256)
handler: handleSwap
- event: Transfer(indexed address,indexed address,uint256)
handler: handleTransfer
- kind: ethereum/contract
name: DataToken
network: catenaxtestnet
source:
abi: DataToken
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/datatoken.ts
entities:
- DataToken
- DatatokenFactory
abis:
- name: DataToken
file: ./abis/DataTokenTemplate.json
eventHandlers:
- event: Transfer(indexed address,indexed address,uint256)
handler: handleTransfer
- event: OrderStarted(indexed address,indexed address,uint256,uint256,uint256,indexed address,uint256)
handler: handleOrderStarted

View File

@ -1,213 +0,0 @@
specVersion: 0.0.2
description: Ocean provides data sharing through IDOs
repository: https://github.com/oceanprotocol/ocean-subgraph
schema:
file: ./schema.graphql
dataSources:
- kind: ethereum/contract
name: Factory
network: celoalfajores
source:
address: '0x80E63f73cAc60c1662f27D2DFd2EA834acddBaa8'
abi: Factory
startBlock: 7542884
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/factory.ts
entities:
- PoolFactory
abis:
- name: Factory
file: ./abis/BFactory.json
eventHandlers:
- event: BPoolRegistered(address,indexed address)
handler: handleNewPool
- kind: ethereum/contract
name: DTFactory
network: celoalfajores
source:
address: '0x69B6E54Ad2b3c2801d11d8Ad56ea1d892555b776'
abi: DTFactory
startBlock: 7542879
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/dtfactory.ts
entities:
- DatatokenFactory
abis:
- name: DTFactory
file: ./abis/DTFactory.json
eventHandlers:
- event: TokenRegistered(indexed address,string,string,uint256,indexed address,indexed string)
handler: handleNewToken
- kind: ethereum/contract
name: Metadata
network: celoalfajores
source:
address: '0x30E4CC2C7A9c6aA2b2Ce93586E3Df24a3A00bcDD'
abi: Metadata
startBlock: 7542888
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/metadata.ts
entities:
- Metadata
abis:
- name: Metadata
file: ./abis/Metadata.json
eventHandlers:
- event: MetadataCreated(indexed address,indexed address,bytes,bytes)
handler: handleMetadataCreated
- event: MetadataUpdated(indexed address,indexed address,bytes,bytes)
handler: handleMetadataUpdated
- kind: ethereum/contract
name: FixedRateExchange
network: celoalfajores
source:
address: '0x3C5605202eD47C162450AE975415473e73F93072'
abi: FixedRateExchange
startBlock: 7542886
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/fixedrateexchange.ts
entities:
- FixedRateExchange
abis:
- name: FixedRateExchange
file: ./abis/FixedRateExchange.json
- name: ERC20
file: ./abis/ERC20.json
- name: ERC20SymbolBytes
file: ./abis/ERC20SymbolBytes.json
- name: ERC20NameBytes
file: ./abis/ERC20NameBytes.json
eventHandlers:
- event: ExchangeCreated(indexed bytes32,indexed address,indexed address,address,uint256)
handler: handleExchangeCreated
- event: ExchangeActivated(indexed bytes32,indexed address)
handler: handleExchangeActivated
- event: ExchangeDeactivated(indexed bytes32,indexed address)
handler: handleExchangeDeactivated
- event: ExchangeRateChanged(indexed bytes32,indexed address,uint256)
handler: handleExchangeRateChanged
- event: Swapped(indexed bytes32,indexed address,uint256,uint256)
handler: handleSwapped
- kind: ethereum/contract
name: Dispenser
network: celoalfajores
source:
address: '0xDEfD0018969cd2d4E648209F876ADe184815f038'
abi: Dispenser
startBlock: 7542890
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/dispenser.ts
entities:
- Dispenser
abis:
- name: Dispenser
file: ./abis/Dispenser.json
eventHandlers:
- event: Activated(indexed address)
handler: handleDispenserActivated
- event: Deactivated(indexed address)
handler: handleDispenserDeactivated
- event: AcceptedMinter(indexed address)
handler: handleDispenserAcceptedMinter
- event: RemovedMinter(indexed address)
handler: handleDispenserRemovedMinter
- event: TokensDispensed(indexed address,indexed address,uint256)
handler: handleDispenserTokensDispensed
- event: OwnerWithdrawed(indexed address,indexed address,uint256)
handler: handleDispenserOwnerWithdrawed
templates:
- kind: ethereum/contract
name: Pool
network: celoalfajores
source:
abi: Pool
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/pool.ts
entities:
- Pool
- PoolFactory
- Swap
abis:
- name: Pool
file: ./abis/BPool.json
- name: BToken
file: ./abis/BToken.json
- name: ERC20
file: ./abis/ERC20.json
- name: ERC20SymbolBytes
file: ./abis/ERC20SymbolBytes.json
- name: ERC20NameBytes
file: ./abis/ERC20NameBytes.json
eventHandlers:
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0x34e1990700000000000000000000000000000000000000000000000000000000'
handler: handleSetSwapFee
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0x92eefe9b00000000000000000000000000000000000000000000000000000000'
handler: handleSetController
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0x49b5955200000000000000000000000000000000000000000000000000000000'
handler: handleSetPublicSwap
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0x4bb278f300000000000000000000000000000000000000000000000000000000'
handler: handleFinalize
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0xd1d7bc9100000000000000000000000000000000000000000000000000000000'
handler: handleSetup
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0x3fdddaa200000000000000000000000000000000000000000000000000000000'
handler: handleRebind
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0xe4e1e53800000000000000000000000000000000000000000000000000000000'
handler: handleRebind
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0x8c28cbe800000000000000000000000000000000000000000000000000000000'
handler: handleGulp
- event: LOG_JOIN(indexed address,indexed address,uint256)
handler: handleJoinPool
- event: LOG_EXIT(indexed address,indexed address,uint256)
handler: handleExitPool
- event: LOG_SWAP(indexed address,indexed address,indexed address,uint256,uint256)
handler: handleSwap
- event: Transfer(indexed address,indexed address,uint256)
handler: handleTransfer
- kind: ethereum/contract
name: DataToken
network: celoalfajores
source:
abi: DataToken
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/datatoken.ts
entities:
- DataToken
- DatatokenFactory
abis:
- name: DataToken
file: ./abis/DataTokenTemplate.json
eventHandlers:
- event: Transfer(indexed address,indexed address,uint256)
handler: handleTransfer
- event: OrderStarted(indexed address,indexed address,uint256,uint256,uint256,indexed address,uint256)
handler: handleOrderStarted

View File

@ -1,213 +0,0 @@
specVersion: 0.0.2
description: Ocean provides data sharing through IDOs
repository: https://github.com/oceanprotocol/ocean-subgraph
schema:
file: ./schema.graphql
dataSources:
- kind: ethereum/contract
name: Factory
network: energyweb
source:
address: '0x2112Eb973af1DBf83a4f11eda82f7a7527D7Fde5'
abi: Factory
startBlock: 14101890
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/factory.ts
entities:
- PoolFactory
abis:
- name: Factory
file: ./abis/BFactory.json
eventHandlers:
- event: BPoolRegistered(address,indexed address)
handler: handleNewPool
- kind: ethereum/contract
name: DTFactory
network: energyweb
source:
address: '0x1B083D8584dd3e6Ff37d04a6e7e82b5F622f3985'
abi: DTFactory
startBlock: 14101885
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/dtfactory.ts
entities:
- DatatokenFactory
abis:
- name: DTFactory
file: ./abis/DTFactory.json
eventHandlers:
- event: TokenRegistered(indexed address,string,string,uint256,indexed address,indexed string)
handler: handleNewToken
- kind: ethereum/contract
name: Metadata
network: energyweb
source:
address: '0x3C5605202eD47C162450AE975415473e73F93072'
abi: Metadata
startBlock: 14101894
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/metadata.ts
entities:
- Metadata
abis:
- name: Metadata
file: ./abis/Metadata.json
eventHandlers:
- event: MetadataCreated(indexed address,indexed address,bytes,bytes)
handler: handleMetadataCreated
- event: MetadataUpdated(indexed address,indexed address,bytes,bytes)
handler: handleMetadataUpdated
- kind: ethereum/contract
name: FixedRateExchange
network: energyweb
source:
address: '0x80E63f73cAc60c1662f27D2DFd2EA834acddBaa8'
abi: FixedRateExchange
startBlock: 14101892
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/fixedrateexchange.ts
entities:
- FixedRateExchange
abis:
- name: FixedRateExchange
file: ./abis/FixedRateExchange.json
- name: ERC20
file: ./abis/ERC20.json
- name: ERC20SymbolBytes
file: ./abis/ERC20SymbolBytes.json
- name: ERC20NameBytes
file: ./abis/ERC20NameBytes.json
eventHandlers:
- event: ExchangeCreated(indexed bytes32,indexed address,indexed address,address,uint256)
handler: handleExchangeCreated
- event: ExchangeActivated(indexed bytes32,indexed address)
handler: handleExchangeActivated
- event: ExchangeDeactivated(indexed bytes32,indexed address)
handler: handleExchangeDeactivated
- event: ExchangeRateChanged(indexed bytes32,indexed address,uint256)
handler: handleExchangeRateChanged
- event: Swapped(indexed bytes32,indexed address,uint256,uint256)
handler: handleSwapped
- kind: ethereum/contract
name: Dispenser
network: energyweb
source:
address: '0x30E4CC2C7A9c6aA2b2Ce93586E3Df24a3A00bcDD'
abi: Dispenser
startBlock: 14101896
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/dispenser.ts
entities:
- Dispenser
abis:
- name: Dispenser
file: ./abis/Dispenser.json
eventHandlers:
- event: Activated(indexed address)
handler: handleDispenserActivated
- event: Deactivated(indexed address)
handler: handleDispenserDeactivated
- event: AcceptedMinter(indexed address)
handler: handleDispenserAcceptedMinter
- event: RemovedMinter(indexed address)
handler: handleDispenserRemovedMinter
- event: TokensDispensed(indexed address,indexed address,uint256)
handler: handleDispenserTokensDispensed
- event: OwnerWithdrawed(indexed address,indexed address,uint256)
handler: handleDispenserOwnerWithdrawed
templates:
- kind: ethereum/contract
name: Pool
network: energyweb
source:
abi: Pool
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/pool.ts
entities:
- Pool
- PoolFactory
- Swap
abis:
- name: Pool
file: ./abis/BPool.json
- name: BToken
file: ./abis/BToken.json
- name: ERC20
file: ./abis/ERC20.json
- name: ERC20SymbolBytes
file: ./abis/ERC20SymbolBytes.json
- name: ERC20NameBytes
file: ./abis/ERC20NameBytes.json
eventHandlers:
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0x34e1990700000000000000000000000000000000000000000000000000000000'
handler: handleSetSwapFee
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0x92eefe9b00000000000000000000000000000000000000000000000000000000'
handler: handleSetController
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0x49b5955200000000000000000000000000000000000000000000000000000000'
handler: handleSetPublicSwap
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0x4bb278f300000000000000000000000000000000000000000000000000000000'
handler: handleFinalize
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0xd1d7bc9100000000000000000000000000000000000000000000000000000000'
handler: handleSetup
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0x3fdddaa200000000000000000000000000000000000000000000000000000000'
handler: handleRebind
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0xe4e1e53800000000000000000000000000000000000000000000000000000000'
handler: handleRebind
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0x8c28cbe800000000000000000000000000000000000000000000000000000000'
handler: handleGulp
- event: LOG_JOIN(indexed address,indexed address,uint256)
handler: handleJoinPool
- event: LOG_EXIT(indexed address,indexed address,uint256)
handler: handleExitPool
- event: LOG_SWAP(indexed address,indexed address,indexed address,uint256,uint256)
handler: handleSwap
- event: Transfer(indexed address,indexed address,uint256)
handler: handleTransfer
- kind: ethereum/contract
name: DataToken
network: energyweb
source:
abi: DataToken
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/datatoken.ts
entities:
- DataToken
- DatatokenFactory
abis:
- name: DataToken
file: ./abis/DataTokenTemplate.json
eventHandlers:
- event: Transfer(indexed address,indexed address,uint256)
handler: handleTransfer
- event: OrderStarted(indexed address,indexed address,uint256,uint256,uint256,indexed address,uint256)
handler: handleOrderStarted

View File

@ -1,213 +0,0 @@
specVersion: 0.0.2
description: Ocean provides data sharing through IDOs
repository: https://github.com/oceanprotocol/ocean-subgraph
schema:
file: ./schema.graphql
dataSources:
- kind: ethereum/contract
name: Factory
network: gaiaxtestnet
source:
address: '0xc37F8341Ac6e4a94538302bCd4d49Cf0852D30C0'
abi: Factory
startBlock: 177644
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/factory.ts
entities:
- PoolFactory
abis:
- name: Factory
file: ./abis/BFactory.json
eventHandlers:
- event: BPoolRegistered(address,indexed address)
handler: handleNewPool
- kind: ethereum/contract
name: DTFactory
network: gaiaxtestnet
source:
address: '0x2720d405ef7cDC8a2E2e5AeBC8883C99611d893C'
abi: DTFactory
startBlock: 177644
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/dtfactory.ts
entities:
- DatatokenFactory
abis:
- name: DTFactory
file: ./abis/DTFactory.json
eventHandlers:
- event: TokenRegistered(indexed address,string,string,uint256,indexed address,indexed string)
handler: handleNewToken
- kind: ethereum/contract
name: Metadata
network: gaiaxtestnet
source:
address: '0xCfDdA22C9837aE76E0faA845354f33C62E03653a'
abi: Metadata
startBlock: 177644
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/metadata.ts
entities:
- Metadata
abis:
- name: Metadata
file: ./abis/Metadata.json
eventHandlers:
- event: MetadataCreated(indexed address,indexed address,bytes,bytes)
handler: handleMetadataCreated
- event: MetadataUpdated(indexed address,indexed address,bytes,bytes)
handler: handleMetadataUpdated
- kind: ethereum/contract
name: FixedRateExchange
network: gaiaxtestnet
source:
address: '0x3c21a90599b5B7f37014cA5Bf30d3f1b73d7e391'
abi: FixedRateExchange
startBlock: 177644
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/fixedrateexchange.ts
entities:
- FixedRateExchange
abis:
- name: FixedRateExchange
file: ./abis/FixedRateExchange.json
- name: ERC20
file: ./abis/ERC20.json
- name: ERC20SymbolBytes
file: ./abis/ERC20SymbolBytes.json
- name: ERC20NameBytes
file: ./abis/ERC20NameBytes.json
eventHandlers:
- event: ExchangeCreated(indexed bytes32,indexed address,indexed address,address,uint256)
handler: handleExchangeCreated
- event: ExchangeActivated(indexed bytes32,indexed address)
handler: handleExchangeActivated
- event: ExchangeDeactivated(indexed bytes32,indexed address)
handler: handleExchangeDeactivated
- event: ExchangeRateChanged(indexed bytes32,indexed address,uint256)
handler: handleExchangeRateChanged
- event: Swapped(indexed bytes32,indexed address,uint256,uint256)
handler: handleSwapped
- kind: ethereum/contract
name: Dispenser
network: gaiaxtestnet
source:
address: '0x4E6058dC00e90C0DCA47A5d0D3346F409939A5ab'
abi: Dispenser
startBlock: 177644
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/dispenser.ts
entities:
- Dispenser
abis:
- name: Dispenser
file: ./abis/Dispenser.json
eventHandlers:
- event: Activated(indexed address)
handler: handleDispenserActivated
- event: Deactivated(indexed address)
handler: handleDispenserDeactivated
- event: AcceptedMinter(indexed address)
handler: handleDispenserAcceptedMinter
- event: RemovedMinter(indexed address)
handler: handleDispenserRemovedMinter
- event: TokensDispensed(indexed address,indexed address,uint256)
handler: handleDispenserTokensDispensed
- event: OwnerWithdrawed(indexed address,indexed address,uint256)
handler: handleDispenserOwnerWithdrawed
templates:
- kind: ethereum/contract
name: Pool
network: gaiaxtestnet
source:
abi: Pool
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/pool.ts
entities:
- Pool
- PoolFactory
- Swap
abis:
- name: Pool
file: ./abis/BPool.json
- name: BToken
file: ./abis/BToken.json
- name: ERC20
file: ./abis/ERC20.json
- name: ERC20SymbolBytes
file: ./abis/ERC20SymbolBytes.json
- name: ERC20NameBytes
file: ./abis/ERC20NameBytes.json
eventHandlers:
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0x34e1990700000000000000000000000000000000000000000000000000000000'
handler: handleSetSwapFee
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0x92eefe9b00000000000000000000000000000000000000000000000000000000'
handler: handleSetController
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0x49b5955200000000000000000000000000000000000000000000000000000000'
handler: handleSetPublicSwap
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0x4bb278f300000000000000000000000000000000000000000000000000000000'
handler: handleFinalize
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0xd1d7bc9100000000000000000000000000000000000000000000000000000000'
handler: handleSetup
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0x3fdddaa200000000000000000000000000000000000000000000000000000000'
handler: handleRebind
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0xe4e1e53800000000000000000000000000000000000000000000000000000000'
handler: handleRebind
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0x8c28cbe800000000000000000000000000000000000000000000000000000000'
handler: handleGulp
- event: LOG_JOIN(indexed address,indexed address,uint256)
handler: handleJoinPool
- event: LOG_EXIT(indexed address,indexed address,uint256)
handler: handleExitPool
- event: LOG_SWAP(indexed address,indexed address,indexed address,uint256,uint256)
handler: handleSwap
- event: Transfer(indexed address,indexed address,uint256)
handler: handleTransfer
- kind: ethereum/contract
name: DataToken
network: gaiaxtestnet
source:
abi: DataToken
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/datatoken.ts
entities:
- DataToken
- DatatokenFactory
abis:
- name: DataToken
file: ./abis/DataTokenTemplate.json
eventHandlers:
- event: Transfer(indexed address,indexed address,uint256)
handler: handleTransfer
- event: OrderStarted(indexed address,indexed address,uint256,uint256,uint256,indexed address,uint256)
handler: handleOrderStarted

View File

@ -1,207 +0,0 @@
specVersion: 0.0.2
description: Ocean provides data sharing through IDOs
repository: https://github.com/oceanprotocol/ocean-subgraph
schema:
file: ./schema.graphql
dataSources:
- kind: ethereum/contract
name: Factory
network: moonbeamalpha
source:
address: '0xEF62FB495266C72a5212A11Dce8baa79Ec0ABeB1'
abi: Factory
startBlock: 281776
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/factory.ts
entities:
- PoolFactory
abis:
- name: Factory
file: ./abis/BFactory.json
eventHandlers:
- event: BPoolRegistered(address,indexed address)
handler: handleNewPool
- kind: ethereum/contract
name: DTFactory
network: moonbeamalpha
source:
address: '0x9C9eE07b8Ce907D2f9244F8317C1Ed29A3193bAe'
abi: DTFactory
startBlock: 281773
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/dtfactory.ts
entities:
- DatatokenFactory
abis:
- name: DTFactory
file: ./abis/DTFactory.json
eventHandlers:
- event: TokenRegistered(indexed address,string,string,uint256,indexed address,indexed string)
handler: handleNewToken
- kind: ethereum/contract
name: Metadata
network: moonbeamalpha
source:
address: '0x3c21a90599b5B7f37014cA5Bf30d3f1b73d7e391'
abi: Metadata
startBlock: 281778
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/metadata.ts
entities:
- Metadata
abis:
- name: Metadata
file: ./abis/Metadata.json
eventHandlers:
- event: MetadataCreated(indexed address,indexed address,bytes,bytes)
handler: handleMetadataCreated
- event: MetadataUpdated(indexed address,indexed address,bytes,bytes)
handler: handleMetadataUpdated
- kind: ethereum/contract
name: FixedRateExchange
network: moonbeamalpha
source:
address: '0xc37F8341Ac6e4a94538302bCd4d49Cf0852D30C0'
abi: FixedRateExchange
startBlock: 281777
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/fixedrateexchange.ts
entities:
- FixedRateExchange
abis:
- name: FixedRateExchange
file: ./abis/FixedRateExchange.json
- name: ERC20
file: ./abis/ERC20.json
- name: ERC20SymbolBytes
file: ./abis/ERC20SymbolBytes.json
- name: ERC20NameBytes
file: ./abis/ERC20NameBytes.json
eventHandlers:
- event: ExchangeCreated(indexed bytes32,indexed address,indexed address,address,uint256)
handler: handleExchangeCreated
- event: ExchangeActivated(indexed bytes32,indexed address)
handler: handleExchangeActivated
- event: ExchangeDeactivated(indexed bytes32,indexed address)
handler: handleExchangeDeactivated
- event: ExchangeRateChanged(indexed bytes32,indexed address,uint256)
handler: handleExchangeRateChanged
- event: Swapped(indexed bytes32,indexed address,uint256,uint256)
handler: handleSwapped
- kind: ethereum/contract
name: Dispenser
network: moonbeamalpha
source:
address: '0xCfDdA22C9837aE76E0faA845354f33C62E03653a'
abi: Dispenser
startBlock: 281779
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/dispenser.ts
entities:
- Dispenser
abis:
- name: Dispenser
file: ./abis/Dispenser.json
eventHandlers:
- event: Activated(indexed address)
handler: handleDispenserActivated
- event: Deactivated(indexed address)
handler: handleDispenserDeactivated
- event: AcceptedMinter(indexed address)
handler: handleDispenserAcceptedMinter
- event: RemovedMinter(indexed address)
handler: handleDispenserRemovedMinter
- event: TokensDispensed(indexed address,indexed address,uint256)
handler: handleDispenserTokensDispensed
- event: OwnerWithdrawed(indexed address,indexed address,uint256)
handler: handleDispenserOwnerWithdrawed
templates:
- kind: ethereum/contract
name: Pool
network: moonbeamalpha
source:
abi: Pool
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/pool.ts
entities:
- Pool
- PoolFactory
- Swap
abis:
- name: Pool
file: ./abis/BPool.json
- name: BToken
file: ./abis/BToken.json
eventHandlers:
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0x34e1990700000000000000000000000000000000000000000000000000000000'
handler: handleSetSwapFee
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0x92eefe9b00000000000000000000000000000000000000000000000000000000'
handler: handleSetController
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0x49b5955200000000000000000000000000000000000000000000000000000000'
handler: handleSetPublicSwap
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0x4bb278f300000000000000000000000000000000000000000000000000000000'
handler: handleFinalize
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0xd1d7bc9100000000000000000000000000000000000000000000000000000000'
handler: handleSetup
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0x3fdddaa200000000000000000000000000000000000000000000000000000000'
handler: handleRebind
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0xe4e1e53800000000000000000000000000000000000000000000000000000000'
handler: handleRebind
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0x8c28cbe800000000000000000000000000000000000000000000000000000000'
handler: handleGulp
- event: LOG_JOIN(indexed address,indexed address,uint256)
handler: handleJoinPool
- event: LOG_EXIT(indexed address,indexed address,uint256)
handler: handleExitPool
- event: LOG_SWAP(indexed address,indexed address,indexed address,uint256,uint256)
handler: handleSwap
- event: Transfer(indexed address,indexed address,uint256)
handler: handleTransfer
- kind: ethereum/contract
name: DataToken
network: moonbeamalpha
source:
abi: DataToken
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/datatoken.ts
entities:
- DataToken
- DatatokenFactory
abis:
- name: DataToken
file: ./abis/DataTokenTemplate.json
eventHandlers:
- event: Transfer(indexed address,indexed address,uint256)
handler: handleTransfer
- event: OrderStarted(indexed address,indexed address,uint256,uint256,uint256,indexed address,uint256)
handler: handleOrderStarted

View File

@ -1,213 +0,0 @@
specVersion: 0.0.2
description: Ocean provides data sharing through IDOs
repository: https://github.com/oceanprotocol/ocean-subgraph
schema:
file: ./schema.graphql
dataSources:
- kind: ethereum/contract
name: Factory
network: moonriver
source:
address: '0x4dD281EB67DED07E76E413Df16176D66ae69e240'
abi: Factory
startBlock: 637156
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/factory.ts
entities:
- PoolFactory
abis:
- name: Factory
file: ./abis/BFactory.json
eventHandlers:
- event: BPoolRegistered(address,indexed address)
handler: handleNewPool
- kind: ethereum/contract
name: DTFactory
network: moonriver
source:
address: '0x1d535147a97bd87c8443125376E6671B60556E07'
abi: DTFactory
startBlock: 637150
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/dtfactory.ts
entities:
- DatatokenFactory
abis:
- name: DTFactory
file: ./abis/DTFactory.json
eventHandlers:
- event: TokenRegistered(indexed address,string,string,uint256,indexed address,indexed string)
handler: handleNewToken
- kind: ethereum/contract
name: Metadata
network: moonriver
source:
address: '0xe8c6Dc39602031A152440311e364818ba25C2Bc1'
abi: Metadata
startBlock: 637161
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/metadata.ts
entities:
- Metadata
abis:
- name: Metadata
file: ./abis/Metadata.json
eventHandlers:
- event: MetadataCreated(indexed address,indexed address,bytes,bytes)
handler: handleMetadataCreated
- event: MetadataUpdated(indexed address,indexed address,bytes,bytes)
handler: handleMetadataUpdated
- kind: ethereum/contract
name: FixedRateExchange
network: moonriver
source:
address: '0xFe7967A5176fDAFa8DE109b3507016B885a82D6e'
abi: FixedRateExchange
startBlock: 637158
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/fixedrateexchange.ts
entities:
- FixedRateExchange
abis:
- name: FixedRateExchange
file: ./abis/FixedRateExchange.json
- name: ERC20
file: ./abis/ERC20.json
- name: ERC20SymbolBytes
file: ./abis/ERC20SymbolBytes.json
- name: ERC20NameBytes
file: ./abis/ERC20NameBytes.json
eventHandlers:
- event: ExchangeCreated(indexed bytes32,indexed address,indexed address,address,uint256)
handler: handleExchangeCreated
- event: ExchangeActivated(indexed bytes32,indexed address)
handler: handleExchangeActivated
- event: ExchangeDeactivated(indexed bytes32,indexed address)
handler: handleExchangeDeactivated
- event: ExchangeRateChanged(indexed bytes32,indexed address,uint256)
handler: handleExchangeRateChanged
- event: Swapped(indexed bytes32,indexed address,uint256,uint256)
handler: handleSwapped
- kind: ethereum/contract
name: Dispenser
network: moonriver
source:
address: '0xA4E108a4fa07C931cFe4bF2c1c6f9C1579d5a819'
abi: Dispenser
startBlock: 637162
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/dispenser.ts
entities:
- Dispenser
abis:
- name: Dispenser
file: ./abis/Dispenser.json
eventHandlers:
- event: Activated(indexed address)
handler: handleDispenserActivated
- event: Deactivated(indexed address)
handler: handleDispenserDeactivated
- event: AcceptedMinter(indexed address)
handler: handleDispenserAcceptedMinter
- event: RemovedMinter(indexed address)
handler: handleDispenserRemovedMinter
- event: TokensDispensed(indexed address,indexed address,uint256)
handler: handleDispenserTokensDispensed
- event: OwnerWithdrawed(indexed address,indexed address,uint256)
handler: handleDispenserOwnerWithdrawed
templates:
- kind: ethereum/contract
name: Pool
network: moonriver
source:
abi: Pool
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/pool.ts
entities:
- Pool
- PoolFactory
- Swap
abis:
- name: Pool
file: ./abis/BPool.json
- name: BToken
file: ./abis/BToken.json
- name: ERC20
file: ./abis/ERC20.json
- name: ERC20SymbolBytes
file: ./abis/ERC20SymbolBytes.json
- name: ERC20NameBytes
file: ./abis/ERC20NameBytes.json
eventHandlers:
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0x34e1990700000000000000000000000000000000000000000000000000000000'
handler: handleSetSwapFee
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0x92eefe9b00000000000000000000000000000000000000000000000000000000'
handler: handleSetController
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0x49b5955200000000000000000000000000000000000000000000000000000000'
handler: handleSetPublicSwap
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0x4bb278f300000000000000000000000000000000000000000000000000000000'
handler: handleFinalize
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0xd1d7bc9100000000000000000000000000000000000000000000000000000000'
handler: handleSetup
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0x3fdddaa200000000000000000000000000000000000000000000000000000000'
handler: handleRebind
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0xe4e1e53800000000000000000000000000000000000000000000000000000000'
handler: handleRebind
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0x8c28cbe800000000000000000000000000000000000000000000000000000000'
handler: handleGulp
- event: LOG_JOIN(indexed address,indexed address,uint256)
handler: handleJoinPool
- event: LOG_EXIT(indexed address,indexed address,uint256)
handler: handleExitPool
- event: LOG_SWAP(indexed address,indexed address,indexed address,uint256,uint256)
handler: handleSwap
- event: Transfer(indexed address,indexed address,uint256)
handler: handleTransfer
- kind: ethereum/contract
name: DataToken
network: moonriver
source:
abi: DataToken
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/datatoken.ts
entities:
- DataToken
- DatatokenFactory
abis:
- name: DataToken
file: ./abis/DataTokenTemplate.json
eventHandlers:
- event: Transfer(indexed address,indexed address,uint256)
handler: handleTransfer
- event: OrderStarted(indexed address,indexed address,uint256,uint256,uint256,indexed address,uint256)
handler: handleOrderStarted

View File

@ -1,207 +0,0 @@
specVersion: 0.0.2
description: Ocean provides data sharing through IDOs
repository: https://github.com/oceanprotocol/ocean-subgraph
schema:
file: ./schema.graphql
dataSources:
- kind: ethereum/contract
name: Factory
network: mumbai
source:
address: '0x159924ca0F47D6F704B97E29099b89e518A17B5E'
abi: Factory
startBlock: 14791845
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/factory.ts
entities:
- PoolFactory
abis:
- name: Factory
file: ./abis/BFactory.json
eventHandlers:
- event: BPoolRegistered(address,indexed address)
handler: handleNewPool
- kind: ethereum/contract
name: DTFactory
network: mumbai
source:
address: '0x4E6058dC00e90C0DCA47A5d0D3346F409939A5ab'
abi: DTFactory
startBlock: 14791845
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/dtfactory.ts
entities:
- DatatokenFactory
abis:
- name: DTFactory
file: ./abis/DTFactory.json
eventHandlers:
- event: TokenRegistered(indexed address,string,string,uint256,indexed address,indexed string)
handler: handleNewToken
- kind: ethereum/contract
name: Metadata
network: mumbai
source:
address: '0x98679D582AB3398C03D3308dEB9c7AeC50B52ded'
abi: Metadata
startBlock: 14791845
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/metadata.ts
entities:
- Metadata
abis:
- name: Metadata
file: ./abis/Metadata.json
eventHandlers:
- event: MetadataCreated(indexed address,indexed address,bytes,bytes)
handler: handleMetadataCreated
- event: MetadataUpdated(indexed address,indexed address,bytes,bytes)
handler: handleMetadataUpdated
- kind: ethereum/contract
name: FixedRateExchange
network: mumbai
source:
address: '0xc313e19146Fc9a04470689C9d41a4D3054693531'
abi: FixedRateExchange
startBlock: 14791845
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/fixedrateexchange.ts
entities:
- FixedRateExchange
abis:
- name: FixedRateExchange
file: ./abis/FixedRateExchange.json
- name: ERC20
file: ./abis/ERC20.json
- name: ERC20SymbolBytes
file: ./abis/ERC20SymbolBytes.json
- name: ERC20NameBytes
file: ./abis/ERC20NameBytes.json
eventHandlers:
- event: ExchangeCreated(indexed bytes32,indexed address,indexed address,address,uint256)
handler: handleExchangeCreated
- event: ExchangeActivated(indexed bytes32,indexed address)
handler: handleExchangeActivated
- event: ExchangeDeactivated(indexed bytes32,indexed address)
handler: handleExchangeDeactivated
- event: ExchangeRateChanged(indexed bytes32,indexed address,uint256)
handler: handleExchangeRateChanged
- event: Swapped(indexed bytes32,indexed address,uint256,uint256)
handler: handleSwapped
- kind: ethereum/contract
name: Dispenser
network: mumbai
source:
address: '0x1d535147a97bd87c8443125376E6671B60556E07'
abi: Dispenser
startBlock: 14791845
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/dispenser.ts
entities:
- Dispenser
abis:
- name: Dispenser
file: ./abis/Dispenser.json
eventHandlers:
- event: Activated(indexed address)
handler: handleDispenserActivated
- event: Deactivated(indexed address)
handler: handleDispenserDeactivated
- event: AcceptedMinter(indexed address)
handler: handleDispenserAcceptedMinter
- event: RemovedMinter(indexed address)
handler: handleDispenserRemovedMinter
- event: TokensDispensed(indexed address,indexed address,uint256)
handler: handleDispenserTokensDispensed
- event: OwnerWithdrawed(indexed address,indexed address,uint256)
handler: handleDispenserOwnerWithdrawed
templates:
- kind: ethereum/contract
name: Pool
network: mumbai
source:
abi: Pool
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/pool.ts
entities:
- Pool
- PoolFactory
- Swap
abis:
- name: Pool
file: ./abis/BPool.json
- name: BToken
file: ./abis/BToken.json
eventHandlers:
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0x34e1990700000000000000000000000000000000000000000000000000000000'
handler: handleSetSwapFee
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0x92eefe9b00000000000000000000000000000000000000000000000000000000'
handler: handleSetController
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0x49b5955200000000000000000000000000000000000000000000000000000000'
handler: handleSetPublicSwap
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0x4bb278f300000000000000000000000000000000000000000000000000000000'
handler: handleFinalize
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0xd1d7bc9100000000000000000000000000000000000000000000000000000000'
handler: handleSetup
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0x3fdddaa200000000000000000000000000000000000000000000000000000000'
handler: handleRebind
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0xe4e1e53800000000000000000000000000000000000000000000000000000000'
handler: handleRebind
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0x8c28cbe800000000000000000000000000000000000000000000000000000000'
handler: handleGulp
- event: LOG_JOIN(indexed address,indexed address,uint256)
handler: handleJoinPool
- event: LOG_EXIT(indexed address,indexed address,uint256)
handler: handleExitPool
- event: LOG_SWAP(indexed address,indexed address,indexed address,uint256,uint256)
handler: handleSwap
- event: Transfer(indexed address,indexed address,uint256)
handler: handleTransfer
- kind: ethereum/contract
name: DataToken
network: mumbai
source:
abi: DataToken
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/datatoken.ts
entities:
- DataToken
- DatatokenFactory
abis:
- name: DataToken
file: ./abis/DataTokenTemplate.json
eventHandlers:
- event: Transfer(indexed address,indexed address,uint256)
handler: handleTransfer
- event: OrderStarted(indexed address,indexed address,uint256,uint256,uint256,indexed address,uint256)
handler: handleOrderStarted

View File

@ -1,213 +0,0 @@
specVersion: 0.0.2
description: Ocean provides data sharing through IDOs
repository: https://github.com/oceanprotocol/ocean-subgraph
schema:
file: ./schema.graphql
dataSources:
- kind: ethereum/contract
name: Factory
network: polygon
source:
address: '0x69B6E54Ad2b3c2801d11d8Ad56ea1d892555b776'
abi: Factory
startBlock: 11005239
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/factory.ts
entities:
- PoolFactory
abis:
- name: Factory
file: ./abis/BFactory.json
eventHandlers:
- event: BPoolRegistered(address,indexed address)
handler: handleNewPool
- kind: ethereum/contract
name: DTFactory
network: polygon
source:
address: '0xF6410bf5d773C7a41ebFf972f38e7463FA242477'
abi: DTFactory
startBlock: 11005230
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/dtfactory.ts
entities:
- DatatokenFactory
abis:
- name: DTFactory
file: ./abis/DTFactory.json
eventHandlers:
- event: TokenRegistered(indexed address,string,string,uint256,indexed address,indexed string)
handler: handleNewToken
- kind: ethereum/contract
name: Metadata
network: polygon
source:
address: '0x80E63f73cAc60c1662f27D2DFd2EA834acddBaa8'
abi: Metadata
startBlock: 11005247
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/metadata.ts
entities:
- Metadata
abis:
- name: Metadata
file: ./abis/Metadata.json
eventHandlers:
- event: MetadataCreated(indexed address,indexed address,bytes,bytes)
handler: handleMetadataCreated
- event: MetadataUpdated(indexed address,indexed address,bytes,bytes)
handler: handleMetadataUpdated
- kind: ethereum/contract
name: FixedRateExchange
network: polygon
source:
address: '0x2112Eb973af1DBf83a4f11eda82f7a7527D7Fde5'
abi: FixedRateExchange
startBlock: 11005247
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/fixedrateexchange.ts
entities:
- FixedRateExchange
abis:
- name: FixedRateExchange
file: ./abis/FixedRateExchange.json
- name: ERC20
file: ./abis/ERC20.json
- name: ERC20SymbolBytes
file: ./abis/ERC20SymbolBytes.json
- name: ERC20NameBytes
file: ./abis/ERC20NameBytes.json
eventHandlers:
- event: ExchangeCreated(indexed bytes32,indexed address,indexed address,address,uint256)
handler: handleExchangeCreated
- event: ExchangeActivated(indexed bytes32,indexed address)
handler: handleExchangeActivated
- event: ExchangeDeactivated(indexed bytes32,indexed address)
handler: handleExchangeDeactivated
- event: ExchangeRateChanged(indexed bytes32,indexed address,uint256)
handler: handleExchangeRateChanged
- event: Swapped(indexed bytes32,indexed address,uint256,uint256)
handler: handleSwapped
- kind: ethereum/contract
name: Dispenser
network: polygon
source:
address: '0x30E4CC2C7A9c6aA2b2Ce93586E3Df24a3A00bcDD'
abi: Dispenser
startBlock: 14275634
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/dispenser.ts
entities:
- Dispenser
abis:
- name: Dispenser
file: ./abis/Dispenser.json
eventHandlers:
- event: Activated(indexed address)
handler: handleDispenserActivated
- event: Deactivated(indexed address)
handler: handleDispenserDeactivated
- event: AcceptedMinter(indexed address)
handler: handleDispenserAcceptedMinter
- event: RemovedMinter(indexed address)
handler: handleDispenserRemovedMinter
- event: TokensDispensed(indexed address,indexed address,uint256)
handler: handleDispenserTokensDispensed
- event: OwnerWithdrawed(indexed address,indexed address,uint256)
handler: handleDispenserOwnerWithdrawed
templates:
- kind: ethereum/contract
name: Pool
network: polygon
source:
abi: Pool
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/pool.ts
entities:
- Pool
- PoolFactory
- Swap
abis:
- name: Pool
file: ./abis/BPool.json
- name: BToken
file: ./abis/BToken.json
- name: ERC20
file: ./abis/ERC20.json
- name: ERC20SymbolBytes
file: ./abis/ERC20SymbolBytes.json
- name: ERC20NameBytes
file: ./abis/ERC20NameBytes.json
eventHandlers:
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0x34e1990700000000000000000000000000000000000000000000000000000000'
handler: handleSetSwapFee
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0x92eefe9b00000000000000000000000000000000000000000000000000000000'
handler: handleSetController
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0x49b5955200000000000000000000000000000000000000000000000000000000'
handler: handleSetPublicSwap
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0x4bb278f300000000000000000000000000000000000000000000000000000000'
handler: handleFinalize
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0xd1d7bc9100000000000000000000000000000000000000000000000000000000'
handler: handleSetup
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0x3fdddaa200000000000000000000000000000000000000000000000000000000'
handler: handleRebind
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0xe4e1e53800000000000000000000000000000000000000000000000000000000'
handler: handleRebind
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0x8c28cbe800000000000000000000000000000000000000000000000000000000'
handler: handleGulp
- event: LOG_JOIN(indexed address,indexed address,uint256)
handler: handleJoinPool
- event: LOG_EXIT(indexed address,indexed address,uint256)
handler: handleExitPool
- event: LOG_SWAP(indexed address,indexed address,indexed address,uint256,uint256)
handler: handleSwap
- event: Transfer(indexed address,indexed address,uint256)
handler: handleTransfer
- kind: ethereum/contract
name: DataToken
network: polygon
source:
abi: DataToken
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/datatoken.ts
entities:
- DataToken
- DatatokenFactory
abis:
- name: DataToken
file: ./abis/DataTokenTemplate.json
eventHandlers:
- event: Transfer(indexed address,indexed address,uint256)
handler: handleTransfer
- event: OrderStarted(indexed address,indexed address,uint256,uint256,uint256,indexed address,uint256)
handler: handleOrderStarted

View File

@ -1,213 +0,0 @@
specVersion: 0.0.2
description: Ocean provides data sharing through IDOs
repository: https://github.com/oceanprotocol/ocean-subgraph
schema:
file: ./schema.graphql
dataSources:
- kind: ethereum/contract
name: Factory
network: ropsten
source:
address: '0x75be6e18c80A487C8b49663bf14f80A6495045B2'
abi: Factory
startBlock: 9227587
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/factory.ts
entities:
- PoolFactory
abis:
- name: Factory
file: ./abis/BFactory.json
eventHandlers:
- event: BPoolRegistered(address,indexed address)
handler: handleNewPool
- kind: ethereum/contract
name: DTFactory
network: ropsten
source:
address: '0x6ebcCa6df2CAba986FCF44E64Ee82251c1455Dcc'
abi: DTFactory
startBlock: 9227578
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/dtfactory.ts
entities:
- DatatokenFactory
abis:
- name: DTFactory
file: ./abis/DTFactory.json
eventHandlers:
- event: TokenRegistered(indexed address,string,string,uint256,indexed address,indexed string)
handler: handleNewToken
- kind: ethereum/contract
name: Metadata
network: ropsten
source:
address: '0x3cd7Ef1F207E1a46AAd7D5d7F5f0A5cF081Fc726'
abi: Metadata
startBlock: 9227595
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/metadata.ts
entities:
- Metadata
abis:
- name: Metadata
file: ./abis/Metadata.json
eventHandlers:
- event: MetadataCreated(indexed address,indexed address,bytes,bytes)
handler: handleMetadataCreated
- event: MetadataUpdated(indexed address,indexed address,bytes,bytes)
handler: handleMetadataUpdated
- kind: ethereum/contract
name: FixedRateExchange
network: ropsten
source:
address: '0xA7a711A09396DF82D9be46A26B48BafdB9BB4fA6'
abi: FixedRateExchange
startBlock: 9227595
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/fixedrateexchange.ts
entities:
- FixedRateExchange
abis:
- name: FixedRateExchange
file: ./abis/FixedRateExchange.json
- name: ERC20
file: ./abis/ERC20.json
- name: ERC20SymbolBytes
file: ./abis/ERC20SymbolBytes.json
- name: ERC20NameBytes
file: ./abis/ERC20NameBytes.json
eventHandlers:
- event: ExchangeCreated(indexed bytes32,indexed address,indexed address,address,uint256)
handler: handleExchangeCreated
- event: ExchangeActivated(indexed bytes32,indexed address)
handler: handleExchangeActivated
- event: ExchangeDeactivated(indexed bytes32,indexed address)
handler: handleExchangeDeactivated
- event: ExchangeRateChanged(indexed bytes32,indexed address,uint256)
handler: handleExchangeRateChanged
- event: Swapped(indexed bytes32,indexed address,uint256,uint256)
handler: handleSwapped
- kind: ethereum/contract
name: Dispenser
network: ropsten
source:
address: '0xc37F8341Ac6e4a94538302bCd4d49Cf0852D30C0'
abi: Dispenser
startBlock: 10201082
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/dispenser.ts
entities:
- Dispenser
abis:
- name: Dispenser
file: ./abis/Dispenser.json
eventHandlers:
- event: Activated(indexed address)
handler: handleDispenserActivated
- event: Deactivated(indexed address)
handler: handleDispenserDeactivated
- event: AcceptedMinter(indexed address)
handler: handleDispenserAcceptedMinter
- event: RemovedMinter(indexed address)
handler: handleDispenserRemovedMinter
- event: TokensDispensed(indexed address,indexed address,uint256)
handler: handleDispenserTokensDispensed
- event: OwnerWithdrawed(indexed address,indexed address,uint256)
handler: handleDispenserOwnerWithdrawed
templates:
- kind: ethereum/contract
name: Pool
network: ropsten
source:
abi: Pool
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/pool.ts
entities:
- Pool
- PoolFactory
- Swap
abis:
- name: Pool
file: ./abis/BPool.json
- name: BToken
file: ./abis/BToken.json
- name: ERC20
file: ./abis/ERC20.json
- name: ERC20SymbolBytes
file: ./abis/ERC20SymbolBytes.json
- name: ERC20NameBytes
file: ./abis/ERC20NameBytes.json
eventHandlers:
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0x34e1990700000000000000000000000000000000000000000000000000000000'
handler: handleSetSwapFee
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0x92eefe9b00000000000000000000000000000000000000000000000000000000'
handler: handleSetController
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0x49b5955200000000000000000000000000000000000000000000000000000000'
handler: handleSetPublicSwap
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0x4bb278f300000000000000000000000000000000000000000000000000000000'
handler: handleFinalize
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0xd1d7bc9100000000000000000000000000000000000000000000000000000000'
handler: handleSetup
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0x3fdddaa200000000000000000000000000000000000000000000000000000000'
handler: handleRebind
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0xe4e1e53800000000000000000000000000000000000000000000000000000000'
handler: handleRebind
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0x8c28cbe800000000000000000000000000000000000000000000000000000000'
handler: handleGulp
- event: LOG_JOIN(indexed address,indexed address,uint256)
handler: handleJoinPool
- event: LOG_EXIT(indexed address,indexed address,uint256)
handler: handleExitPool
- event: LOG_SWAP(indexed address,indexed address,indexed address,uint256,uint256)
handler: handleSwap
- event: Transfer(indexed address,indexed address,uint256)
handler: handleTransfer
- kind: ethereum/contract
name: DataToken
network: ropsten
source:
abi: DataToken
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/datatoken.ts
entities:
- DataToken
- DatatokenFactory
abis:
- name: DataToken
file: ./abis/DataTokenTemplate.json
eventHandlers:
- event: Transfer(indexed address,indexed address,uint256)
handler: handleTransfer
- event: OrderStarted(indexed address,indexed address,uint256,uint256,uint256,indexed address,uint256)
handler: handleOrderStarted

View File

@ -6,11 +6,11 @@ schema:
dataSources:
- kind: ethereum/contract
name: ERC721Factory
network: rinkeby
network: development
source:
address: '0x65aCFbcf0576D5740d1a824afd1776E7D4034C3D'
address: '0xFF3a12191A703939b1466eC1Fc7679AbbFf88545'
abi: ERC721Factory
startBlock: 10065057
startBlock: 243
mapping:
kind: ethereum/events
apiVersion: 0.0.6
@ -20,7 +20,7 @@ dataSources:
- ERC721Factory
abis:
- name: ERC721Factory
file: ./abis/ERC721Factory.json
file: ./node_modules/@oceanprotocol/contracts/artifacts/contracts/ERC721Factory.sol/ERC721Factory.json
eventHandlers:
- event: NFTCreated(indexed address,indexed address,string,address,string,string)
handler: handleNftCreated
@ -28,11 +28,11 @@ dataSources:
handler: handleNewToken
- kind: ethereum/contract
name: FixedRateExchange
network: rinkeby
network: development
source:
address: '0x40F63Ec24aDc291d41F63fBA356Dd9983197c83a'
address: '0x7256EdE4Bd3D79a8Cc03a2A74849506F5C90c614'
abi: FixedRateExchange
startBlock: 10065057
startBlock: 243
mapping:
kind: ethereum/events
apiVersion: 0.0.6
@ -42,7 +42,7 @@ dataSources:
- FixedRateExchange
abis:
- name: FixedRateExchange
file: ./abis/FixedRateExchange.json
file: ./node_modules/@oceanprotocol/contracts/artifacts/contracts/pools/fixedRate/FixedRateExchange.sol/FixedRateExchange.json
- name: ERC20
file: ./abis/ERC20.json
eventHandlers:
@ -62,11 +62,11 @@ dataSources:
handler: handleSwap
- kind: ethereum/contract
name: Dispenser
network: rinkeby
network: development
source:
address: '0x5b18fbac5aA81B4a0CAF993afb69b2ADfC3E8833'
address: '0x7256EdE4Bd3D79a8Cc03a2A74849506F5C90c614'
abi: Dispenser
startBlock: 10065057
startBlock: 243
mapping:
kind: ethereum/events
apiVersion: 0.0.6
@ -76,7 +76,7 @@ dataSources:
- Dispenser
abis:
- name: Dispenser
file: ./abis/Dispenser.json
file: ./node_modules/@oceanprotocol/contracts/artifacts/contracts/pools/dispenser/Dispenser.sol/Dispenser.json
eventHandlers:
- event: DispenserCreated(indexed address,indexed address,uint256,uint256,address)
handler: handleNewDispenser
@ -93,11 +93,11 @@ dataSources:
- kind: ethereum/contract
name: FactoryRouter
network: rinkeby
network: development
source:
address: '0x5a31C7e57D51fc0991C1315c66587e7a158c9c40'
address: '0x053dc56D2C6A87FB6CEb1063E4c1629B8Cc67F82'
abi: FactoryRouter
startBlock: 10065057
startBlock: 243
mapping:
kind: ethereum/events
apiVersion: 0.0.6
@ -107,7 +107,7 @@ dataSources:
- FactoryRouter
abis:
- name: FactoryRouter
file: ./abis/FactoryRouter.json
file: ./node_modules/@oceanprotocol/contracts/artifacts/contracts/pools/FactoryRouter.sol/FactoryRouter.json
eventHandlers:
- event: NewPool(indexed address,bool)
handler: handleNewPool
@ -115,7 +115,7 @@ dataSources:
templates:
- name: ERC20Template
kind: ethereum/contract
network: rinkeby
network: development
source:
abi: ERC20Template
mapping:
@ -127,13 +127,13 @@ templates:
- ERC20Template
abis:
- name: ERC20Template
file: ./abis/ERC20Template.json
file: ./node_modules/@oceanprotocol/contracts/artifacts/contracts/templates/ERC20Template.sol/ERC20Template.json
- name: ERC20TemplateEnterprise
file: ./abis/ERC20TemplateEnterprise.json
file: ./node_modules/@oceanprotocol/contracts/artifacts/contracts/templates/ERC20TemplateEnterprise.sol/ERC20TemplateEnterprise.json
- name: ERC20
file: ./abis/ERC20.json
- name: ERC20Roles
file: ./abis/ERC20Roles.json
file: ./node_modules/@oceanprotocol/contracts/artifacts/contracts/utils/ERC20Roles.sol/ERC20Roles.json
eventHandlers:
- event: OrderStarted(indexed address,address,uint256,uint256,uint256,indexed address,uint256)
handler: handleOrderStarted
@ -144,7 +144,7 @@ templates:
- name: BPool
kind: ethereum/contract
network: rinkeby
network: development
source:
abi: BPool
mapping:
@ -156,11 +156,11 @@ templates:
- BPool
abis:
- name: BPool
file: ./abis/BPool.json
file: ./node_modules/@oceanprotocol/contracts/artifacts/contracts/pools/balancer/BPool.sol/BPool.json
- name: BToken
file: ./abis/BToken.json
file: ./node_modules/@oceanprotocol/contracts/artifacts/contracts/pools/balancer/BToken.sol/BToken.json
- name: BMath
file: ./abis/BMath.json
file: ./node_modules/@oceanprotocol/contracts/artifacts/contracts/pools/balancer/BMath.sol/BMath.json
- name: ERC20
file: ./abis/ERC20.json
eventHandlers:
@ -174,9 +174,10 @@ templates:
handler: handleSetup
- event: Transfer(indexed address,indexed address,uint256)
handler: handlerBptTransfer
- name: ERC721Template
kind: ethereum/contract
network: rinkeby
network: development
source:
abi: ERC721Template
mapping:
@ -188,7 +189,7 @@ templates:
- ERC721Template
abis:
- name: ERC721Template
file: ./abis/ERC721Template.json
file: ./node_modules/@oceanprotocol/contracts/artifacts/contracts/templates/ERC721Template.sol/ERC721Template.json
eventHandlers:
- event: MetadataCreated(indexed address,uint8,string,bytes,bytes,bytes32,uint256,uint256)
handler: handleCreated

View File

@ -1,44 +0,0 @@
/* eslint-disable prefer-destructuring */
import { assert, use } from 'chai'
import spies from 'chai-spies'
import Web3 from 'web3'
import { Ocean, ConfigHelper, Account } from '@oceanprotocol/lib'
const fetch = require('cross-fetch')
const web3 = new Web3('http://127.0.0.1:8545')
const subgraphUrl =
'http://127.0.0.1:9000/subgraphs/name/oceanprotocol/ocean-subgraph'
function sleep(ms: number) {
return new Promise((resolve) => {
setTimeout(resolve, ms)
})
}
use(spies)
describe('Datatokens test flow', () => {
let alice: Account
let ocean: Ocean
it('Initialize Ocean Library', async () => {
// await sleep(60000) // wait 1 min for graph
const config = new ConfigHelper().getConfig('development')
config.web3Provider = web3
ocean = await Ocean.getInstance(config)
alice = (await ocean.accounts.list())[0]
})
it('Alice publishes a datatoken and querys the graph', async () => {
const datatoken = await ocean.datatokens.create('', alice.getId())
const graphToken = datatoken.toLowerCase()
await sleep(3000) // let graph ingest our transaction
const query = {
query: `query {
datatoken(id:"${graphToken}"){symbol,id}}`
}
const response = await fetch(subgraphUrl, {
method: 'POST',
body: JSON.stringify(query)
})
const result = await response.json()
assert(result.data.datatoken.id === graphToken)
})
})

View File

@ -1,235 +0,0 @@
/* eslint-disable prefer-destructuring */
import { assert, use } from 'chai'
import spies from 'chai-spies'
import Web3 from 'web3'
import { Ocean, ConfigHelper, Account } from '@oceanprotocol/lib'
const fetch = require('cross-fetch')
const web3 = new Web3('http://127.0.0.1:8545')
const subgraphUrl =
'http://localhost:9000/subgraphs/name/oceanprotocol/ocean-subgraph'
function sleep(ms: number) {
return new Promise((resolve) => {
setTimeout(resolve, ms)
})
}
async function getDispenserStatusFromGraph(datatoken: string) {
const id = datatoken.toLowerCase()
const query = {
query: `query {
dispenser(id:"${id}"){active,owner{id},minterApproved,isTrueMinter,maxTokens,maxBalance,balance,datatoken{id}}}`
}
const response = await fetch(subgraphUrl, {
method: 'POST',
body: JSON.stringify(query)
})
const result = await response.json()
return result
}
use(spies)
describe('Dispenser test flow', () => {
let alice: Account
let bob: Account
let ocean: Ocean
let tokenAddress
let tokenAddress2
let tokenAddress3
const tokenAmount = '1000'
it('Initialize Ocean Library', async () => {
const config = new ConfigHelper().getConfig('development')
config.web3Provider = web3
ocean = await Ocean.getInstance(config)
alice = (await ocean.accounts.list())[0]
bob = (await ocean.accounts.list())[1]
})
it('should create some datatokens', async () => {
tokenAddress = await ocean.datatokens.create(
'',
alice.getId(),
'1000000000000000',
'AliceDT',
'DTA'
)
assert(tokenAddress !== null)
tokenAddress2 = await ocean.datatokens.create(
'',
alice.getId(),
'1000000000000000',
'AliceDT2',
'DTA2'
)
assert(tokenAddress2 !== null)
tokenAddress3 = await ocean.datatokens.create(
'',
alice.getId(),
'1000000000000000',
'AliceDT3',
'DTA3'
)
assert(tokenAddress3 !== null)
})
it('Alice mints 1000 tokens', async () => {
const txid = await ocean.datatokens.mint(
tokenAddress,
alice.getId(),
tokenAmount
)
assert(txid !== null)
})
it('Alice creates a dispenser', async () => {
const tx = await ocean.OceanDispenser.activate(
tokenAddress,
'1',
'1',
alice.getId()
)
assert(tx, 'Cannot activate dispenser')
await sleep(3000) // let graph ingest our transaction
const status = await getDispenserStatusFromGraph(tokenAddress)
assert(status.data.dispenser.datatoken.id === tokenAddress.toLowerCase())
assert(status.data.dispenser.owner.id === alice.getId().toLowerCase())
assert(status.data.dispenser.isTrueMinter === false)
assert(status.data.dispenser.minterApproved === false)
assert(status.data.dispenser.active === true)
assert(status.data.dispenser.balance === '0')
})
it('Alice should make the dispenser a minter', async () => {
const tx = await ocean.OceanDispenser.makeMinter(
tokenAddress,
alice.getId()
)
assert(tx, 'Cannot make dispenser a minter')
await sleep(3000) // let graph ingest our transaction
const status = await getDispenserStatusFromGraph(tokenAddress)
assert(status.data.dispenser.datatoken.id === tokenAddress.toLowerCase())
assert(status.data.dispenser.owner.id === alice.getId().toLowerCase())
assert(status.data.dispenser.isTrueMinter === true)
assert(status.data.dispenser.minterApproved === true)
})
it('Bob requests datatokens', async () => {
const tx = await ocean.OceanDispenser.dispense(
tokenAddress,
bob.getId(),
'1'
)
assert(tx, 'Bob failed to get 1DT')
await sleep(3000) // let graph ingest our transaction
const id = tx.transactionHash.toLowerCase()
const query = {
query: `query DispenserHistory {
dispenserTransactions(orderBy: timestamp, orderDirection: desc,
where: {tx: "${id}"}) {
datatoken{id},
user{id},
amount,
block,
timestamp,
tx,
type
}
}`
}
const response = await fetch(subgraphUrl, {
method: 'POST',
body: JSON.stringify(query)
})
const result = await response.json()
assert(result.data.dispenserTransactions[0].type === 'dispense')
})
it('Alice calls removeMinter role and checks if she is the new minter', async () => {
const tx = await ocean.OceanDispenser.cancelMinter(
tokenAddress,
alice.getId()
)
assert(tx, 'Cannot cancel minter role')
await sleep(3000) // let graph ingest our transaction
const status = await getDispenserStatusFromGraph(tokenAddress)
assert(status.data.dispenser.datatoken.id === tokenAddress.toLowerCase())
assert(status.data.dispenser.owner.id === alice.getId().toLowerCase())
assert(status.data.dispenser.isTrueMinter === false)
assert(status.data.dispenser.minterApproved === false)
assert(status.data.dispenser.active === true)
})
it('Alice deactivates the dispenser', async () => {
const tx = await ocean.OceanDispenser.deactivate(
tokenAddress,
alice.getId()
)
assert(tx, 'Cannot make dispenser a minter')
await sleep(3000) // let graph ingest our transaction
const status = await getDispenserStatusFromGraph(tokenAddress)
assert(status.data.dispenser.datatoken.id === tokenAddress.toLowerCase())
assert(status.data.dispenser.owner.id === alice.getId().toLowerCase())
assert(status.data.dispenser.active === false)
})
it('Alice creates a dispenser without minter role', async () => {
const tx = await ocean.OceanDispenser.activate(
tokenAddress2,
'1',
'1',
alice.getId()
)
assert(tx, 'Cannot activate dispenser')
await sleep(3000) // let graph ingest our transaction
const status = await getDispenserStatusFromGraph(tokenAddress2)
assert(status.data.dispenser.datatoken.id === tokenAddress2.toLowerCase())
assert(status.data.dispenser.owner.id === alice.getId().toLowerCase())
assert(status.data.dispenser.isTrueMinter === false)
assert(status.data.dispenser.minterApproved === false)
assert(status.data.dispenser.active === true)
})
it('Alice withdraws all datatokens', async () => {
const mintTx = await ocean.datatokens.mint(
tokenAddress2,
alice.getId(),
'10',
ocean.OceanDispenser.dispenserAddress
)
assert(mintTx, 'Alice cannot mint tokens')
const tx = await ocean.OceanDispenser.ownerWithdraw(
tokenAddress2,
alice.getId()
)
assert(tx, 'Alice failed to withdraw all her tokens')
await sleep(3000) // let graph ingest our transaction
const status = await getDispenserStatusFromGraph(tokenAddress2)
assert(status.data.dispenser.datatoken.id === tokenAddress2.toLowerCase())
assert(status.data.dispenser.owner.id === alice.getId().toLowerCase())
assert(status.data.dispenser.isTrueMinter === false)
assert(status.data.dispenser.minterApproved === false)
assert(status.data.dispenser.active === true)
assert(status.data.dispenser.balance === '0')
const id = tx.transactionHash.toLowerCase()
const query = {
query: `query DispenserHistory {
dispenserTransactions(orderBy: timestamp, orderDirection: desc,
where: {tx: "${id}"}) {
datatoken{id},
user{id},
amount,
block,
timestamp,
tx,
type
}
}`
}
// console.log(query)
const response = await fetch(subgraphUrl, {
method: 'POST',
body: JSON.stringify(query)
})
const result = await response.json()
assert(result.data.dispenserTransactions[0].type === 'withdraw')
})
})

View File

@ -0,0 +1,193 @@
import {
// Aquarius,
// Datatoken,
Erc20CreateParams,
ProviderInstance,
// ProviderFees,
Nft,
NftFactory,
NftCreateData,
getHash,
sleep
} from '@oceanprotocol/lib'
import { assert } from 'chai'
import Web3 from 'web3'
import { SHA256 } from 'crypto-js'
import { homedir } from 'os'
import fs from 'fs'
import { fetch } from 'cross-fetch'
const data = JSON.parse(
fs.readFileSync(
process.env.ADDRESS_FILE ||
`${homedir}/.ocean/ocean-contracts/artifacts/address.json`,
'utf8'
)
)
const addresses = data.development
// const aquarius = new Aquarius('http://127.0.0.1:5000')
const web3 = new Web3('http://127.0.0.1:8545')
const providerUrl = 'http://172.15.0.4:8030'
const subgraphUrl =
'http://127.0.0.1:9000/subgraphs/name/oceanprotocol/ocean-subgraph'
const assetUrl = [
{
type: 'url',
url: 'https://raw.githubusercontent.com/oceanprotocol/testdatasets/main/shs_dataset_test.txt',
method: 'GET'
}
]
const ddo = {
'@context': ['https://w3id.org/did/v1'],
id: 'did:op:efba17455c127a885ec7830d687a8f6e64f5ba559f8506f8723c1f10f05c049c',
version: '4.0.0',
chainId: 4,
nftAddress: '0x0',
metadata: {
created: '2021-12-20T14:35:20Z',
updated: '2021-12-20T14:35:20Z',
type: 'dataset',
name: 'dfgdfgdg',
description: 'd dfgd fgd dfg dfgdfgd dfgdf',
tags: [''],
author: 'dd',
license: 'https://market.oceanprotocol.com/terms',
additionalInformation: {
termsAndConditions: true
}
},
services: [
{
id: 'notAnId',
type: 'access',
files: '',
datatokenAddress: '0xa15024b732A8f2146423D14209eFd074e61964F3',
serviceEndpoint: 'https://providerv4.rinkeby.oceanprotocol.com',
timeout: 0
}
]
}
describe('Simple Publish & consume test', async () => {
it('should publish a dataset (create NFT + ERC20)', async () => {
const nft = new Nft(web3)
// const datatoken = new Datatoken(web3)
const Factory = new NftFactory(addresses.ERC721Factory, web3)
const accounts = await web3.eth.getAccounts()
const publisherAccount = accounts[0]
// const consumerAccount = accounts[1]
const nftParams: NftCreateData = {
name: 'testNFT',
symbol: 'TST',
templateIndex: 1,
tokenURI: ''
}
const erc20Params: Erc20CreateParams = {
templateIndex: 1,
cap: '100000',
feeAmount: '0',
feeManager: '0x0000000000000000000000000000000000000000',
feeToken: '0x0000000000000000000000000000000000000000',
minter: publisherAccount,
mpFeeAddress: '0x0000000000000000000000000000000000000000'
}
const result = await Factory.createNftWithErc20(
publisherAccount,
nftParams,
erc20Params
)
const erc721Address = result.events.NFTCreated.returnValues[0]
const datatokenAddress = result.events.TokenCreated.returnValues[0]
// create the files encrypted string
let providerResponse = await ProviderInstance.encrypt(assetUrl, providerUrl)
ddo.services[0].files = await providerResponse
ddo.services[0].datatokenAddress = datatokenAddress
// update ddo and set the right did
ddo.nftAddress = erc721Address
const chain = await web3.eth.getChainId()
ddo.id =
'did:op:' +
SHA256(web3.utils.toChecksumAddress(erc721Address) + chain.toString(10))
providerResponse = await ProviderInstance.encrypt(ddo, providerUrl)
const encryptedResponse = await providerResponse
const metadataHash = getHash(JSON.stringify(ddo))
await nft.setMetadata(
erc721Address,
publisherAccount,
0,
providerUrl,
'',
'0x2',
encryptedResponse,
'0x' + metadataHash
)
// const resolvedDDO = await aquarius.waitForAqua(ddo.id)
// assert(resolvedDDO, 'Cannot fetch DDO from Aquarius')
// graph tests here
await sleep(2000)
const graphNftToken = erc721Address.toLowerCase()
const query = {
query: `query {
nft(id:"${graphNftToken}"){symbol,id}}`
}
const response = await fetch(subgraphUrl, {
method: 'POST',
body: JSON.stringify(query)
})
const queryResult = await response.json()
assert(queryResult.data.nft.id === graphNftToken)
/*
// mint 1 ERC20 and send it to the consumer
await datatoken.mint(datatokenAddress, publisherAccount, '1', consumerAccount)
// initialize provider
const initializeData = await ProviderInstance.initialize(
resolvedDDO.id,
resolvedDDO.services[0].id,
0,
consumerAccount,
providerUrl
)
const providerFees: ProviderFees = {
providerFeeAddress: initializeData.providerFee.providerFeeAddress,
providerFeeToken: initializeData.providerFee.providerFeeToken,
providerFeeAmount: initializeData.providerFee.providerFeeAmount,
v: initializeData.providerFee.v,
r: initializeData.providerFee.r,
s: initializeData.providerFee.s,
providerData: initializeData.providerFee.providerData,
validUntil: initializeData.providerFee.validUntil
}
// make the payment
const txid = await datatoken.startOrder(
datatokenAddress,
consumerAccount,
consumerAccount,
0,
providerFees
)
// get the url
const downloadURL = await ProviderInstance.getDownloadUrl(
ddo.id,
consumerAccount,
ddo.services[0].id,
0,
txid.transactionHash,
providerUrl,
web3
)
assert(downloadURL, 'Provider getDownloadUrl failed')
try {
const fileData = await downloadFile(downloadURL)
} catch (e) {
assert.fail('Download failed')
}
*/
})
})