You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In order to proper display assets in dApps, we need all info regarding assets, including prices.
Every datatoken can have one or more fixed rate exchanges or dispensers.
But we need to be careful when adding this to a DDO, cause this can quickly result to hash missmatches.
To Do:
add a root key at ddo level, called offchain. This key will be excluded every time we hash the ddo (like validateDDO or when indexing and comparing)
in offchain, add a new key: stats. Then, for each service, add an array that looks like:
{datatokenAddress: "0x123",name: "Branin dataset: DT1",symbol: "DT1",serviceId: "0",orders: 1,prices:[{type: "fixedrate",// or "dispenser"price: "123",contract: "contractAddress",token: "0x89777",// token accepted for paymentexchangeId: "xx"// only for fre, this is exhangeID}]}
So , a DDO can look like:
{"@context": ["https://w3id.org/did/v1"],"id": "did:op:37f710f82f73afcb86b66a32182c2d620d2edd9eb00abb5ba5a36e943bc7cd74","version": "4.1.0","chainId": 137,"nftAddress": "0x26C693AD67d45e339A5A50a5a64963892E14EFdD","metadata": {
...
},"services": [{"name": "Download last hour of data","id": "0","type": "access","datatokenAddress": "0x456",
.....},{"name": "Download last week of data","id": "1","type": "access","datatokenAddress": "0x34e84f653Dcb291838aa8AF8Be1E1eF30e749ba0",
.....},{"name": "Download last month of data","id": "2","type": "access","datatokenAddress": "0x1234565",
.....}],offchain: {stats: {[{datatokenAddress: "0x456",name: "BDT1",symbol: "DT1",serviceId: "0",orders: 1,// this service has one dispenser availableprices: [{type: "dispenser",price: "0",contract: "dispenserContractAddress"}]},{datatokenAddress: "0x34e84f653Dcb291838aa8AF8Be1E1eF30e749ba0",name: "BDT2",symbol: "DT2",serviceId: "1",orders: 5,// this service accepts OCEAN for payment, costs 1 token per accessprices:[{type: "fixedrate",price: "1",token:"0x967da4048cD07aB37855c090aAF366e4ce1b9F48",contract: "freContractAddress",exchangeId: "23434"}]},{datatokenAddress: "0x1234565",name: "BDT3",symbol: "DT3",serviceId: "2",orders: 5,// this service accepts either 2 OCEAN or 1 FETCH for paymentprices:[{type: "fixedrate",price: "2",token:"0x967da4048cD07aB37855c090aAF366e4ce1b9F48",contract: "freContractAddress",exchangeId: "23434"},{type: "fixedrate",price: "1",token:"0xaea46A60368A7bD060eec7DF8CBa43b7EF41Ad85",contract: "freContractAddress",exchangeId: "4535"}]}]}}}
To do:
-[ ] exclude "offchain" from every hash compute
-[ ] for MetaDataCreated:
- For each service:
- get the list of dispensers (call getDispensers() - https://github.com/oceanprotocol/contracts/blob/main/contracts/templates/ERC20TemplateEnterprise.sol#L1107C14-L1107C27) from datatoken contract
- for each dispenser, check if active. if yes, add it to the list
- get the list of fixed rates (call getFixedRates())
- for each fixed rate, check if active and grab the price, then add it to the list
- Update stats key
-[ ] for MetaDataUpdated:
- For each service:
- get the list of dispensers (call getDispensers()) from datatoken contract
- for each dispenser, check if active. if yes, add it to the list
- get the list of fixed rates (call getFixedRates())
- for each fixed rate, check if active and grab the price, then add it to the list
- Remove services from stats which are no longer present
- Update stats key
In order to proper display assets in dApps, we need all info regarding assets, including prices.
Every datatoken can have one or more fixed rate exchanges or dispensers.
But we need to be careful when adding this to a DDO, cause this can quickly result to hash missmatches.
To Do:
So , a DDO can look like:
To do:
-[ ] exclude "offchain" from every hash compute
-[ ] for MetaDataCreated:
-[ ] for MetaDataUpdated:
-[ ] indexer: add monitor for DispenserActivated and DispenserDeactivated events (https://github.com/oceanprotocol/contracts/blob/main/contracts/pools/dispenser/Dispenser.sol#L39-L45). If such an event is detected, get all ddos with a match and update it (remove dispenser/add dispenser)
-[ ] indexer: add monitor for ExchangeActivated and ExchangeDeactivated events (https://github.com/oceanprotocol/contracts/blob/main/contracts/pools/fixedRate/FixedRateExchange.sol#L103-L111). If such an event is detected, get all ddos with a match and update it (remove dispenser/add fixed rate)
-[ ] indexer: add monitor for ExchangeRateChanged event(https://github.com/oceanprotocol/contracts/blob/main/contracts/pools/fixedRate/FixedRateExchange.sol#L90C11-L94). If such an event is detected, get all ddos with a match and update them with the new rate
-[ ] indexer: add monitor for OrderStarted event(https://github.com/oceanprotocol/contracts/blob/main/contracts/templates/ERC20TemplateEnterprise.sol#L85-L93). If such an event is detected, get all ddos with a match and update orders count
The text was updated successfully, but these errors were encountered: