Produce waste, register, transfer and recycle it! This project developed in Patika.dev's Near Bootcamp. Here is Loom video : https://www.loom.com/share/8e90d36905b54e79b9cbfb6de1388a07
- Producer / Can produce waste
- Recycler / Can recycle waste
-beProducer(company:string, sector: string) // Call function
-findProducerById(id:u32) // View function
-findProducers(offset: u32, limit: u32=10) // View function
-beRecycler(name:AccountId, type:string) // Call function
-findRecyclersById(id:u32) // View function
-findRecyclers(offset:u32, limit:u32=10) // View function
-produce(name:string, desc:string, deposit:u8) // Call function
-transfer(id:u32, recycler:string) // Call function
-recycle(id:u32) // Call function
-findWasteById(id:u32) // View function
-findWastes(offset: u32, limit:u32=10) // View function
yarn
yarn build:release
near dev-deploy ./build/release/waste.wasm
export CONTRACT=<AccountId>
echo $CONTRACT
BeProducer
near call $CONTRACT beProducer '{"company": "TOGG", "sector": "Automotive"}' --accountId producer1.testnet
View Producer By ID
near view $CONTRACT findProducerById '{"id": ProducerID }'
View Producers
near view $CONTRACT findProducers '{"offset" : 0 }'
BeRecycler
near call $CONTRACT beRecycler '{"name" : "RECYCLERID", "type": "mixed"}' --accountId recycler.testnet
View Recycler by Id
near view $CONTRACT findRecyclersById '{"id" : RecyclerID}'
View Recyclers
near view $CONTRACT findRecyclers '{"offset" : 0}'
Produce Waste
near call $CONTRACT produce '{"name": "TestWaste", "desc":"Metal", "deposit": 1 }' --accountId producer1.testnet --amount 1
Transfer Waste
near call $CONTRACT transfer '{"id" : WasteID , "recycler" : "RecyclerAccountID"}' --accountId producer1.testnet
Recycle Waste
near call $CONTRACT recycle '{"id": WasteID}' --accountId recycler.testnet
View Waste by ID
near view $CONTRACT findWasteById '{"id": WasteID}'
View Wastes
near view $CONTRACT findWastes '{"offset" : 1, "limit" : 10}'