-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: custom token registrars (#116)
* Added a canonical token registrar. * wrote some canonical token registrar tests * made the standardized token registrar * Wrote some basic tests * lint and fix a merge bug * feat: bump to latest gmp-sdk and cgp * rebase over dep bump * clean lock file * slither checks * Added roles, tests pending * fix: tests * Added some tests and fixed constants * made lint happy * Chnaged roles constants to enum to make slither happy * Fixed tests * querrying chain name from the remoteAddressValidator for the registrars * stash to add more utils to roles. * Added getter for distributor and opearator. * made lint happy * fixed a spelling error * Fixed tests and interfaces * Removed a lot of unused imports and made routers upgradable. * Addressed changes * update for the new roles functions * allow for mintAmount for standardized tokens * update sdk * updage to newest sdk * made lint happy * added some changes * Added some utilities * made lint happy * fix test * build warnings * revert fix * fix create3 deployer reference * fix test * slither warnings * switch proxies * fix import --------- Co-authored-by: Milap Sheth <[email protected]> Co-authored-by: Dean Amiel <[email protected]>
- Loading branch information
1 parent
cd663a4
commit b7bc804
Showing
24 changed files
with
1,556 additions
and
416 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
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity ^0.8.0; | ||
|
||
interface ICanonicalTokenRegistrar { | ||
error ZeroAddress(); | ||
error ApproveFailed(); | ||
|
||
function chainNameHash() external view returns (bytes32); | ||
|
||
function getCanonicalTokenSalt(address tokenAddress) external view returns (bytes32 salt); | ||
|
||
function getCanonicalTokenId(address tokenAddress) external view returns (bytes32 tokenId); | ||
|
||
function registerCanonicalToken(address tokenAddress) external payable returns (bytes32 tokenId); | ||
|
||
function deployAndRegisterRemoteCanonicalToken(bytes32 salt, string calldata destinationChain, uint256 gasValue) external payable; | ||
} |
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
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
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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity ^0.8.0; | ||
|
||
interface IStandardizedTokenRegistrar { | ||
error ZeroAddress(); | ||
error NotDistributor(address distributor); | ||
error NotOperator(address operator); | ||
error NonZeroMintAmount(); | ||
|
||
function chainNameHash() external view returns (bytes32); | ||
|
||
function getStandardizedTokenSalt(address deployer, bytes32 salt) external view returns (bytes32); | ||
|
||
function getStandardizedTokenId(address deployer, bytes32 salt) external view returns (bytes32 tokenId); | ||
|
||
function getStandardizedTokenAddress(address deployer, bytes32 salt) external view returns (address tokenAddress); | ||
|
||
function deployStandardizedToken( | ||
bytes32 salt, | ||
string calldata name, | ||
string calldata symbol, | ||
uint8 decimals, | ||
uint256 mintAmount, | ||
address distributor | ||
) external payable; | ||
|
||
function deployRemoteStandarizedToken( | ||
bytes32 salt, | ||
address additionalDistributor, | ||
address optionalOperator, | ||
uint256 mintAmount, | ||
string memory destinationChain, | ||
uint256 gasValue | ||
) external payable; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity ^0.8.0; | ||
|
||
import { Proxy } from '@axelar-network/axelar-gmp-sdk-solidity/contracts/upgradable/Proxy.sol'; | ||
|
||
/** | ||
* @title CanonicalTokenRegistrarProxy | ||
* @dev Proxy contract for interchain token service contracts. Inherits from the Proxy contract. | ||
*/ | ||
contract CanonicalTokenRegistrarProxy is Proxy { | ||
bytes32 private constant CONTRACT_ID = keccak256('canonical-token-registrar'); | ||
|
||
/** | ||
* @dev Constructs the InterchainTokenServiceProxy contract. | ||
* @param implementationAddress Address of the interchain token service implementation | ||
* @param owner Address of the owner of the proxy | ||
*/ | ||
constructor(address implementationAddress, address owner) Proxy(implementationAddress, owner, '') {} | ||
|
||
/** | ||
* @dev Override for the 'contractId' function in FinalProxy. Returns a unique identifier for this contract. | ||
* @return bytes32 identifier for this contract | ||
*/ | ||
function contractId() internal pure override returns (bytes32) { | ||
return CONTRACT_ID; | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity ^0.8.0; | ||
|
||
import { Proxy } from '@axelar-network/axelar-gmp-sdk-solidity/contracts/upgradable/Proxy.sol'; | ||
|
||
/** | ||
* @title StandardizedTokenRegistrarProxy | ||
* @dev Proxy contract for interchain token service contracts. Inherits from the Proxy contract. | ||
*/ | ||
contract StandardizedTokenRegistrarProxy is Proxy { | ||
bytes32 private constant CONTRACT_ID = keccak256('standardized-token-registrar'); | ||
|
||
/** | ||
* @dev Constructs the InterchainTokenServiceProxy contract. | ||
* @param implementationAddress Address of the interchain token service implementation | ||
* @param owner Address of the owner of the proxy | ||
*/ | ||
constructor(address implementationAddress, address owner) Proxy(implementationAddress, owner, '') {} | ||
|
||
/** | ||
* @dev Override for the 'contractId' function in FinalProxy. Returns a unique identifier for this contract. | ||
* @return bytes32 identifier for this contract | ||
*/ | ||
function contractId() internal pure override returns (bytes32) { | ||
return CONTRACT_ID; | ||
} | ||
} |
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
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
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.