Skip to content

Commit

Permalink
feat: updated tokenRegistrar (#138)
Browse files Browse the repository at this point in the history
* 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

* installed newer sdk and deleted files

* supporing all the utils

* Removed a lot of unused imports and made routers upgradable.

* fixed registrars to use interchain router

* fixed tests

* changed all getters to remove get

* prettier

* fixed build warnings

* update package_lock

* make slither happy

* made slither even happier

* make slither super jolly

* minor change

* addressed some comments

* Simplified deployment entrypoints

* prettier

* renamed a bunch of stuff

* prettier

* minor name fix

* fixed tests

* prettier

* updated tokenRegistrar

* make slither happy

* validating tokane manager existance

* adding interchain transfer to the registrar

* fixed slither and tests

* Update contracts/token-registrars/TokenRegistrar.sol

* prettier

* add interchainTransferFrom

* slither

* address test

---------

Co-authored-by: Milap Sheth <[email protected]>
Co-authored-by: Dean Amiel <[email protected]>
  • Loading branch information
3 people authored Nov 3, 2023
1 parent 97e44ad commit d8c3ae3
Show file tree
Hide file tree
Showing 8 changed files with 395 additions and 437 deletions.
18 changes: 0 additions & 18 deletions contracts/interfaces/ICanonicalTokenRegistrar.sol

This file was deleted.

37 changes: 0 additions & 37 deletions contracts/interfaces/IStandardizedTokenRegistrar.sol

This file was deleted.

67 changes: 67 additions & 0 deletions contracts/interfaces/ITokenRegistrar.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

interface ITokenRegistrar {
error ZeroAddress();
error NotDistributor(address distributor);
error NotOperator(address operator);
error NonZeroMintAmount();
error ApproveFailed();

function chainNameHash() external view returns (bytes32);

function standardizedTokenSalt(bytes32 chainAddressHash_, address deployer, bytes32 salt) external view returns (bytes32);

function standardizedTokenId(address deployer, bytes32 salt) external view returns (bytes32 tokenId);

function interchainTokenAddress(address deployer, bytes32 salt) external view returns (address tokenAddress);

function deployInterchainToken(
bytes32 salt,
string calldata name,
string calldata symbol,
uint8 decimals,
uint256 mintAmount,
address distributor,
address operator
) external payable;

function deployRemoteInterchainToken(
string calldata originalChainName,
bytes32 salt,
address additionalDistributor,
address optionalOperator,
string memory destinationChain,
uint256 gasValue
) external payable;

function canonicalTokenSalt(bytes32 chainAddressHash_, address tokenAddress) external view returns (bytes32 salt);

function canonicalTokenId(address tokenAddress) external view returns (bytes32 tokenId);

function registerCanonicalToken(address tokenAddress) external payable returns (bytes32 tokenId);

function deployRemoteCanonicalToken(
string calldata originalChainName,
address originalAddress,
string calldata destinationChain,
uint256 gasValue
) external payable;

function interchainTransfer(
bytes32 tokenId,
string calldata destinationChain,
bytes calldata destinationAddress,
uint256 amount,
uint256 gasValue
) external payable;

function interchainTransferFrom(
bytes32 tokenId,
string calldata destinationChain,
bytes calldata destinationAddress,
uint256 amount,
uint256 gasValue
) external payable;
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import { Proxy } from '@axelar-network/axelar-gmp-sdk-solidity/contracts/upgrada
* @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');
contract TokenRegistrarProxy is Proxy {
bytes32 private constant CONTRACT_ID = keccak256('token-registrar');

/**
* @dev Constructs the InterchainTokenServiceProxy contract.
Expand Down
86 changes: 0 additions & 86 deletions contracts/token-registrars/CanonicalTokenRegistrar.sol

This file was deleted.

147 changes: 0 additions & 147 deletions contracts/token-registrars/StandardizedTokenRegistrar.sol

This file was deleted.

Loading

0 comments on commit d8c3ae3

Please sign in to comment.