This file contains 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
import { | |
Account, | |
clusterApiUrl, | |
Connection, | |
PublicKey, | |
sendAndConfirmTransaction, | |
SystemProgram, | |
Transaction, | |
} from '@solana/web3.js'; |
This file contains 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
import { useEffect, useState, createRef } from 'react'; | |
import { Contract, ethers } from 'ethers' | |
import moment from "moment"; | |
import { Container, Dimmer, Loader, Grid, Sticky, Message } from 'semantic-ui-react'; | |
import 'semantic-ui-css/semantic.min.css'; | |
import Escrow from './artifacts/contracts/Escrow.sol/Escrow.json' |
This file contains 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
const { expect } = require("chai"); | |
const { expectRevert } = require('@openzeppelin/test-helpers'); | |
const humanReadableUnixTimestamp = (timestampInt) => { | |
return new Date(timestampInt * 1000); | |
} | |
describe("Escrow Events and State", function() { | |
// 1. | |
let provider; | |
let Escrow, escrow, seller, firstBuyer, secondBuyer; // seller is owner | |
let closedEvent, |
This file contains 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 Escrow { | |
uint public price; | |
address payable public seller; | |
address payable public buyer; | |
// 1. | |
address[] previousBuyers; | |
// 2. | |
enum State { Sale, Locked, Release, Closed, Complete } |
This file contains 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
// ethers is global variable here. | |
const { expect } = require("chai"); | |
const { expectRevert } = require('@openzeppelin/test-helpers'); | |
// 1. | |
const totalSupplyBigNumberHex = ethers.BigNumber.from("0x52b7d2dcc80cd2e4000000"); | |
const preMineBigNumberHex = ethers.BigNumber.from("0x108b2a2c28029094000000"); | |
const airDropSize = "1000000000000000000000000"; // "0xD3C21BCECCEDA1000000" | |
describe("SCAMToken state and transactions", function () { | |
let SCAMToken, scamToken, owner, firstComer, secondComer; // seller is owner | |
// We don't include events here |
This file contains 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
// We require the Hardhat Runtime Environment explicitly here. This is optional | |
// but useful for running the script in a standalone fashion through `node <script>`. | |
// | |
// When running the script with `hardhat run <script>` you'll find the Hardhat | |
// Runtime Environment's members available in the global scope. | |
const hre = require("hardhat"); | |
async function main() { | |
const [deployer] = await hre.ethers.getSigners(); | |
console.log( | |
"Deploying contracts with the account:", |
This file contains 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
pragma solidity >=0.4.22 <0.6.0; | |
contract SCAM_Token { | |
// 1. | |
string public constant name = "Safe Crypto And Money"; | |
string public constant symbol = "SCAM"; | |
uint8 public constant decimals = 18; | |
event Approval(address indexed tokenOwner, address indexed spender, uint tokens); |
This file contains 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
pragma solidity >=0.4.22 <0.6.0; | |
contract SCAM_Token { | |
// 1. | |
string public constant name = "Safe Crypto And Money"; | |
string public constant symbol = "SCAM"; | |
uint8 public constant decimals = 18; | |
event Approval(address indexed tokenOwner, address indexed spender, uint tokens); |