mirror of
https://github.com/status-im/status-go.git
synced 2025-02-22 11:48:31 +00:00
- new file `contracts/community-tokens/contracts.go` added to unify contracts creation - the following community related path processors added: - `CommunityBurnProcessor` - `CommunityDeployAssetsProcessor` - `CommunityDeployCollectiblesProcessor` - `CommunityDeployOwnerTokenProcessor` - `CommunityMintTokensProcessor` - `CommunityRemoteBurnProcessor` - `CommunitySetSignerPubKeyProcessor` - `SendType` extended with appropriate options - added endpoints to duplicated `communitytokens` api: - `StoreDeployedCollectibles` - `StoreDeployedOwnerToken` - `StoreDeployedAssets` - removed endpoints from duplicated `communitytokens` api: - `DeployCollectibles` - `DeployOwnerToken` - `ReTrackOwnerTokenDeploymentTransaction` - `DeployAssets` - `DeployCollectiblesEstimate` - `DeployAssetsEstimate` - `DeployOwnerTokenEstimate` - `EstimateMintTokens` - `EstimateRemoteBurn` - `EstimateBurn` - `EstimateSetSignerPubKey` - `NewOwnerTokenInstance` - `NewCommunityTokenDeployerInstance` - `NewCommunityOwnerTokenRegistryInstance` - `NewCollectiblesInstance` - `NewAssetsInstance` - `MintTokens` - `RemoteBurn` - `GetCollectiblesContractInstance` - `GetAssetContractInstance` - `Burn` - `SetSignerPubKey` - `Path` type extended with new property: - `UsedContractAddress` - an address of the contract that will be used for the transaction
79 lines
2.8 KiB
Go
79 lines
2.8 KiB
Go
package communitytokens
|
|
|
|
import (
|
|
"errors"
|
|
|
|
"github.com/ethereum/go-ethereum/common"
|
|
"github.com/status-im/status-go/contracts/community-tokens/assets"
|
|
"github.com/status-im/status-go/contracts/community-tokens/collectibles"
|
|
communitytokendeployer "github.com/status-im/status-go/contracts/community-tokens/deployer"
|
|
"github.com/status-im/status-go/contracts/community-tokens/mastertoken"
|
|
"github.com/status-im/status-go/contracts/community-tokens/ownertoken"
|
|
communityownertokenregistry "github.com/status-im/status-go/contracts/community-tokens/registry"
|
|
"github.com/status-im/status-go/rpc"
|
|
)
|
|
|
|
type CommunityTokensContractMaker struct {
|
|
RPCClient rpc.ClientInterface
|
|
}
|
|
|
|
func NewCommunityTokensContractMakerMaker(client rpc.ClientInterface) (*CommunityTokensContractMaker, error) {
|
|
if client == nil {
|
|
return nil, errors.New("rpc client is required")
|
|
}
|
|
return &CommunityTokensContractMaker{RPCClient: client}, nil
|
|
}
|
|
|
|
func (c *CommunityTokensContractMaker) NewOwnerTokenInstance(chainID uint64, contractAddress common.Address,
|
|
) (*ownertoken.OwnerToken, error) {
|
|
backend, err := c.RPCClient.EthClient(chainID)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return ownertoken.NewOwnerToken(contractAddress, backend)
|
|
}
|
|
|
|
func (c *CommunityTokensContractMaker) NewMasterTokenInstance(chainID uint64, contractAddress common.Address,
|
|
) (*mastertoken.MasterToken, error) {
|
|
backend, err := c.RPCClient.EthClient(chainID)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return mastertoken.NewMasterToken(contractAddress, backend)
|
|
}
|
|
|
|
func (c *CommunityTokensContractMaker) NewCollectiblesInstance(chainID uint64, contractAddress common.Address,
|
|
) (*collectibles.Collectibles, error) {
|
|
backend, err := c.RPCClient.EthClient(chainID)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return collectibles.NewCollectibles(contractAddress, backend)
|
|
}
|
|
|
|
func (c *CommunityTokensContractMaker) NewAssetsInstance(chainID uint64, contractAddress common.Address,
|
|
) (*assets.Assets, error) {
|
|
backend, err := c.RPCClient.EthClient(chainID)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return assets.NewAssets(contractAddress, backend)
|
|
}
|
|
|
|
func (c *CommunityTokensContractMaker) NewCommunityTokenDeployerInstance(chainID uint64, contractAddress common.Address,
|
|
) (*communitytokendeployer.CommunityTokenDeployer, error) {
|
|
backend, err := c.RPCClient.EthClient(chainID)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return communitytokendeployer.NewCommunityTokenDeployer(contractAddress, backend)
|
|
}
|
|
|
|
func (c *CommunityTokensContractMaker) NewCommunityOwnerTokenRegistryInstance(chainID uint64, contractAddress common.Address) (*communityownertokenregistry.CommunityOwnerTokenRegistry, error) {
|
|
backend, err := c.RPCClient.EthClient(chainID)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return communityownertokenregistry.NewCommunityOwnerTokenRegistry(contractAddress, backend)
|
|
}
|