Skip to content

Commit

Permalink
whitelist filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
shaspitz committed Dec 13, 2023
1 parent a73391d commit 8067974
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions core/vm/contracts_with_ctx.go
Original file line number Diff line number Diff line change
Expand Up @@ -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])

Expand All @@ -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])

Expand Down

0 comments on commit 8067974

Please sign in to comment.