This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // SPDX-License-Identifier: MIT | |
| pragma solidity 0.8.19; | |
| import {Common} from "@chainlink/contracts/src/v0.8/llo-feeds/libraries/Common.sol"; | |
| import {StreamsLookupCompatibleInterface} from "@chainlink/contracts/src/v0.8/automation/interfaces/StreamsLookupCompatibleInterface.sol"; | |
| import {ILogAutomation, Log} from "@chainlink/contracts/src/v0.8/automation/interfaces/ILogAutomation.sol"; | |
| import {IRewardManager} from "@chainlink/contracts/src/v0.8/llo-feeds/v0.3.0/interfaces/IRewardManager.sol"; | |
| import {IVerifierFeeManager} from "@chainlink/contracts/src/v0.8/llo-feeds/v0.3.0/interfaces/IVerifierFeeManager.sol"; | |
| import {IERC20} from "@chainlink/contracts/src/v0.8/vendor/openzeppelin-solidity/v4.8.3/contracts/interfaces/IERC20.sol"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // SPDX-License-Identifier: GPL-3.0 | |
| pragma solidity >=0.7.0 <0.9.0; | |
| contract Membership { | |
| uint256 public totalAmount; | |
| uint8 public constant EARLY_MEMBER = 10; | |
| uint8 public constant PRO_MEMBER = 20; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //SPDX-License-Identifier: Unlicensed | |
| pragma solidity ^0.8.0; | |
| contract AMM { | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Some solidity |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require('dotenv').config(); | |
| const mongodbUri = require('mongodb-uri'); | |
| const {MongoClient} = require('mongodb'); | |
| async function runMigration(){ | |
| const uri = process.env.DATABASE_URL; | |
| const uriObject = mongodbUri.parse(uri); | |
| const client = new MongoClient(uri,{ useNewUrlParser: true, useUnifiedTopology: true }); | |
| try { | |
| await client.connect(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| truffle(develop)> buyFoodItemFromCart(6, 10); | |
| truffle(develop)> UnhandledPromiseRejectionWarning: Error: VM Exception while processing transaction: revert ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| truffle(develop)> buyFoodItemFromCart(0, 10); | |
| truffle(develop)> { name: 'Fried Rice', sku: 0, price: 10, state: 'Sold', foodItemExist: false } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let buyFoodItemFromCart = (itemSku, amount) => {foodCart.buyFoodItem(itemSku, {from: buyerAddress, value: amount}).then((trxn) => { const details = trxn.logs[0].args; details.sku = details.sku.toNumber(); details.price = details.price.toNumber(); details.state = trxn.logs[0].event; console.log(details);});} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| truffle(develop)> addFoodItemToCart('Fried Rice', 10); | |
| truffle(develop)> { name: 'Fried Rice',sku: 0, price: 10, state: 'ForSale', foodItemExist: true } //output | |
| truffle(develop)> addFoodItemToCart('Chicken Pepper Soup', 10); | |
| truffle(develop)> { name: 'Chicken Pepper Soup', sku: 1, price: 10, state: 'ForSale', foodItemExist: true } //output | |
| truffle(develop)> addFoodItemToCart('Pepperoni Pizza', 50); | |
| truffle(develop)> { name: 'Pepperoni Pizza', sku: 2, price: 50, state: 'ForSale', foodItemExist: true } //output |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| truffle(develop)> let addFoodItemToCart = (foodName, price) => {foodCart.addFoodItem(foodName, price).then((trxn) => { const details = trxn.logs[0].args; details.sku = details.sku.toNumber(); details.price = details.price.toNumber(); details.state = trxn.logs[0].event; console.log(details);});} |
NewerOlder