remove smart contract lottery and puzzle

pull/938/head
Minh Doan 6 years ago committed by Minh Doan
parent ed60d6cccb
commit 0c906c03e3
  1. 10
      node/contract.go
  2. 9
      node/node.go

@ -31,8 +31,6 @@ type builtInSC uint
const ( const (
scFaucet builtInSC = iota scFaucet builtInSC = iota
scStaking scStaking
scLottery
scPuzzle
) )
// AddStakingContractToPendingTransactions adds the deposit smart contract the genesis block. // AddStakingContractToPendingTransactions adds the deposit smart contract the genesis block.
@ -220,14 +218,6 @@ func (node *Node) AddContractKeyAndAddress(t builtInSC) {
node.CurrentStakes = make(map[common.Address]*structs.StakeInfo) node.CurrentStakes = make(map[common.Address]*structs.StakeInfo)
stakingPrivKey := contract_constants.GenesisBeaconAccountPriKey stakingPrivKey := contract_constants.GenesisBeaconAccountPriKey
node.StakingContractAddress = crypto.CreateAddress(crypto.PubkeyToAddress(stakingPrivKey.PublicKey), uint64(0)) node.StakingContractAddress = crypto.CreateAddress(crypto.PubkeyToAddress(stakingPrivKey.PublicKey), uint64(0))
case scLottery:
// lottery
lotteryPriKey, _ := crypto.HexToECDSA(contract_constants.DemoAccounts[0].Private)
node.DemoContractAddress = crypto.CreateAddress(crypto.PubkeyToAddress(lotteryPriKey.PublicKey), uint64(0))
case scPuzzle:
// puzzle
puzzlePriKey, _ := crypto.HexToECDSA(contract_constants.PuzzleAccounts[0].Private)
node.PuzzleContractAddress = crypto.CreateAddress(crypto.PubkeyToAddress(puzzlePriKey.PublicKey), uint64(0))
default: default:
utils.GetLogInstance().Error("AddContractKeyAndAddress", "unknown SC", t) utils.GetLogInstance().Error("AddContractKeyAndAddress", "unknown SC", t)
} }

@ -337,15 +337,6 @@ func New(host p2p.Host, consensusObj *consensus.Consensus, chainDBFactory shardc
node.AddContractKeyAndAddress(scStaking) node.AddContractKeyAndAddress(scStaking)
} }
} }
if node.isFirstTime {
// TODO(minhdoan): Think of a better approach to deploy smart contract.
// This is temporary for demo purpose.
node.AddLotteryContract()
node.AddPuzzleContract()
} else {
node.AddContractKeyAndAddress(scLottery)
node.AddContractKeyAndAddress(scPuzzle)
}
} }
node.ContractCaller = contracts.NewContractCaller(node.Blockchain(), params.TestChainConfig) node.ContractCaller = contracts.NewContractCaller(node.Blockchain(), params.TestChainConfig)

Loading…
Cancel
Save