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
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
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
/// 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(); |
NewerOlder