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
/// Taker signs a previously created/validated offer, submits it to chain for signature verification. | |
var d = new Date(); | |
var t = d.getTime().toString(); | |
var currentAddress = document.getElementById("useraddress").innerHTML; | |
var minorSalt = currentAddress + t; | |
var Salt = web3.utils.keccak256(minorSalt).toString(); |
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.5.9; | |
pragma experimental ABIEncoderV2; | |
import "./safeMath.sol"; | |
contract DefiHedge { | |
struct RPCSig{ | |
uint8 v; | |
bytes32 r; |
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 (window.ethereum) { | |
var web3 = new Web3(window.ethereum); | |
window.ethereum.enable();} | |
const childChain = new ChildChain({ watcherUrl: "https://watcher-info.ropsten.v1.omg.network" }); | |
account = getAccounts(function(result) { | |
document.getElementById("useraddress").innerHTML = result[0]; | |
}); | |
async function transfer () { | |
// We want to pay the fee in ETH, so we have to fetch the ETH fee amount from the Watcher | |
const allFees = await childChain.getFees() |
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
struct RPCSig{ | |
uint8 v; | |
bytes32 r; | |
bytes32 s; | |
} | |
struct EIP712Domain { | |
string name; | |
string version; | |
uint256 chainId; |
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
function createErcOffer() { | |
const typedData = { | |
types: { | |
EIP712Domain: [ | |
{ name: 'name', type: 'string' }, | |
{ name: 'version', type: 'string' }, | |
{ name: 'chainId', type: 'uint256' }, | |
{ name: 'verifyingContract', type: 'address' } | |
], | |
Offer: [ |
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 { ethers } from "ethers"; | |
const provider = new ethers.providers.Web3Provider(window.ethereum) | |
const signer = provider.getSigner() | |
const zeroExAddress = '0x61935cbdd02287b511119ddb11aeb42f1593b7ef' | |
const zeroExContract = new ethers.Contract(zeroExAddress, exchangeABI, provider); | |
function takeOrder() { | |
const order = { |
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
function EIP712Hash(typedData) { | |
const types = typedData.types; | |
function abiEncode (types, values) { | |
var output = [] | |
var data = [] | |
var headLength = 0 |
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.5.9; | |
pragma experimental ABIEncoderV2; | |
contract Swivel { | |
struct RPCSig{ | |
uint8 v; | |
bytes32 r; | |
bytes32 s; | |
} |
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 { connect } from "react-redux"; | |
import { dispose, init } from "klinecharts"; | |
import { withUserPreferences } from "components/UserPreferenceContext"; | |
import React, { PureComponent } from "react"; | |
import config from "lightcone/config"; | |
import styled, { withTheme } from "styled-components"; | |
import "./KlineChart.less"; | |
import { getData } from "./utils"; |
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
from time import sleep | |
from sys import exit | |
import time | |
import datetime | |
import math | |
import swivel-py | |
def truncate(number, digits) -> float: | |
stepper = 10.0 ** digits | |
return math.trunc(stepper * number) / stepper |
OlderNewer