contracts

package
v0.0.0-...-2d88b26 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 29, 2018 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

* Copyright 2017 Primas Lab Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAllContracts

func GetAllContracts() map[string]*Contract

func InitContracts

func InitContracts() error

Types

type AddMemberLogArgs

type AddMemberLogArgs struct {
	GroupDNA  []byte
	Signature []byte
}

type CommentLogArgs

type CommentLogArgs struct {
	ArticleDNA  []byte
	GroupDNA    []byte
	ContentHash []byte
	Signature   []byte
}

type Content

type Content interface {
	ToMetadata() (title, contentHash, license, blockHash, extras, signature, DNA []byte, err error)
	FromMetadata(title, contentHash, license, blockHash, extras, signature, DNA []byte) error
	GetUserAddress() string
	GetDNA() string
}

type ContentContract

type ContentContract struct {
	Contract *Contract
}

func GetContentContract

func GetContentContract() (*ContentContract, error)

func (*ContentContract) Comment

func (contentContract *ContentContract) Comment(comment *models.ArticleComment) error

func (*ContentContract) Like

func (contentContract *ContentContract) Like(like *models.ArticleLike) error

func (*ContentContract) Publish

func (contentContract *ContentContract) Publish(content Content) error

func (*ContentContract) Share

func (contentContract *ContentContract) Share(share *models.ArticleShareBatch) error

type Contract

type Contract struct {
	Address common.Address
	ABI     abi.ABI
	// contains filtered or unexported fields
}

func GetContractByName

func GetContractByName(name string) (*Contract, error)

func NewContract

func NewContract(address, abi string) (*Contract, error)

func (*Contract) Execute

func (contract *Contract) Execute(method string, args ...interface{}) (string, error)

func (*Contract) GetEthClient

func (contract *Contract) GetEthClient() (*ethclient.Client, error)

func (*Contract) GetEventNameByTopicHash

func (contract *Contract) GetEventNameByTopicHash(hash string) (string, error)

func (*Contract) InitABI

func (contract *Contract) InitABI(ABIJson string) error

func (*Contract) InitEventNameHashMap

func (contract *Contract) InitEventNameHashMap()

type CreateLogArgs

type CreateLogArgs struct {
	Title       []byte
	Description []byte
	Signature   []byte
}

type GroupContract

type GroupContract struct {
	Contract *Contract
}

func GetGroupContract

func GetGroupContract() (*GroupContract, error)

func (*GroupContract) AddMember

func (groupContract *GroupContract) AddMember(member *models.GroupMember) error

func (*GroupContract) Create

func (groupContract *GroupContract) Create(group *models.Group) error

func (*GroupContract) HandleEvent

func (groupContract *GroupContract) HandleEvent(eventLog *types.Log, db *gorm.DB) error

func (*GroupContract) RemoveMember

func (groupContract *GroupContract) RemoveMember(member *models.GroupMember) error

func (*GroupContract) RemoveMemberByOwner

func (groupContract *GroupContract) RemoveMemberByOwner(member *models.GroupMember, ownerAddress string) error

type IncentiveContract

type IncentiveContract struct {
	Contract *Contract
}

func GetIncentiveContract

func GetIncentiveContract() (*IncentiveContract, error)

func (*IncentiveContract) AssignIncentives

func (incentiveContract *IncentiveContract) AssignIncentives(db *gorm.DB) error

func (*IncentiveContract) Distribute

func (incentiveContract *IncentiveContract) Distribute(incentives map[string]*big.Int) error

type LikeLogArgs

type LikeLogArgs struct {
	ArticleDNA []byte
	GroupDNA   []byte
	Signature  []byte
}

type MetadataContract

type MetadataContract struct {
	Contract *Contract
}

func GetMetadataContract

func GetMetadataContract() (*MetadataContract, error)

func (*MetadataContract) HandleEvent

func (metadataContract *MetadataContract) HandleEvent(eventLog *types.Log, db *gorm.DB) error

type PublishLogArgs

type PublishLogArgs struct {
	Title       []byte
	ContentHash []byte
	License     []byte
	Extras      []byte
	BlockHash   []byte
	Signature   []byte
	DNA         []byte
}

type RemoveMemberByOwnerLogArgs

type RemoveMemberByOwnerLogArgs struct {
	GroupDNA           []byte
	GroupMemberAddress []byte
	Signature          []byte
}

type RemoveMemberLogArgs

type RemoveMemberLogArgs struct {
	GroupDNA  []byte
	Signature []byte
}

type ShareLogArgs

type ShareLogArgs struct {
	ArticleDNA []byte
	GroupsDNA  []byte
	Signature  []byte
}

type TokenContract

type TokenContract struct {
	Contract *Contract
}

func GetTokenContract

func GetTokenContract() (*TokenContract, error)

func (*TokenContract) HandleEvent

func (tokenContract *TokenContract) HandleEvent(eventLog *types.Log, db *gorm.DB) error

func (*TokenContract) Inflate

func (tokenContract *TokenContract) Inflate() error

type TokenLockArgs

type TokenLockArgs struct {
	UserAddress  common.Address
	ResourceType *big.Int
	ResourceDNA  []byte
	Amount       *big.Int
	Expire       *big.Int
}

type UserContract

type UserContract struct {
	Contract *Contract
}

func GetUserContract

func GetUserContract() (*UserContract, error)

func (*UserContract) Burn

func (userContract *UserContract) Burn(timestamp, userAddress, signature string) error

func (*UserContract) HandleEvent

func (userContract *UserContract) HandleEvent(eventLog *types.Log, db *gorm.DB) error

type UserTokenBurnArgs

type UserTokenBurnArgs struct {
	UserAddress common.Address
	Amount      *big.Int
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL