This repository has been archived by the owner on Oct 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding Gas fee to mint/burn. Supporting stablecoin by address. Remove…
…d KYCVerifier from Persistent storage
- Loading branch information
Showing
10 changed files
with
745 additions
and
340 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,67 @@ | ||
pragma solidity ^0.5.0; | ||
|
||
import "@openzeppelin/upgrades/contracts/Initializable.sol"; | ||
import "./Abstract/InterfaceStorage.sol"; | ||
import "@openzeppelin/contracts-ethereum-package/contracts/ownership/Ownable.sol"; | ||
|
||
|
||
contract KYCVerifier is Initializable { | ||
InterfaceStorage public persistentStorage; | ||
contract KYCVerifier is Ownable { | ||
address public bridge; | ||
|
||
function initialize(address _persistentStorage) public initializer { | ||
persistentStorage = InterfaceStorage(_persistentStorage); | ||
mapping(address => bool) public whitelistedAddresses; | ||
|
||
function initialize(address ownerAddress) public initializer { | ||
require(ownerAddress != address(0), "owner adddress must not be empty"); | ||
Ownable.initialize(ownerAddress); | ||
} | ||
|
||
function isAddressWhitelisted(address userAddress) | ||
public | ||
view | ||
returns (bool) | ||
{ | ||
return persistentStorage.whitelistedAddresses(userAddress); | ||
return whitelistedAddresses[userAddress]; | ||
} | ||
|
||
// @dev Set whitelisted addresses | ||
function setWhitelistedAddress(address adddressToAdd) | ||
public | ||
onlyOwnerOrBridge | ||
{ | ||
require(adddressToAdd != address(0), "adddress must not be empty"); | ||
|
||
whitelistedAddresses[adddressToAdd] = true; | ||
} | ||
|
||
// @dev Remove whitelisted addresses | ||
function removeWhitelistedAddress(address addressToRemove) | ||
public | ||
onlyOwnerOrBridge | ||
{ | ||
require( | ||
whitelistedAddresses[addressToRemove], | ||
"address must be added to be removed allowed" | ||
); | ||
|
||
delete whitelistedAddresses[addressToRemove]; | ||
} | ||
|
||
// @dev Updates whitelisted addresses | ||
function updateWhitelistedAddress(address oldAddress, address newAddress) | ||
public | ||
{ | ||
removeWhitelistedAddress(oldAddress); | ||
setWhitelistedAddress(newAddress); | ||
} | ||
|
||
function setBridge(address _bridge) public onlyOwner { | ||
require(_bridge != address(0), "adddress must not be empty"); | ||
bridge = _bridge; | ||
} | ||
|
||
modifier onlyOwnerOrBridge() { | ||
require( | ||
isOwner() || _msgSender() == bridge, | ||
"caller is not the owner or bridge" | ||
); | ||
_; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.