Skip to content

Commit

Permalink
AddApprovedAddresses for ERC20X
Browse files Browse the repository at this point in the history
  • Loading branch information
jdowning100 committed Sep 5, 2023
1 parent b7ab58b commit 8d511f3
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions QRC20X.sol
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,23 @@ contract QRC20 {
ApprovedAddresses[chain] = addr;
}

/**
* This function allows the deployer to add external addresses for the token contract on different chains.
* Note that the deployer can only add one address per chain and this address cannot be changed afterwards.
* In comparison to AddApprovedAddress, this function allows the address(es) to be internal so that the same
* approved list can be used for every instance of the contract on each chain.
* Be very careful when adding addresses here.
*/
function AddApprovedAddresses(uint8[] calldata chain, address[] calldata addr) external {
require(msg.sender == _deployer, "Sender is not deployer");
require(chain.length == addr.length, "chain and address arrays must be the same length");
for(uint8 i = 0; i < chain.length; i++) {
require(chain[i] < 9, "Max 9 zones");
require(ApprovedAddresses[chain[i]] == address(0), "The approved address for this zone already exists");
ApprovedAddresses[chain[i]] = addr[i];
}
}

// This function uses the stored prefix list to determine an address's location based on its first byte.
function getAddressLocation(address addr) public view returns (uint8) {
uint8 prefix = uint8(toBytes(addr)[0]);
Expand Down

0 comments on commit 8d511f3

Please sign in to comment.