Skip to content

Instantly share code, notes, and snippets.

View sdelvalle57's full-sized avatar
🏠
Working from home

Santiago Del Valle sdelvalle57

🏠
Working from home
  • Australia
View GitHub Profile
@sdelvalle57
sdelvalle57 / bytesSort.sol
Created June 2, 2018 09:31
Sort array in solidity, could be easily used to sort any array of integers too
pragma solidity ^0.4.0;
contract ArraySort {
function sort_array(bytes memory arr) private pure returns (bytes) {
uint256 l = arr.length;
for(uint i = 0; i < l; i++) {
for(uint j = i+1; j < l ;j++) {
if(arr[i] > arr[j]) {
bytes1 temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
"use strict";
/**
* Example JavaScript code that interacts with the page and Web3 wallets
*/
// Unpkg imports
const Web3Modal = window.Web3Modal.default;
const WalletConnectProvider = window.WalletConnectProvider.default;
function getNetwork(id) {
if(id === 4) return "Mainnet"
else return "Rinkeby"
}
function getMateriaAbi() {
return [
{
"inputs": [