Skip to content

Instantly share code, notes, and snippets.

View Alirun's full-sized avatar
🎯
Focusing

Ali Nuraldin Alirun

🎯
Focusing
View GitHub Profile
@Alirun
Alirun / verifyLedgerSignature.js
Created October 26, 2020 19:04
How to verify your Ledger signature of Gnosis Safe transaction
const { TypedDataUtils } = require('eth-sig-util')
const { sha256 } = require('ethereumjs-util')
function generateSafeTxHash(safeAddress, txArgs) {
const messageTypes = {
EIP712Domain: [{ type: 'address', name: 'verifyingContract' }],
SafeTx: [
{ type: 'address', name: 'to' },
{ type: 'uint256', name: 'value' },
{ type: 'bytes', name: 'data' },

Keybase proof

I hereby claim:

  • I am alirun on github.
  • I am alirun (https://keybase.io/alirun) on keybase.
  • I have a public key ASAK6jKjKvP0y3O_1DN_D0rPvav3mZOJ_JkxqpzhLIC_-Qo

To claim this, I am signing this object:

@Alirun
Alirun / trader-short.ts
Last active April 23, 2020 21:36
SwapRate SDK Release: Example short
// Retrieve SwapRate configuration and get the DAI's address and maturity of swaps in 3 month
const { tokenAddress, maturity } = await findTokenAndMaturity()
// Find product with DAI token
const product = await findProduct(tokenAddress)
// Connect to charts (curves) updates to react on changes in the market
api.onCharts(charts => {
// Find quote for the desired maturity
const quote = charts.d.receiveFixed.find(data => data.timestamp === maturity).value
// If current quote on product is more than or equal desired, place an order to pick it up
if (quote >= quoteGte) {
@Alirun
Alirun / trader.ts
Last active May 1, 2020 02:29
SwapRate SDK Release: Example
import { Api, Utils } from '@opiumteam/swaprate-js'
import { PostOrdersFormRequestBody, PayReceiveType, AggregateType } from '@opiumteam/swaprate-js/lib/Utils/types'
const api = new Api()
// Define type of product we want to find: AAVE SUPPLY rate
const type = Utils.types.ProductType.AAVE
const subtype = Utils.types.ProductSubtype.SUPPLY
const tokenTitle = 'DAI'
@Alirun
Alirun / LICENSE
Created April 14, 2020 20:24
Gas consumption test https://opium.network
The software and documentation available in this repository (the "Software") is protected by copyright law and accessible pursuant to the license set forth below. Copyright © 2020 Blockeys BV. All rights reserved.
Permission is hereby granted, free of charge, to any person or organization obtaining the Software (the “Licensee”) to privately study, review, and analyze the Software. Licensee shall not use the Software for any other purpose. Licensee shall not modify, transfer, assign, share, or sub-license the Software or any derivative works of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWAR