whitelist filtering

This commit is contained in:
Shawn 2023-12-13 03:31:44 -08:00
parent a73391dc42
commit 80679748c9

View file

@ -78,13 +78,14 @@ func (c *mint) RequiredGas(input []byte) uint64 {
}
// Predetermined create2 address of whitelist contract with exclusive mint/burn privileges.
const whitelistCreate2Addr = "0x000000"
// See: https://github.com/primevprotocol/contracts/blob/ecfd53d43770201da9c7a697be1fb03e5e554e4e/scripts/DeployScripts.s.sol
const whitelistCreate2Addr = "0xe57ee51bcb0914EC666703F923e0433d8c4d70b1"
func (c *mint) Run(input []byte, ctx *precompileContext) ([]byte, error) {
// if ctx.caller != common.HexToAddress(whitelistCreate2Addr) {
// return nil, fmt.Errorf("Error parsing transfer: caller not whitelisted")
// }
if ctx.caller != common.HexToAddress(whitelistCreate2Addr) {
return nil, fmt.Errorf("Error parsing transfer: caller not whitelisted")
}
mintTo := common.BytesToAddress(input[0:32])
@ -110,9 +111,9 @@ func (c *burn) RequiredGas(input []byte) uint64 {
func (c *burn) Run(input []byte, ctx *precompileContext) ([]byte, error) {
// if ctx.caller != common.HexToAddress(whitelistCreate2Addr) {
// return nil, fmt.Errorf("Error parsing transfer: caller not whitelisted")
// }
if ctx.caller != common.HexToAddress(whitelistCreate2Addr) {
return nil, fmt.Errorf("Error parsing transfer: caller not whitelisted")
}
burnFrom := common.BytesToAddress(input[0:32])