Skip to content

Instantly share code, notes, and snippets.

View Pongch's full-sized avatar
🛳️
I ship

Pong Cheecharern Pongch

🛳️
I ship
  • OmiseGO
  • Bangkok
View GitHub Profile
func TestIsChecksum(t *testing.T) {
t.Run("should return false if checksum is wrong", func(t *testing.T) {
wrongcheck := "0xc1912fEE45d61C87Cc5EA59DaE31190FFFFf232D"
if isChecksum(wrongcheck) {
t.Errorf("expected \n %v, got \n %v \n", true, isChecksum(wrongcheck))
}
})
t.Run("should return true if checksum is correct", func(t *testing.T) {
rightcheck := "0xc1912fEE45d61C87Cc5EA59DaE31190FFFFf232d" //last char is uppercase
if !isChecksum(rightcheck) {
package checksum
import (
"encoding/hex"
"golang.org/x/crypto/sha3"
"strconv"
"strings"
)
func checksum(address string) string {
[
{
"constant": true,
"inputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
// Code generated - DO NOT EDIT.
// This file is a generated binding and any manual changes will be lost.
package ERC20Vault
import (
"math/big"
"strings"
"github.com/ethereum/go-ethereum/accounts/abi"
// Code generated - DO NOT EDIT.
// This file is a generated binding and any manual changes will be lost.
package EthVault
import (
"math/big"
"strings"
"github.com/ethereum/go-ethereum/accounts/abi"
// Code generated - DO NOT EDIT.
// This file is a generated binding and any manual changes will be lost.
package PlasmaFramework
import (
"math/big"
"strings"
ethereum "github.com/ethereum/go-ethereum"
// Code generated - DO NOT EDIT.
// This file is a generated binding and any manual changes will be lost.
package PaymentExitGame
import (
"math/big"
"strings"
ethereum "github.com/ethereum/go-ethereum"
// Code generated - DO NOT EDIT.
// This file is a generated binding and any manual changes will be lost.
package PaymentExitGame
import (
"math/big"
"strings"
ethereum "github.com/ethereum/go-ethereum"
// Code generated - DO NOT EDIT.
// This file is a generated binding and any manual changes will be lost.
package PlasmaFramework
import (
"math/big"
"strings"
ethereum "github.com/ethereum/go-ethereum"
// Code generated - DO NOT EDIT.
// This file is a generated binding and any manual changes will be lost.
package Erc20Vault
import (
"math/big"
"strings"
ethereum "github.com/ethereum/go-ethereum"