-
Notifications
You must be signed in to change notification settings - Fork 2
/
whitelist.go
35 lines (30 loc) 路 1.08 KB
/
whitelist.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Package server Whitelist for smart contract functions that never need protection.
package server
import "strings"
// Functions that never need protection
var allowedFunctions = map[string]bool{
"a9059cbb": true, // transfer
"23b872dd": true, // transferFrom
"095ea7b3": true, // approve
"2e1a7d4d": true, // weth withdraw
"d0e30db0": true, // weth deposit
"f242432a": true, // safe transfer NFT
}
func isOnFunctionWhitelist(data string) bool {
if len(data) < 8 {
return false
}
return allowedFunctions[data[0:8]]
}
var allowedLargeTxTargets = map[string]bool{
"0xff1f2b4adb9df6fc8eafecdcbf96a2b351680455": true, // Aztec rollup contract
"0x47312450B3Ac8b5b8e247a6bB6d523e7605bDb60": true, // StarkWare SHARP Verifier (Mainnet)
"0x8f97970aC5a9aa8D130d35146F5b59c4aef57963": true, // StarkWare SHARP Verifier (Goerli)
"0x07ec0D28e50322Eb0C159B9090ecF3aeA8346DFe": true, // StarkWare SHARP Verifier (Sepolia)
}
func init() {
// Ensure that addresses are also indexed lowercase
for target, val := range allowedLargeTxTargets {
allowedLargeTxTargets[strings.ToLower(target)] = val
}
}