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 { XMLParser } = require("fast-xml-parser"); | |
const TurndownService = require("turndown"); | |
const moment = require("moment"); | |
const shell = require("shelljs"); | |
const fetch = require("node-fetch"); | |
const yaml = require("js-yaml"); | |
const fs = require("fs"); | |
const path = require("path"); |
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.8.7; | |
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; | |
contract Ship is Initializable { | |
string public name; | |
uint256 public fuel; | |
function initialize(string memory _name, uint256 _fuel) external initializer { | |
name = _name; |
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
interface IERC20 { | |
function totalSupply() external view returns (uint256); | |
function balanceOf(address who) external view returns (uint256); | |
function allowance(address owner, address spender) | |
external view returns (uint256); | |
function transfer(address to, uint256 value) external returns (bool); |
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 dotenv from "dotenv"; | |
import { getDefaultProvider, Wallet } from "ethers"; | |
import { deployContract } from "ethereum-waffle"; | |
import SKETokenArtifact from "../build/SKEToken.json"; | |
import { SKEToken } from "../types/ethers-contracts/SKEToken"; | |
dotenv.config(); | |
async function deploy() { | |
const mnemonic = process.env["MNEMONIC"] || ""; |
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 { use, expect } from "chai"; | |
import { solidity, MockProvider, deployContract } from "ethereum-waffle"; | |
import SKETokenArtifact from "../build/SKEToken.json"; | |
import { SKEToken } from "../types/ethers-contracts/SKEToken"; | |
use(solidity); | |
describe("Counter smart contract", () => { | |
const provider = new MockProvider(); | |
const [wallet] = provider.getWallets(); |
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 SKEToken = artifacts.require("SKEToken"); | |
contract("2nd SKEToken test", async ([deployer, user1]) => { | |
it("should put 10000 SKEToken in the first account", async () => { | |
const token = await SKEToken.new(10000, { from: deployer }); | |
let balance = await token.balanceOf(deployer); | |
assert.equal(balance.valueOf(), 10000); | |
}); | |
}); |
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
ropsten: { | |
provider: () => | |
new HDWalletProvider( | |
process.env["MNEMONIC"], | |
`https://ropsten.infura.io/v3/939fb730f6cd4449aeb9f101cca7277e` | |
), | |
network_id: 3, // Ropsten's id | |
gas: 5500000, // Ropsten has a lower block limit than mainnet | |
confirmations: 2, // # of confs to wait between deployments. (default: 0) | |
timeoutBlocks: 200, // # of blocks before a deployment times out (minimum/default: 50) |
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 { use, expect } from "chai"; | |
import { solidity, createMockProvider, getWallets, deployContract } from 'ethereum-waffle' | |
import * as ERC20TokenJSON from '../build/ERC20Token.json' | |
import { ERC20Token } from '../typed-contracts/ERC20Token' | |
use(solidity); | |
describe('Counter smart contract', () => { | |
const provider = createMockProvider(); | |
const [wallet] = getWallets(provider); |
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
if __name__ == '__main__': | |
num_traders = 100 | |
num_arbitrageurs = 10 | |
trader_dai = 10000 | |
trader_eth = 1000 | |
uniswap_dai = 1000000 | |
uniswap_eth = 10000 | |
model = UniswapModel(num_traders, num_arbitrageurs, trader_dai, trader_eth, uniswap_dai, uniswap_eth) | |
for i in range(100): |
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
class UniswapModel(Model): | |
def __init__(self, num_traders, num_arbitrageurs, trader_dai, trader_eth, uniswap_dai, uniswap_eth): | |
super().__init__() | |
self.num_traders = num_traders | |
self.schedule = RandomActivation(self) | |
self.uniswap = Uniswap(1, self, uniswap_dai, uniswap_eth) | |
for i in range(num_traders): | |
trader = Trader(i, self, trader_eth, trader_dai, i < num_arbitrageurs) | |
self.schedule.add(trader) |
NewerOlder