Skip to content

Instantly share code, notes, and snippets.

View thexeromin's full-sized avatar
🎯
Focusing

Abhijit Paul thexeromin

🎯
Focusing
View GitHub Profile
@thexeromin
thexeromin / settings.py
Created August 9, 2022 08:52
django_project
"""
Django settings for sso_server project.
Generated by 'django-admin startproject' using Django 3.1.1.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.1/ref/settings/
specVersion: 0.0.2
description: Uniswap is a decentralized protocol for automated token exchange on Ethereum.
repository: https://github.com/Uniswap/uniswap-v2-subgraph
schema:
file: ./schema.graphql
dataSources:
- kind: ethereum/contract
name: Factory
network: mainnet
source:
import React, { useEffect, useState } from 'react'
import { useQuery, gql } from '@apollo/client'
const QUERY = gql`
query Tokens($where: Token_filter) {
tokens(where: $where) {
name
symbol
id
totalLiquidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.4;
import './ERC20.sol';
import './Ownable.sol';
import './libraries/SafeMath.sol';
import './interfaces/IDEXFactory.sol';
import './interfaces/IDEXRouter.sol';
import './interfaces/InterfaceLP.sol';
@thexeromin
thexeromin / learn.md
Created October 13, 2022 06:29 — forked from rylev/learn.md
How to Learn Rust

Learning Rust

The following is a list of resources for learning Rust as well as tips and tricks for learning the language faster.

Warning

Rust is not C or C++ so the way your accustomed to do things in those languages might not work in Rust. The best way to learn Rust is to embrace its best practices and see where that takes you.

The generally recommended path is to start by reading the books, and doing small coding exercises until the rules around borrow checking become intuitive. Once this happens, then you can expand to more real world projects. If you find yourself struggling hard with the borrow checker, seek help. It very well could be that you're trying to solve your problem in a way that goes against how Rust wants you to work.

// SPDX-License-Identifier: MIT
pragma solidity ^0.7.4;
library SafeMathInt {
int256 private constant MIN_INT256 = int256(1) << 255;
int256 private constant MAX_INT256 = ~(int256(1) << 255);
function mul(int256 a, int256 b) internal pure returns (int256) {
int256 c = a * b;
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
contract Bridge is Ownable {
using SafeMath for uint256;
address public tokenReceiver = 0x7604cC735Baaf33283dc4f3372A7B4A14B93Ce10;
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
contract BridgeBSC is Ownable {
using SafeMath for uint256;
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
contract BridgeBSC is Ownable {
using SafeMath for uint256;
import { SHA256 } from "crypto-js";
const createHash = (str1, str2) => {
let arr1 = [str1, str2];
const sortAlphaNum = (a, b) => a.localeCompare(b, "en", { numeric: true });
const arrayOutput = arr1.sort(sortAlphaNum);
const hash = SHA256(arrayOutput.join("")).toString();
return hash;
};