private static ExecutionState Runtime_MintTokens(RuntimeVM Runtime) { ExpectStackSize(Runtime, 4); VMObject temp; var source = PopAddress(Runtime); var destination = PopAddress(Runtime); temp = Runtime.Stack.Pop(); Runtime.Expect(temp.Type == VMType.String, "expected string for symbol"); var symbol = temp.AsString(); temp = Runtime.Stack.Pop(); Runtime.Expect(temp.Type == VMType.Number, "expected number for amount"); var amount = temp.AsNumber(); if (Runtime.Nexus.HasGenesis) { Runtime.Expect(symbol != DomainSettings.FuelTokenSymbol && symbol != DomainSettings.StakingTokenSymbol, "cannot mint system tokens after genesis"); } Runtime.MintTokens(symbol, source, destination, amount); return(ExecutionState.Running); }
private static ExecutionState Runtime_MintTokens(RuntimeVM Runtime) { Runtime.Expect(Runtime.Stack.Count >= 4, "not enough arguments in stack"); VMObject temp; var source = PopAddress(Runtime); var destination = PopAddress(Runtime); temp = Runtime.Stack.Pop(); Runtime.Expect(temp.Type == VMType.String, "expected string for symbol"); var symbol = temp.AsString(); temp = Runtime.Stack.Pop(); Runtime.Expect(temp.Type == VMType.Number, "expected number for amount"); var amount = temp.AsNumber(); var success = Runtime.MintTokens(symbol, source, destination, amount); var result = new VMObject(); result.SetValue(success); Runtime.Stack.Push(result); return(ExecutionState.Running); }
private static ExecutionState Runtime_MintTokens(RuntimeVM vm) { vm.ExpectStackSize(4); var source = vm.PopAddress(); var destination = vm.PopAddress(); var symbol = vm.PopString("symbol"); var amount = vm.PopNumber("amount"); if (vm.Nexus.HasGenesis) { var isMinter = vm.IsMintingAddress(source, symbol); vm.Expect(isMinter, $"{source} is not a valid minting address for {symbol}"); } vm.MintTokens(symbol, source, destination, amount); return(ExecutionState.Running); }