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
predicate; | |
use std::{ | |
inputs::*, | |
outputs::*, | |
hash::*, | |
auth::predicate_address | |
}; | |
configurable { |
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
// Constant Product AMM - Uniswap V2. | |
contract; | |
use src20::SRC20; | |
use std::{ | |
u128::U128, | |
hash::sha256, | |
asset::transfer, | |
hash::Hash, | |
asset_id::AssetId, |
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
contract; | |
use sway_libs::i8::I8; | |
abi TestContract { | |
#[storage(write)] | |
fn initialize_counter(value: u64) -> u64; | |
#[storage(read, write)] | |
fn increment_counter(amount: u64) -> u64; |
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
use anyhow::Result; | |
use ethers::{ | |
prelude::*, | |
utils::{Ganache, Solc}, | |
}; | |
use std::{convert::TryFrom, sync::Arc, time::Duration}; | |
// Generate the type-safe contract bindings by providing the ABI | |
// definition in human readable format |
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 { Wallet, utils, dbs } = require("fuel-core"); | |
(async () => { | |
// DB and Key Setup | |
const db = new dbs.Level(); // persisting db | |
const privateKey = (await db.get('key')) || utils.randomBytes(32); | |
await db.put('key', privateKey); | |
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 BN = require('bn.js'); | |
const stripHexPrefix = val => typeof val === 'string' && val.indexOf('0x') === 0 ? val.slice(2) : val; | |
const hexPrefix = val => val ? (`0x${stripHexPrefix((val || {}).div ? val.toString(16) : val)}`) : val; | |
const hexToBN = val => (val || {}).div ? val : new BN(stripHexPrefix(hexPrefix(val)), 16); | |
const numToBN = val => (val || {}).div || String(val).indexOf('0x') !== -1 ? hexToBN(val) : new BN(val, 10); | |
function intToDecimal(weiInput, baseLength, optionsInput) { | |
var wei = numToBN(weiInput); // eslint-disable-line | |
var negative = wei.lt(new BN(0)); // eslint-disable-line |
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
console.log('hello world!'); | |
console.log(window.parent.governx); |
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
0xE4660fdAb2D6Bd8b50C029ec79E244d132c3bc2B |
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
/* | |
You should inherit from StandardToken or, for a token like you would want to | |
deploy in something like Mist, see HumanStandardToken.sol. | |
(This implements ONLY the standard functions and NOTHING else. | |
If you deploy this, you won't have anything useful.) | |
Implements ERC 20 Token standard: https://github.com/ethereum/EIPs/issues/20 | |
.*/ | |
pragma solidity ^0.4.8; |