Пример #1
0
        public EventDutchAuctionTests()
        {
            var network = new SmartContractsRegTest();

            this.TestAddress = "0x0000000000000000000000000000000000000001".HexToAddress();
            this.ta2         = "0x0000000000000000000000000000000000000002".HexToAddress();
            this.ta3         = "0x0000000000000000000000000000000000000003".HexToAddress();
            this.ta4         = "0x0000000000000000000000000000000000000004".HexToAddress();
            this.ta5         = "0x0000000000000000000000000000000000000005".HexToAddress();
            var block = new TestBlock
            {
                Coinbase = this.TestAddress,
                Number   = 1
            };
            var message = new TestMessage
            {
                ContractAddress = this.TestAddress,
                Sender          = this.TestAddress,
                Value           = Value
            };
            var getBalance      = new Func <ulong>(() => Balance);
            var persistentState = new TestPersistentState();
            var serializer      = new Serializer(new ContractPrimitiveSerializer(network));
            var log             = new TestContractLogger();

            this.smartContractState = new TestSmartContractState(
                block,
                message,
                persistentState,
                serializer,
                null,
                null,
                getBalance,
                null,
                log
                );
            ulong  totalSupply           = 1000_000;
            ulong  ticketsAmount         = 3;
            string name                  = "New Event";
            string symbol                = "ENT";
            ulong  auctiontBlockDuration = 5000;
            ulong  maxPrice              = 2000000000;
            ulong  minPrice              = 1000;

            this.contract = new EventDutchAuction(this.smartContractState, ticketsAmount, name, symbol, auctiontBlockDuration, maxPrice, minPrice);
        }
Пример #2
0
        public StandardTokenTests()
        {
            var network = new SmartContractsRegTest();

            this.TestAddress = "0x0000000000000000000000000000000000000001".HexToAddress();
            this.ta2         = "0x0000000000000000000000000000000000000002".HexToAddress();
            this.ta3         = "0x0000000000000000000000000000000000000003".HexToAddress();
            this.ta4         = "0x0000000000000000000000000000000000000004".HexToAddress();
            this.ta5         = "0x0000000000000000000000000000000000000005".HexToAddress();
            var block = new TestBlock
            {
                Coinbase = this.TestAddress,
                Number   = 1
            };
            var message = new TestMessage
            {
                ContractAddress = this.TestAddress,
                Sender          = this.TestAddress,
                Value           = Value
            };
            var getBalance      = new Func <ulong>(() => Balance);
            var persistentState = new TestPersistentState();
            var serializer      = new Serializer(new ContractPrimitiveSerializer(network));

            this.smartContractState = new TestSmartContractState(
                block,
                message,
                persistentState,
                serializer,
                null,
                null,
                getBalance,
                null,
                null
                );
            ulong totalSupply = 1000_000; string name = "TestToken"; string symbol = "TST";

            this.contract = new StandardToken(this.smartContractState, totalSupply, name, symbol);
        }